80 lines
2.3 KiB
Bash
Executable File
80 lines
2.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
|
|
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
|
|
)
|
|
|
|
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 "[INFO] Backup already exists... Not overwriting"
|
|
sleep 2
|
|
fi
|
|
}
|
|
|
|
setup_configs() {
|
|
sudo pacman -S clutter-gtk libgee archlabs-jgmenu --needed --noconfirm
|
|
for f in "${SKEL_FILES[@]}"; do
|
|
cp -rf "$f" ~/
|
|
done
|
|
cp -f /etc/skel/.{bashrc,zshrc} ~/
|
|
}
|
|
|
|
new_configs() {
|
|
clear
|
|
echo -e "\nThis step will get the latest configs for polybar, openbox, i3 etc.
|
|
\n\nYour existing configs will be archived to:\n\n\t$HOME/Downloads/$USER-backup.tar.gz\n\n\n"
|
|
printf "Do 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
|
|
if [[ -e $HOME/.config/keypack ]]; then
|
|
rm -f "$HOME/.config/keypack"
|
|
sed -i '/keypack/d' "$HOME/.config/openbox/autostart"
|
|
fi
|
|
if [[ -x $HOME/.config/setup ]]; then
|
|
"$HOME/.config/setup"
|
|
fi
|
|
esac
|
|
}
|
|
|
|
if ! pacman -Qsq archlabs-user-skel &>/dev/null; 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
|