2017-10-28 23:21:46 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
#
|
|
|
|
# A script to upgrade existing installations of ArchLabs
|
|
|
|
#
|
|
|
|
# Written by Nathaniel Maia <natemaia10@gmail.com>
|
|
|
|
#
|
|
|
|
|
2017-12-07 22:20:42 -06:00
|
|
|
yes="y"
|
|
|
|
no="n"
|
2017-10-29 00:26:13 -05:00
|
|
|
REPO='
|
|
|
|
[archlabs_repo]
|
2017-10-28 23:21:46 -05:00
|
|
|
Server = https://archlabs.github.io/archlabs_repo/$arch
|
|
|
|
Server = https://downloads.sourceforge.net/project/archlabs-repo/archlabs_repo/$arch'
|
2017-10-30 07:36:30 -05:00
|
|
|
|
2017-12-07 22:20:42 -06:00
|
|
|
HFILES=("$HOME/bin" "$HOME/.config" "$HOME/.themes" "$HOME/.gtkrc-2.0"
|
|
|
|
"$HOME/.gorice" "$HOME/.Xresources" "$HOME/.Xresources.template"
|
|
|
|
"$HOME/.mozilla" "$HOME/.zshrc" "$HOME/.bashrc" "$HOME/.icons"
|
|
|
|
"$HOME/.local" "$HOME/.xprofile" "$HOME/.xserverrc" "$HOME/.xinitrc")
|
|
|
|
|
|
|
|
CFILES=("$HOME/.config/awesome" "$HOME/.config/jgmenu" "$HOME/.config/bspwm"
|
|
|
|
"$HOME/.config/dunst" "$HOME/.config/i3" "$HOME/.config/obmenu-generator"
|
|
|
|
"$HOME/.config/qt5ct" "$HOME/.config/Thunar" "$HOME/.config/conky"
|
|
|
|
"$HOME/.config/geany" "$HOME/.config/neofetch" "$HOME/.config/polybar"
|
|
|
|
"$HOME/.config/termite" "$HOME/.config/xfce4" "$HOME/.config/openbox"
|
|
|
|
"$HOME/.config/ob-autostart")
|
|
|
|
|
|
|
|
SFILES=('/etc/skel/bin' '/etc/skel/.config' '/etc/skel/.themes' '/etc/skel/.gorice'
|
|
|
|
'/etc/skel/.Xresources' '/etc/skel/.Xresources.template' '/etc/skel/.mozilla'
|
|
|
|
'/etc/skel/.zshrc' '/etc/skel/.bashrc' '/etc/skel/.icons' '/etc/skel/.local'
|
|
|
|
'/etc/skel/.xprofile' '/etc/skel/.xserverrc' '/etc/skel/.xinitrc' '/etc/skel/.gtkrc-2.0')
|
|
|
|
|
2017-10-28 23:21:46 -05:00
|
|
|
KEYS=('AEFB411B072836CD48FF0381AE252C284B5DBA5D'
|
|
|
|
'9E4F11C6A072942A7B3FD3B0B81EB14A09A25EB0'
|
|
|
|
'35F52A02854DCCAEC9DD5CC410443C7F54B00041')
|
|
|
|
|
2017-12-07 22:20:42 -06:00
|
|
|
WMS=(bspwm i3 openbox)
|
|
|
|
for i in ${WMS[@]}; do
|
|
|
|
if [[ "$(wmctrl -m | grep -i name | awk '{print tolower($2)}')" == "$i" ]]; then
|
|
|
|
WM=$i && break
|
|
|
|
elif [[ "$(xprop -root -notype | grep "WM_NAME =" | tr -d '"' | awk '{print tolower($3)}')" == "$i" ]]; then
|
|
|
|
WM=$i && break
|
|
|
|
elif [[ "$(awk '{print tolower($0)}' <<< $XDG_CURRENT_DESKTOP)" == "$i" ]]; then
|
|
|
|
WM=$i && break
|
2017-12-17 12:06:39 -06:00
|
|
|
fi
|
2017-12-07 22:20:42 -06:00
|
|
|
done
|
2017-10-28 23:21:46 -05:00
|
|
|
|
2017-10-30 05:17:51 -05:00
|
|
|
# Loop until network connected
|
2017-12-17 12:06:39 -06:00
|
|
|
while ! [[ $(ping -c1 8.8.8.8) ]]; do
|
2017-12-07 22:20:42 -06:00
|
|
|
echo -e "Please Connect to a Network Before Continuing"
|
|
|
|
clear; sleep 1
|
2017-10-29 09:20:48 -05:00
|
|
|
done
|
|
|
|
|
|
|
|
setupKeyring() {
|
2017-12-07 22:20:42 -06:00
|
|
|
sudo dirmngr </dev/null
|
|
|
|
sudo pacman-key --init
|
|
|
|
sudo pacman-key --populate archlinux
|
|
|
|
for key in ${KEYS[@]}; do
|
|
|
|
if ! sudo pacman-key --list-keys | grep $key > /dev/null 2>&1; then
|
|
|
|
gpg --receive-keys $key
|
|
|
|
sudo pacman-key -r $key
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
sudo pacman -S archlabs-keyring --needed --noconfirm
|
|
|
|
sudo pacman-key --populate archlabs
|
|
|
|
|
|
|
|
if grep "archlabs_repo" /etc/pacman.conf > /dev/null 2>&1; then
|
|
|
|
sudo sed -i '/archlabs_repo/d' /etc/pacman.conf
|
|
|
|
fi
|
|
|
|
echo $REPO | sudo tee -a /etc/pacman.conf > /dev/null 2>&1
|
2017-10-28 23:21:46 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
backupConfigs() {
|
2017-12-07 22:20:42 -06:00
|
|
|
if ! [ -e "$HOME/Downloads/$USER-backup.tar.gz" ]; then
|
|
|
|
tar czvf $HOME/Downloads/$USER-backup.tar.gz ${HFILES[@]} > /dev/null 2>&1
|
|
|
|
else
|
|
|
|
echo "[WARNING] Backup already exists... Not overwriting"
|
|
|
|
sleep 2
|
|
|
|
fi
|
2017-10-30 05:17:51 -05:00
|
|
|
}
|
2017-10-28 23:21:46 -05:00
|
|
|
|
|
|
|
setupConfigs() {
|
2017-12-07 22:20:42 -06:00
|
|
|
sudo pacman -S clutter-gtk libgee archlabs-jgmenu --needed --noconfirm
|
|
|
|
sudo pacman -S gdk-pixbuf2 pango python-yaml --needed --noconfirm
|
|
|
|
rm -rf ${CFILES[@]}
|
|
|
|
cp -rf ${SFILES[@]} /etc/skel/.zshrc /etc/skel/.bashrc $HOME/
|
2017-10-30 05:17:51 -05:00
|
|
|
}
|
2017-10-28 23:21:46 -05:00
|
|
|
|
|
|
|
|
2017-10-30 07:06:49 -05:00
|
|
|
# first setup Keyring
|
2017-10-28 23:21:46 -05:00
|
|
|
setupKeyring
|
|
|
|
|
2017-12-07 22:20:42 -06:00
|
|
|
# make sure skel package is installed and updated
|
|
|
|
if ! pacman -Q archlabs-user-skel >/dev/null 2>&1; then
|
|
|
|
sudo rm -rf ${SFILES[@]}
|
|
|
|
sudo pacman -S archlabs-user-skel --needed --noconfirm
|
|
|
|
else
|
|
|
|
sudo pacman -Syyu --noconfirm
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2017-10-29 09:20:48 -05:00
|
|
|
clear
|
2017-12-07 22:20:42 -06:00
|
|
|
printf "\nThis step will get the latest configs for polybar, openbox, i3 etc.
|
|
|
|
\n\nYour existing configs will be archived to:
|
|
|
|
\n\t$HOME/Downloads/$USER-backup.tar.gz\n\n\n\nDo you want to continue? [y/N]:"
|
2017-10-29 09:20:48 -05:00
|
|
|
read -r answer
|
2017-10-28 23:21:46 -05:00
|
|
|
|
2017-10-29 09:20:48 -05:00
|
|
|
if [ "${answer,,}" = "${yes,,}" ]; then
|
2017-12-07 22:20:42 -06:00
|
|
|
backupConfigs
|
|
|
|
if [ -e "$HOME/Downloads/$USER-backup.tar.gz" ]; then
|
|
|
|
setupConfigs
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -f $HOME/.config/keypack
|
|
|
|
sed -i '/keypack/d' $HOME/.config/openbox/autostart
|
|
|
|
$HOME/.config/setup
|
|
|
|
|
|
|
|
if [[ "$WM" == "i3" ]]; then
|
|
|
|
i3-msg restart
|
|
|
|
elif [[ "$WM" == "openbox" ]]; then
|
2017-12-17 12:06:39 -06:00
|
|
|
al-polybar-session -r
|
2017-12-07 22:20:42 -06:00
|
|
|
fi
|
2017-10-29 09:20:48 -05:00
|
|
|
fi
|
|
|
|
|
|
|
|
clear
|
2017-12-07 22:20:42 -06:00
|
|
|
echo "##########################################################
|
|
|
|
######## Setup Completed #########
|
|
|
|
##########################################################"
|
2017-10-28 23:21:46 -05:00
|
|
|
|
|
|
|
exit 0
|