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-11-10 16:12:15 -05:00
|
|
|
cat <<"EOF"
|
|
|
|
___ _ _ _ _ _ __ _ _
|
|
|
|
|_ _|_ __ ___| |_ __ _| | | __| | ___ | |_ / _(_) | ___ ___
|
|
|
|
| || '_ \/ __| __/ _` | | | / _` |/ _ \| __| |_| | |/ _ \/ __|
|
|
|
|
| || | | \__ \ || (_| | | | | (_| | (_) | |_| _| | | __/\__ \
|
|
|
|
|___|_| |_|___/\__\__,_|_|_| \__,_|\___/ \__|_| |_|_|\___||___/
|
|
|
|
|
2023-11-17 07:48:02 -05:00
|
|
|
EOF
|
|
|
|
echo -e "${NONE}"
|
|
|
|
else
|
|
|
|
echo -e "${GREEN}"
|
|
|
|
cat <<"EOF"
|
|
|
|
_ _ _ _ _ _ __ _ _
|
|
|
|
| | | |_ __ __| | __ _| |_ ___ __| | ___ | |_ / _(_) | ___ ___
|
|
|
|
| | | | '_ \ / _` |/ _` | __/ _ \ / _` |/ _ \| __| |_| | |/ _ \/ __|
|
|
|
|
| |_| | |_) | (_| | (_| | || __/ | (_| | (_) | |_| _| | | __/\__ \
|
|
|
|
\___/| .__/ \__,_|\__,_|\__\___| \__,_|\___/ \__|_| |_|_|\___||___/
|
|
|
|
|_|
|
2023-11-10 16:12:15 -05:00
|
|
|
|
|
|
|
EOF
|
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-11-24 07:19:48 -05:00
|
|
|
rsync -a -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 ""
|