1
0
mirror of https://github.com/Foltik/dotfiles synced 2024-11-30 22:42:11 -05:00
dotfiles/configure.sh

176 lines
3.5 KiB
Bash
Raw Normal View History

2017-07-24 20:58:23 -04:00
#!/bin/zsh
2017-12-06 15:38:22 -05:00
# Print Header
2017-07-24 20:58:23 -04:00
lnh() {
print -Pn '%B%F{green}### '
print -n $1
print -P ' ###%f%b'
}
2017-12-06 15:38:22 -05:00
# Print subheader
ln() {
print -Pn '%B%F{yellow}>>> '
print -n $1
print -P '%f%b'
2017-07-24 20:58:23 -04:00
}
2017-12-06 15:38:22 -05:00
pac_install() {
if ! (pacman -Q $1 >/dev/null 2>&1);
then
ln "Installing $1 from Official Repos..."
sudo pacman -S $1 --noconfirm
fi;
2017-07-24 21:09:14 -04:00
}
2017-12-06 15:38:22 -05:00
aur_install() {
if ! (pacman -Q $1 >/dev/null 2>&1);
then
ln "Installing $1 from AUR..."
yaourt -S $1 --noconfirm
fi;
2017-07-24 21:09:14 -04:00
}
2017-07-24 20:58:23 -04:00
2017-12-06 15:38:22 -05:00
svc_install() {
sudo cp -v "$1" '/etc/systemd/system'
}
svc_install_user() {
sudo cp -v "$1" '/etc/systemd/user'
}
svc_enable() {
sudo systemctl enable $1
}
svc_enable_user() {
systemctl --user enable $1
2017-07-24 20:58:23 -04:00
}
install_i3() {
2017-12-06 15:38:22 -05:00
lnh "Installing i3"
ln "Installing Packages"
aur_install i3-gaps
aur_install i3blocks-gaps-git
aur_install i3lock
aur_install i3lock-fancy-dualmonitors-git
pac_install compton
ln "Installing Services"
svc_install cfg/systemd/system/suspend@.service # suspend locker
svc_install_user cfg/systemd/user/locker.service # xautolock
2017-08-01 23:07:30 -04:00
2017-12-06 15:38:22 -05:00
ln "Enabling Services"
sudo systemctl daemon-reload
svc_enable suspend@$USER.service
svc_enable_user locker.service
2017-08-01 23:07:30 -04:00
2017-12-06 15:38:22 -05:00
ln "Installing Configuration Files"
2017-07-24 21:13:59 -04:00
cp -v cfg/compton/config ~/.config/compton/config
cp -v cfg/termite/ncmpcpp_config ~/.config/termite/ncmpcpp_config
2017-07-24 20:58:23 -04:00
2017-12-06 15:38:22 -05:00
ln "Installing Tools"
2017-08-01 23:47:28 -04:00
mkdir -pv ~/Documents/tools
2017-07-24 21:13:59 -04:00
cp -v cfg/i3/tools/wallpaper.sh ~/Documents/tools/
cp -v cfg/wallpapers/wallpaper* ~/Pictures/
2017-07-24 20:58:23 -04:00
2017-07-24 21:09:14 -04:00
lnh "Select a Platform"
2017-07-24 20:58:23 -04:00
platform_opt=("Desktop" "Laptop")
select opt in "${platform_opt[@]}"
do
case $opt in
"Desktop")
2017-12-06 15:38:22 -05:00
lnh "Platform Not Supported with i3"
exit
2017-07-24 20:58:23 -04:00
break
;;
"Laptop")
install_i3_laptop
break
;;
*) echo "Invalid Option";;
esac
done
}
install_i3_laptop() {
2017-12-06 15:38:22 -05:00
ln "Installing Laptop Configuration Files"
2017-07-26 14:05:09 -04:00
cp -v cfg/i3blocks/laptop/config ~/.config/i3blocks/config
2017-08-01 23:47:28 -04:00
cp -rv cfg/i3blocks/laptop/blocks ~/.config/i3blocks/blocks
2017-08-01 23:07:30 -04:00
}
2018-01-13 11:11:25 -05:00
install_common() {
ln "Installing Common Packages"
pac_install rxvt-unicode
pac_install zsh
pac_install autojump
pac_install neovim
pac_install mpd
pac_install beets
pac_install ncmpcpp
aur_install oh-my-zsh-git
aur_install nerd-fonts-source-code-pro
}
2017-08-01 23:07:30 -04:00
configure_common() {
ln "Installing Common Configuration Files"
# powerlevel9k
sudo git clone https://github.com/bhilburn/powerlevel9k.git /usr/share/oh-my-zsh/themes/powerlevel9k
2018-01-13 11:11:25 -05:00
# urxvt
cp -v cfg/Xdefaults ~/.Xdefaults
2017-12-06 15:38:22 -05:00
# zsh
cp -v cfg/zshrc ~/.zshrc
# neovim
mkdir -pv ~/.config/nvim
2017-12-06 15:38:22 -05:00
cp -v cfg/nvim/init.vim ~/.config/nvim
nvim +PlugInstall +qall
2017-12-06 15:38:22 -05:00
# mpd
2018-01-13 12:10:07 -05:00
mkdir -pv ~/.config/mpd/playlists
2017-12-06 15:38:22 -05:00
awk '{gsub(/lain/,"'$USER'")}1' cfg/mpd/mpd.conf > mpd.conf.temp && mv mpd.conf.temp cfg/mpd/mpd.conf
cp -rv cfg/mpd/* ~/.config/mpd/
2017-12-06 15:38:22 -05:00
# beets
mkdir -pv ~/Music/beets
mkdir -pv ~/.config/beets
cp -rv cfg/beets/* ~/.config/beets
2017-12-06 15:38:22 -05:00
# ncmpcpp
2018-01-13 11:11:25 -05:00
mkdir -pv ~/.ncmpcpp
2017-12-06 15:38:22 -05:00
cp -v cfg/ncmpcpp/config ~/.ncmpcpp/
ln "Installing Common Services"
svc_enable_user mpd
2018-01-13 11:11:25 -05:00
#svc_enable NetworkManager
ln "Changing Shell"
chsh -s /bin/zsh
2017-07-24 20:58:23 -04:00
}
2017-12-06 15:38:22 -05:00
lnh "Select a Window Manager"
2018-01-13 11:11:25 -05:00
wm_opt=("Gnome" "i3" "None (Only install common config)")
2017-07-24 20:58:23 -04:00
select opt in "${wm_opt[@]}"
do
case $opt in
"Gnome")
2018-01-13 11:11:25 -05:00
lnh "Not yet fully supported!"
exit
2017-07-24 20:58:23 -04:00
break
;;
"i3")
install_i3
break
;;
2018-01-13 11:11:25 -05:00
"None (Only install common config)")
install_common
break
;;
2017-08-01 23:07:30 -04:00
*) echo "Invalid Option";;
2017-07-24 20:58:23 -04:00
esac
done
2017-12-06 15:38:22 -05:00
configure_common