hyprland-dotfiles/.install/copy.sh

58 lines
2.1 KiB
Bash
Raw Normal View History

2023-11-10 21:12:15 +00:00
# ------------------------------------------------------
# Copy dotfiles
# ------------------------------------------------------
2023-11-17 12:48:02 +00:00
if [ ! -d ~/dotfiles ]; then
echo -e "${GREEN}"
2023-12-21 20:57:44 +00:00
figlet "Installation"
2023-11-17 12:48:02 +00:00
echo -e "${NONE}"
else
echo -e "${GREEN}"
2023-12-21 20:57:44 +00:00
figlet "Update"
2023-11-17 12:48:02 +00:00
echo -e "${NONE}"
fi
if [ ! -d ~/dotfiles ]; then
2023-11-10 21:12:15 +00: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 12:48:02 +00:00
echo ""
2023-11-10 21:12:15 +00:00
echo "Symbolic links will then be created from ~/dotfiles into your ~/.config/ directory."
echo ""
2023-11-17 12:48:02 +00: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 21:12:15 +00:00
2023-11-21 20:19:51 +00: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 16:06:18 +00:00
rsync -avhp -I ~/dotfiles-versions/$version/ ~/dotfiles/
2023-11-25 15:53:12 +00: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 20:19:51 +00: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 21:12:15 +00:00
echo ""