2023-11-10 16:12:15 -05:00
|
|
|
# ------------------------------------------------------
|
|
|
|
# Copy dotfiles
|
|
|
|
# ------------------------------------------------------
|
2023-11-17 07:48:02 -05:00
|
|
|
if [ ! -d ~/dotfiles ]; then
|
|
|
|
echo -e "${GREEN}"
|
2023-12-21 15:57:44 -05:00
|
|
|
figlet "Installation"
|
2023-11-17 07:48:02 -05:00
|
|
|
echo -e "${NONE}"
|
|
|
|
else
|
|
|
|
echo -e "${GREEN}"
|
2023-12-21 15:57:44 -05:00
|
|
|
figlet "Update"
|
2023-11-17 07:48:02 -05:00
|
|
|
echo -e "${NONE}"
|
|
|
|
fi
|
|
|
|
if [ ! -d ~/dotfiles ]; then
|
2023-11-10 16:12:15 -05:00
|
|
|
echo "The script will now remove existing directories and files from ~/.config/"
|
|
|
|
echo "and copy your prepared configuration from ~/dotfiles-versions/$version to ~/dotfiles"
|
2023-11-17 07:48:02 -05:00
|
|
|
echo ""
|
2023-11-10 16:12:15 -05:00
|
|
|
echo "Symbolic links will then be created from ~/dotfiles into your ~/.config/ directory."
|
|
|
|
echo ""
|
2023-11-17 07:48:02 -05:00
|
|
|
fi
|
|
|
|
if [[ ! $(tty) == *"pts"* ]] && [ -d ~/dotfiles ]; then
|
|
|
|
echo "You're running the script in tty. You can delete the existing ~/dotfiles folder now for a clean installation."
|
|
|
|
echo "If not, the script will overwrite existing files but will not remove additional files or folders of your custom configuration."
|
|
|
|
echo ""
|
|
|
|
else
|
|
|
|
if [ -d ~/dotfiles ]; then
|
|
|
|
echo "The script will overwrite existing files but will not remove additional files or folders of your custom configuration."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ ! -d ~/dotfiles ]; then
|
|
|
|
echo "PLEASE BACKUP YOUR EXISTING CONFIGURATIONS in .config IF NEEDED!"
|
|
|
|
echo ""
|
|
|
|
fi
|
2023-11-10 16:12:15 -05:00
|
|
|
|
2023-11-21 15:19:51 -05:00
|
|
|
if gum confirm "Do you want to install the prepared dotfiles now?" ;then
|
|
|
|
if [ ! $mode == "dev" ]; then
|
|
|
|
echo "Copy started"
|
|
|
|
if [ ! -d ~/dotfiles ]; then
|
|
|
|
mkdir ~/dotfiles
|
|
|
|
echo "~/dotfiles folder created."
|
|
|
|
fi
|
2023-12-20 11:06:18 -05:00
|
|
|
rsync -avhp -I ~/dotfiles-versions/$version/ ~/dotfiles/
|
2023-11-25 10:53:12 -05:00
|
|
|
if [[ $(_isFolderEmpty ~/dotfiles/) == 0 ]] ;then
|
|
|
|
echo "AN ERROR HAS OCCURED. Copy prepared dofiles from ~/dotfiles-versions/$version/ to ~/dotfiles/ failed"
|
|
|
|
echo "Please check that rsync is installad on your system."
|
|
|
|
echo "Execution of rsync -a -I ~/dotfiles-versions/$version/ ~/dotfiles/ is required."
|
|
|
|
exit
|
|
|
|
fi
|
2023-11-21 15:19:51 -05:00
|
|
|
echo "All files from ~/dotfiles-versions/$version/ to ~/dotfiles/ copied."
|
|
|
|
else
|
|
|
|
echo "Skipped: DEV MODE!"
|
|
|
|
fi
|
|
|
|
elif [ $? -eq 130 ]; then
|
|
|
|
exit 130
|
|
|
|
else
|
|
|
|
exit
|
|
|
|
fi
|
2023-11-10 16:12:15 -05:00
|
|
|
echo ""
|