2017-10-28 23:21:46 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
2018-03-06 11:27:57 -06:00
|
|
|
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
|
|
|
|
)
|
2017-10-30 07:36:30 -05:00
|
|
|
|
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"
|
2018-03-06 11:27:57 -06:00
|
|
|
clear ; sleep 1
|
2017-10-29 09:20:48 -05:00
|
|
|
done
|
|
|
|
|
2018-02-05 21:31:56 -06:00
|
|
|
|
2018-02-04 10:09:32 -06:00
|
|
|
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
|
2017-12-07 22:20:42 -06:00
|
|
|
else
|
2018-03-06 11:27:57 -06:00
|
|
|
echo "[INFO] Backup already exists... Not overwriting"
|
2017-12-07 22:20:42 -06:00
|
|
|
sleep 2
|
|
|
|
fi
|
2017-10-30 05:17:51 -05:00
|
|
|
}
|
2017-10-28 23:21:46 -05:00
|
|
|
|
2018-02-04 10:09:32 -06:00
|
|
|
setup_configs() {
|
2017-12-07 22:20:42 -06:00
|
|
|
sudo pacman -S clutter-gtk libgee archlabs-jgmenu --needed --noconfirm
|
2018-02-04 10:37:23 -06:00
|
|
|
for f in "${SKEL_FILES[@]}"; do
|
|
|
|
cp -rf "$f" ~/
|
|
|
|
done
|
2018-02-05 21:31:56 -06:00
|
|
|
cp -f /etc/skel/.{bashrc,zshrc} ~/
|
2017-10-30 05:17:51 -05:00
|
|
|
}
|
2017-10-28 23:21:46 -05:00
|
|
|
|
2018-02-04 10:09:32 -06:00
|
|
|
new_configs() {
|
|
|
|
clear
|
2018-03-06 11:27:57 -06:00
|
|
|
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]: "
|
2018-02-04 10:09:32 -06:00
|
|
|
read -r answer
|
|
|
|
|
|
|
|
case "$answer" in
|
|
|
|
y|yes|Y|YES)
|
|
|
|
backup_configs
|
|
|
|
if [[ -e $HOME/Downloads/$USER-backup.tar.gz ]]; then
|
|
|
|
setup_configs
|
|
|
|
fi
|
2018-03-06 11:27:57 -06:00
|
|
|
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
|
2018-02-04 10:09:32 -06:00
|
|
|
esac
|
|
|
|
}
|
2017-10-28 23:21:46 -05:00
|
|
|
|
2018-03-06 11:27:57 -06:00
|
|
|
if ! pacman -Qsq archlabs-user-skel &>/dev/null; then
|
2018-02-04 10:37:23 -06:00
|
|
|
for f in "${SKEL_FILES[@]}"; do
|
|
|
|
sudo rm -rf "$f"
|
|
|
|
done
|
2017-12-07 22:20:42 -06:00
|
|
|
sudo pacman -S archlabs-user-skel --needed --noconfirm
|
|
|
|
else
|
|
|
|
sudo pacman -Syyu --noconfirm
|
|
|
|
fi
|
2018-02-04 10:09:32 -06:00
|
|
|
new_configs
|
2017-10-29 09:20:48 -05:00
|
|
|
|
|
|
|
clear
|
2017-12-07 22:20:42 -06:00
|
|
|
echo "##########################################################
|
|
|
|
######## Setup Completed #########
|
|
|
|
##########################################################"
|
2017-10-28 23:21:46 -05:00
|
|
|
|
|
|
|
exit 0
|