configs/arch-config/scripts/arch-config.sh

206 lines
5.6 KiB
Bash
Raw Normal View History

2020-03-12 11:44:07 +01:00
#!/bin/bash
2020-10-12 07:15:20 +02:00
set -euo pipefail
2020-04-10 13:12:35 +02:00
#ANY CHANGES TO THE INSTALLATION PROCEDURE SHOULD BE MADE HERE
2021-02-16 18:34:17 +01:00
# check if user is root
if [ "$EUID" -ne 0 ]; then
sudo -l > /dev/null
fi
2020-03-12 11:44:07 +01:00
#change to home (does not show in terminal)
2020-10-12 07:18:24 +02:00
cd "$HOME"
2020-03-12 11:44:07 +01:00
#remove old installs
2020-04-18 23:36:24 +02:00
rm -rf ~/config
2020-03-12 11:44:07 +01:00
#clone this repo
2021-01-29 16:45:59 +01:00
git clone https://gitlab.com/RealStickman-arch/config.git &&
2020-03-12 11:44:07 +01:00
# check if the install scripts are the same
if ! cmp --silent "$HOME/scripts/arch-config.sh" "$HOME/config/scripts/arch-config.sh" ; then
2020-11-10 08:31:35 +01:00
echo Removed old config file and launched new one.
rm "$HOME/scripts/arch-config.sh" && cp "$HOME/config/scripts/arch-config.sh" "$HOME/scripts/" && bash ~/scripts/arch-config.sh
fi
#delete previous backups
echo Removing old backup
rm -rf ~/old_dat
2020-09-09 20:56:53 +02:00
2020-11-23 13:30:16 +01:00
# make new backup
echo Creating backup
2020-11-23 13:30:16 +01:00
mkdir -p ~/old_dat/.config || echo Directory already exists
mkdir -p ~/old_dat/.doom.d || echo Directory already exists
mkdir -p ~/old_dat/.easystroke || echo Directory already exists
mkdir -p ~/old_dat/.mozilla || echo Directory already exists
mkdir -p ~/old_dat/scripts || echo Directory already exists
2020-09-09 20:56:53 +02:00
2020-11-10 07:58:07 +01:00
# make subdirectories
2020-11-23 13:30:16 +01:00
mkdir -p ~/old_dat/.local/share || echo Directory already exists
2020-11-10 07:58:07 +01:00
##############################
# back stuff up
##############################
#config folders
2020-11-10 07:58:07 +01:00
rsync -ah ~/.config/MangoHud ~/old_dat/.config/ || echo Directory does not exist
rsync -ah ~/.config/fish ~/old_dat/.config/ || echo Directory does not exist
rsync -ah ~/.config/gtk-3.0 ~/old_dat/.config/ || echo Directory does not exist
rsync -ah ~/.config/i3 ~/old_dat/.config/ || echo Directory does not exist
rsync -ah ~/.config/neofetch ~/old_dat/.config/ || echo Directory does not exist
rsync -ah ~/.config/openbox ~/old_dat/.config/ || echo Directory does not exist
rsync -ah ~/.config/polybar ~/old_dat/.config/ || echo Directory does not exist
rsync -ah ~/.config/termite ~/old_dat/.config/ || echo Directory does not exist
rsync -ah ~/.config/variety ~/old_dat/.config/ || echo Directory does not exist
# doom.d folder
rsync -ah ~/.doom.d ~/old_dat/ || echo Directory does not exist
# easystroke
rsync -ah ~/.easystroke ~/old_dat/ || echo Directory does not exist
# local folder
rsync -ah ~/.local/share/applications/ ~/old_dat/.local/share/ || echo Directory does not exist
# mozilla
rsync -ah ~/.mozilla ~/old_dat/ || echo Directory does not exist
# scripts
rsync -ah ~/scripts ~/old_dat/ || echo Directory does not exist
2020-05-18 08:09:49 +02:00
echo Made backups
2021-02-15 11:57:49 +01:00
# remove old templates
rm -r ~/.config/Vorlagen
2020-05-18 08:09:49 +02:00
#copy folders
2020-07-30 12:58:38 +02:00
cp -r ~/config/.config/ ~/ &&
2020-11-09 19:52:31 +01:00
cp -r ~/config/.local/ ~/ &&
2020-11-13 18:27:07 +01:00
#cp -r ~/config/Dokumente ~/ &&
2020-07-30 12:58:38 +02:00
cp -r ~/config/.mozilla ~/ &&
cp -r ~/config/.easystroke ~/ &&
2020-09-09 20:56:53 +02:00
cp -r ~/config/.doom.d ~/ &&
2020-05-18 08:09:49 +02:00
echo Copied folders
2020-07-30 11:46:34 +02:00
2020-09-09 20:56:53 +02:00
#copy single files
2020-07-30 12:58:38 +02:00
cp -r ~/config/.bashrc ~/ &&
cp -r ~/config/.face ~/ &&
cp -r ~/config/.gtkrc-2.0 ~/ &&
2020-08-28 21:51:25 +02:00
cp -r ~/config/.gitconfig ~/ &&
2020-12-07 10:39:46 +01:00
cp -r ~/config/.fehbg ~/ &&
2020-12-09 17:47:08 +01:00
cp -r ~/config/.tmux.conf ~/ &&
2021-01-09 10:02:55 +01:00
cp -r ~/config/.xinitrc ~/ &&
2020-05-18 08:09:49 +02:00
echo Copied files
2020-07-30 11:46:34 +02:00
2020-12-07 10:39:46 +01:00
# make fehbg executable
chmod +x ~/.fehbg
2021-01-09 10:02:55 +01:00
# make .xinitrc executable
chmod +x ~/.xinitrc
2020-09-09 20:56:53 +02:00
#copy scripts
2020-07-30 12:58:38 +02:00
cp -r ~/config/scripts/ ~/
2020-09-09 20:56:53 +02:00
2020-11-23 13:30:16 +01:00
# copy cache
cp -r ~/config/.cache ~/
2020-04-10 13:03:58 +02:00
#copy stuff to /etc
2021-01-04 17:24:00 +01:00
sudo cp -r ~/config/etc /
#sudo rsync --exclude=default/grub ~/config/etc /etc/
2021-01-04 17:08:27 +01:00
2021-01-04 17:24:00 +01:00
#read -r -p "Do you want to overwrite the grub config? [y/N] " response
#if [[ "$response" =~ ^([yY][eE][sS][jJ]|[yY])$ ]]
#then
2021-01-04 17:08:27 +01:00
# copy config
2021-01-04 17:24:00 +01:00
# sudo cp ~/config/etc/default/grub /etc/default/
2021-01-04 17:08:27 +01:00
# update grub
2021-01-04 17:24:00 +01:00
# sudo grub-mkconfig -o /boot/grub/grub.cfg
#fi
2020-09-09 20:56:53 +02:00
# NOTE Distro specific stuff
distro=$(cat /etc/*-release | grep "^ID=")
if [ "$distro" == "ID=arcolinux" ]; then
sudo mv /etc/arco-pacman.conf /etc/pacman.conf
fi
if [ "$distro" == "ID=arch" ]; then
sudo mv /etc/arch-pacman.conf /etc/pacman.conf
fi
#copy old lightdm themes (and maybe other stuff, idk)
2020-04-18 23:36:24 +02:00
sudo cp -r ~/config/var /
2020-03-12 11:44:07 +01:00
#copy usr stuff
sudo cp -r ~/config/usr /
2020-10-27 16:32:26 +01:00
# copy xresources
2021-02-28 12:14:30 +01:00
cp ~/config/.Xresources ~/
2020-10-27 16:32:26 +01:00
2021-03-08 08:13:47 +01:00
# TODO
# copy theme select file
2021-03-08 08:15:36 +01:00
#cp ~/config/.seltheme ~/
2021-03-08 08:13:47 +01:00
2021-03-08 08:12:19 +01:00
# install theme selected in themes file
git clone https://gitlab.com/RealStickman-arch/themes.git
seltheme="$(cat "$HOME/.seltheme")"
if [[ "$seltheme" == "nyarch" ]]; then
2021-03-08 08:23:56 +01:00
cp -r "./themes/nyarch/i3" "$HOME/.config/"
cp -r "./themes/nyarch/polybar" "$HOME/.config/"
2021-03-08 08:12:19 +01:00
elif [[ "$seltheme" == "space-pink" ]]; then
2021-03-08 08:23:56 +01:00
cp -r "./themes/space-pink/i3" "$HOME/.config/"
cp -r "./themes/space-pink/polybar" "$HOME/.config/"
2021-03-08 08:12:19 +01:00
fi
rm -rf ./themes
2021-01-09 09:36:00 +01:00
# download cat as cat
git clone https://github.com/RealStickman/bash-cat-with-cat.git
2021-01-09 09:37:41 +01:00
cp ./bash-cat-with-cat/cat.sh "$HOME/scripts/pieces/cat.sh"
2021-01-09 09:36:00 +01:00
rm -rf ./bash-cat-with-cat
2020-04-15 11:18:39 +02:00
#gimp plugins
#mkdir ~/.config/GIMP/ || echo Not creating directory
#mkdir ~/.config/GIMP/2.10/ || echo Not creating directory
mkdir -p ~/.config/GIMP/2.10/plug-ins/ || echo Not creating directory
2020-09-09 20:56:53 +02:00
rsync -ah ~/config/gimp-plugins/* ~/.config/GIMP/2.10/plug-ins/
2020-07-30 11:46:34 +02:00
2020-04-15 11:21:46 +02:00
#unzip gimp plugins
2020-04-15 11:27:07 +02:00
echo Unzipping gimp plugins
2020-10-12 20:09:57 +02:00
unzip -o ~/.config/GIMP/2.10/plug-ins/export_layers-3.3.1.zip -d ~/.config/GIMP/2.10/plug-ins/ > /dev/null
rm ~/.config/GIMP/2.10/plug-ins/export_layers-3.3.1.zip > /dev/null
2020-04-15 11:21:46 +02:00
echo Unzipped gimp plugins
2020-04-15 11:18:39 +02:00
2020-03-12 11:44:07 +01:00
#make bash scripts executable
chmod +x -R ~/.config/polybar/
chmod +x -R ~/.config/i3/scripts
chmod +x -R ~/scripts
# make applications executable
chmod +x -R ~/.local/share/applications
2020-03-12 11:44:07 +01:00
#remove downloaded folder
2020-04-18 23:36:24 +02:00
rm -rf ~/config
2020-03-12 11:44:07 +01:00
2020-11-09 20:12:32 +01:00
# reload applications
update-desktop-database ~/.local/share/applications/
2020-09-09 20:56:53 +02:00
#sync doom-emacs
~/.emacs.d/bin/doom sync
2020-10-27 16:34:16 +01:00
# reload .Xresources
2021-01-29 20:03:02 +01:00
if [[ -f "$HOME/.Xresources" ]]; then
xrdb ~/.Xresources
fi
2020-10-27 16:34:16 +01:00
2020-12-07 10:39:46 +01:00
# execute feh
"$HOME/.fehbg"
2020-03-12 11:44:07 +01:00
#restart i3 in place
i3 restart
#output
echo Finished updating everything!
echo Launching new shell!
2020-11-30 08:24:00 +01:00
# reload fish
exec fish
2020-11-17 21:22:06 +01:00
exit 0