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-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'
|
|
|
|
|
|
|
|
KEYS=('AEFB411B072836CD48FF0381AE252C284B5DBA5D'
|
|
|
|
'9E4F11C6A072942A7B3FD3B0B81EB14A09A25EB0'
|
|
|
|
'35F52A02854DCCAEC9DD5CC410443C7F54B00041')
|
|
|
|
DIR="$HOME/.config"
|
2017-10-29 00:14:45 -05:00
|
|
|
SCRIPT_PATH=$(pwd)
|
2017-10-28 23:21:46 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setupKeyring() {
|
|
|
|
|
|
|
|
# import each key and populate the keyring
|
|
|
|
unset POPULATED
|
|
|
|
while ! [ $POPULATED ]; do
|
|
|
|
|
|
|
|
clear; echo "############################################################################################
|
|
|
|
######## Setting up keyring & Adding repo to pacman.conf #########
|
|
|
|
############################################################################################"
|
|
|
|
sudo pacman-key --init
|
|
|
|
sudo pacman-key --populate archlinux
|
|
|
|
|
|
|
|
for key in ${KEYS[@]}; do
|
2017-10-28 23:31:54 -05:00
|
|
|
if ! sudo pacman-key --list-keys | grep $key; then
|
2017-10-28 23:21:46 -05:00
|
|
|
gpg --receive-keys $key
|
|
|
|
sudo pacman-key -r $key
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# add $REPO to pacman.conf
|
|
|
|
if ! grep "archlabs_repo" /etc/pacman.conf; then
|
|
|
|
echo "${REPO}" | sudo tee -a /etc/pacman.conf
|
2017-10-29 00:26:13 -05:00
|
|
|
else ## if entries exist just remove them
|
|
|
|
sudo sed -i '/archlabs_repo/d'
|
|
|
|
echo "${REPO}" | sudo tee -a /etc/pacman.conf
|
2017-10-28 23:21:46 -05:00
|
|
|
fi
|
|
|
|
|
|
|
|
# finish
|
2017-10-29 00:14:45 -05:00
|
|
|
sudo pacman-key --populate archlabs
|
|
|
|
POPULATED="Done"
|
2017-10-28 23:21:46 -05:00
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
backupConfigs() {
|
|
|
|
|
|
|
|
# Backup configs to $HOME/Downloads/
|
|
|
|
unset BACKEDUP
|
|
|
|
while ! [ $BACKEDUP ]; do
|
|
|
|
|
|
|
|
clear; echo "############################################################################################
|
|
|
|
######## Backing up configs to /home/$USER/Downloads/$USER-config-backup.tar.gz #########
|
|
|
|
############################################################################################"
|
|
|
|
|
|
|
|
# Do the archive
|
2017-10-29 00:14:45 -05:00
|
|
|
tar czvf $HOME/Downloads/$USER-config-backup.tar.gz $HOME/.{config,Xresources,zshrc,bashrc,icons,xsession,xsessionrc,xinitrc} > /dev/null 2>&1
|
2017-10-28 23:21:46 -05:00
|
|
|
|
|
|
|
# set BACKEDUP for setupConfigs check
|
|
|
|
BACKEDUP="Done"
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setupConfigs() {
|
|
|
|
|
2017-10-29 00:14:45 -05:00
|
|
|
# get rid of old leftover configs/scripts
|
|
|
|
rm -rf $HOME/.config/{bspwm,dunst,i3,obmenu-generator,qt5ct,Thunar,conky,geany,neofetch,polybar,termite,xfce4,openbox}
|
|
|
|
sudo rm -rf /etc/skel/*
|
|
|
|
clear; echo "############################################################################################
|
2017-10-28 23:21:46 -05:00
|
|
|
######## Setting up new configs #########
|
|
|
|
############################################################################################"
|
2017-10-29 00:14:45 -05:00
|
|
|
# Copy configs to /etc/skel/ & $HOME
|
|
|
|
cp -rf "$PWD/home/"{bin,.config,.themes,.gorice,.Xresources,.Xresources.template,.mozilla,.zshrc,.bashrc,.icons,.local,.xsession,.xsessionrc,.xinitrc} "$HOME/"
|
|
|
|
sudo cp -rf "$PWD/home/"{bin,.config,.themes,.gorice,.Xresources,.Xresources.template,.mozilla,.zshrc,.bashrc,.icons,.local,.xsession,.xsessionrc,.xinitrc} /etc/skel/
|
|
|
|
sudo cp -rf "$PWD/etc" /
|
2017-10-28 23:21:46 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# first setupKeyring
|
|
|
|
setupKeyring
|
|
|
|
|
2017-10-29 00:14:45 -05:00
|
|
|
# call backupConfigs before we continue
|
|
|
|
backupConfigs
|
2017-10-28 23:21:46 -05:00
|
|
|
|
2017-10-29 00:14:45 -05:00
|
|
|
# then setupConfigs
|
|
|
|
setupConfigs
|
2017-10-28 23:21:46 -05:00
|
|
|
|
2017-10-29 00:14:45 -05:00
|
|
|
# finish up by setting and reloading everything
|
|
|
|
$HOME/.config/setup
|
|
|
|
$HOME/.config/polybar/scripts/launch-polybar --reload > /dev/null 2>&1
|
2017-10-28 23:21:46 -05:00
|
|
|
|
|
|
|
clear; echo "############################################################################################
|
|
|
|
######## Setup Successfully Completed #########
|
|
|
|
############################################################################################"
|
|
|
|
|
|
|
|
|
|
|
|
exit 0
|