This repository has been archived on 2024-09-01. You can view files and clone it, but cannot push or open issues or pull requests.
al-skel/upgrade-archlabs

83 lines
2.5 KiB
Bash
Executable File

#!/usr/bin/env bash
REPOS='
[archlabs_repo]
Server = https://archlabs.github.io/archlabs_repo/$arch
Server = https://downloads.sourceforge.net/project/archlabs-repo/archlabs_repo/$arch'
HOME_FILES=("$HOME/bin" "$HOME/.config" "$HOME/.themes"
"$HOME/.gorice" "$HOME/.Xresources" "$HOME/.Xresources.template"
"$HOME/.mozilla" "$HOME/.zshrc" "$HOME/.bashrc"
"$HOME/.local" "$HOME/.xprofile" "$HOME/.xinitrc"
"$HOME/.icons" "$HOME/.gtkrc-2.0"
)
SKEL_FILES=(/etc/skel/bin /etc/skel/.config /etc/skel/.themes
/etc/skel/.Xresources /etc/skel/.gorice /etc/skel/.icons
/etc/skel/.gtkrc-2.0 /etc/skel/.xprofile /etc/skel/.xinitrc
/etc/skel/.mozilla /etc/skel/.Xresources.template
)
# Loop until network connected
while ! [[ $(ping -c1 8.8.8.8) ]]; do
echo -e "Please Connect to a Network Before Continuing"
clear; sleep 1
done
backup_configs() {
if ! [[ -e "$HOME/Downloads/$USER-backup.tar.gz" ]]; then
tar czvf "$HOME/Downloads/$USER-backup.tar.gz" "${HOME_FILES[@]}" >/dev/null 2>&1
else
echo "[WARNING] Backup already exists... Not overwriting"
sleep 2
fi
}
setup_configs() {
sudo pacman -S clutter-gtk libgee archlabs-jgmenu --needed --noconfirm
sudo pacman -S gdk-pixbuf2 pango python-yaml --needed --noconfirm
for f in "${SKEL_FILES[@]}"; do
cp -rf "$f" ~/
done
cp -f /etc/skel/.{bashrc,zshrc} ~/
}
new_configs() {
clear
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]:"
read -r answer
case "$answer" in
y|yes|Y|YES)
backup_configs
if [[ -e $HOME/Downloads/$USER-backup.tar.gz ]]; then
setup_configs
fi
rm -f "$HOME/.config/keypack"
sed -i '/keypack/d' "$HOME/.config/openbox/autostart"
~/.config/setup
esac
}
if ! pacman -Q archlabs-user-skel >/dev/null 2>&1; then
for f in "${SKEL_FILES[@]}"; do
sudo rm -rf "$f"
done
sudo pacman -S archlabs-user-skel --needed --noconfirm
else
sudo pacman -Syyu --noconfirm
fi
new_configs
clear
echo "##########################################################
######## Setup Completed #########
##########################################################"
exit 0