2024-02-29 15:46:01 -05:00
|
|
|
#!/bin/bash
|
2024-03-01 04:47:14 -05:00
|
|
|
# _ _ _ _
|
|
|
|
# | | | |_ __ __| | __ _| |_ ___
|
|
|
|
# | | | | '_ \ / _` |/ _` | __/ _ \
|
|
|
|
# | |_| | |_) | (_| | (_| | || __/
|
|
|
|
# \___/| .__/ \__,_|\__,_|\__\___|
|
|
|
|
# |_|
|
|
|
|
#
|
2024-02-29 15:46:01 -05:00
|
|
|
clear
|
|
|
|
sleep 1
|
|
|
|
figlet "Update"
|
2024-03-01 12:32:57 -05:00
|
|
|
if [ ! -d $HOME/Downloads ] ;then
|
|
|
|
echo "ERROR:: $HOME/Downloads folder not found."
|
|
|
|
exit
|
|
|
|
fi
|
2024-05-27 11:46:33 -04:00
|
|
|
echo
|
2024-02-29 15:46:01 -05:00
|
|
|
if gum confirm "Do you want to start the update now?" ;then
|
|
|
|
|
2024-03-01 07:36:35 -05:00
|
|
|
# Remove existing download folder and zip files
|
|
|
|
if [ -f $HOME/Downloads/dotfiles-main.zip ] ;then
|
|
|
|
rm $HOME/Downloads/dotfiles-main.zip
|
|
|
|
fi
|
|
|
|
if [ -f $HOME/Downloads/dotfiles-dev.zip ] ;then
|
|
|
|
rm $HOME/Downloads/dotfiles-dev.zip
|
|
|
|
fi
|
|
|
|
if [ -f $HOME/Downloads/dotfiles.zip ] ;then
|
|
|
|
rm $HOME/Downloads/dotfiles.zip
|
|
|
|
fi
|
2024-02-29 15:46:01 -05:00
|
|
|
if [ -d $HOME/Downloads/dotfiles ] ;then
|
|
|
|
rm -rf $HOME/Downloads/dotfiles
|
|
|
|
fi
|
|
|
|
if [ -d $HOME/Downloads/dotfiles-main ] ;then
|
|
|
|
rm -rf $HOME/Downloads/dotfiles-main
|
|
|
|
fi
|
|
|
|
if [ -d $HOME/Downloads/dotfiles-dev ] ;then
|
|
|
|
rm -rf $HOME/Downloads/dotfiles-dev
|
|
|
|
fi
|
2024-03-01 12:32:57 -05:00
|
|
|
echo
|
|
|
|
echo "Please choose between the main-release or the rolling-release (development version):"
|
2024-02-29 15:46:01 -05:00
|
|
|
version=$(gum choose "main-release" "rolling-release")
|
|
|
|
if [ "$version" == "main-release" ] ;then
|
|
|
|
wget -P ~/Downloads/ https://gitlab.com/stephan-raabe/dotfiles/-/archive/main/dotfiles-main.zip
|
|
|
|
v="main"
|
|
|
|
elif [ "$version" == "rolling-release" ] ;then
|
|
|
|
wget -P ~/Downloads/ https://gitlab.com/stephan-raabe/dotfiles/-/archive/dev/dotfiles-dev.zip
|
|
|
|
v="dev"
|
|
|
|
else
|
|
|
|
exit 130
|
|
|
|
fi
|
|
|
|
echo ":: Download complete."
|
|
|
|
|
|
|
|
# Unzip
|
2024-03-01 12:32:57 -05:00
|
|
|
unzip -o -q ~/Downloads/dotfiles-$v.zip -d ~/Downloads/
|
2024-02-29 15:46:01 -05:00
|
|
|
echo ":: Unzip complete."
|
|
|
|
cd ~/Downloads/dotfiles-$v/
|
2024-03-01 12:32:57 -05:00
|
|
|
echo ":: Changed into ~/Downloads/dotfiles-$v/"
|
|
|
|
|
2024-02-29 15:46:01 -05:00
|
|
|
# Start the installatiom
|
|
|
|
if gum confirm "Do you want to start the update now?" ;then
|
2024-05-27 11:46:33 -04:00
|
|
|
gum spin --spinner dot --title "Starting the update now..." -- sleep 3
|
2024-02-29 15:46:01 -05:00
|
|
|
cd $HOME/Downloads/dotfiles-$v
|
|
|
|
./install.sh
|
|
|
|
elif [ $? -eq 130 ]; then
|
|
|
|
exit 130
|
|
|
|
else
|
|
|
|
echo "Installation canceled."
|
|
|
|
exit;
|
|
|
|
fi
|
|
|
|
elif [ $? -eq 130 ]; then
|
|
|
|
exit 130
|
|
|
|
fi
|