From 162bf3a0888f5b89489a78366c2e8040a7d10dbd Mon Sep 17 00:00:00 2001 From: Stephan Raabe Date: Mon, 20 Nov 2023 22:24:53 +0100 Subject: [PATCH] Add gum confirm --- .install/backup.sh | 4 +--- .install/wallpaper.sh | 53 +++++++++++++++++++------------------------ 2 files changed, 24 insertions(+), 33 deletions(-) diff --git a/.install/backup.sh b/.install/backup.sh index 945a372..5816ee1 100755 --- a/.install/backup.sh +++ b/.install/backup.sh @@ -18,14 +18,12 @@ echo -e "${NONE}" if [ -d ~/dotfiles ]; then echo "The script has detected an existing dotfiles folder and will try to create a backup into the folder:" echo "~/dotfiles-versions/backups/$datets" - echo "" fi if [ ! -L ~/.bashrc ] && [ -f ~/.bashrc ]; then echo "The script has detected an existing .bashrc file and will try to create a backup to:" echo "~/dotfiles-versions/backups/$datets/.bashrc-old" - echo "" fi - if gum confirm "Do you want to proceed?" ;then + if gum confirm "Do you want to create a backup?" ;then if [ ! -d ~/dotfiles-versions ]; then mkdir ~/dotfiles-versions echo "~/dotfiles-versions created." diff --git a/.install/wallpaper.sh b/.install/wallpaper.sh index 3d4e10a..99ec2e6 100644 --- a/.install/wallpaper.sh +++ b/.install/wallpaper.sh @@ -13,33 +13,26 @@ __ __ _ _ EOF echo -e "${NONE}" if [ ! -d ~/wallpaper ]; then -echo "Do you want to download the wallpapers from repository https://gitlab.com/stephan-raabe/wallpaper/ ?" -echo "If not, the script will install 3 default wallpapers in ~/wallpaper/" -echo "" -while true; do - read -p "Do you want to download the repository? (Yy/Nn): " yn - case $yn in - [Yy]* ) - wget -P ~/Downloads/ https://gitlab.com/stephan-raabe/wallpaper/-/archive/main/wallpaper-main.zip - unzip -o ~/Downloads/wallpaper-main.zip -d ~/Downloads/ - if [ ! -d ~/wallpaper/ ]; then - mkdir ~/wallpaper - fi - cp ~/Downloads/wallpaper-main/* ~/wallpaper/ - echo "Wallpapers frpm the repository installed successfully." - break;; - [Nn]* ) - if [ -d ~/wallpaper/ ]; then - echo "wallpaper folder already exists." - else - mkdir ~/wallpaper - fi - cp wallpapers/* ~/wallpaper - echo "Default wallpapers installed successfully." - break;; - * ) echo "Please answer yes or no.";; - esac -done + echo "Do you want to download the wallpapers from repository https://gitlab.com/stephan-raabe/wallpaper/ ?" + echo "If not, the script will install 3 default wallpapers in ~/wallpaper/" + echo "" + if gum confirm "Do you want to download the repository?" ;then + wget -P ~/Downloads/ https://gitlab.com/stephan-raabe/wallpaper/-/archive/main/wallpaper-main.zip + unzip -o ~/Downloads/wallpaper-main.zip -d ~/Downloads/ + if [ ! -d ~/wallpaper/ ]; then + mkdir ~/wallpaper + fi + cp ~/Downloads/wallpaper-main/* ~/wallpaper/ + echo "Wallpapers frpm the repository installed successfully." + else + if [ -d ~/wallpaper/ ]; then + echo "wallpaper folder already exists." + else + mkdir ~/wallpaper + fi + cp wallpapers/* ~/wallpaper + echo "Default wallpapers installed successfully." + fi else echo "~/wallpaper folder already exsits." fi @@ -49,7 +42,7 @@ echo "" # Copy default wallpaper to .cache # ------------------------------------------------------ if [ ! -f ~/.cache/current_wallpaper.jpg ]; then -cp wallpapers/default.jpg ~/.cache/current_wallpaper.jpg -echo "Default wallpaper installed." -echo "" + cp wallpapers/default.jpg ~/.cache/current_wallpaper.jpg + echo "Default wallpaper installed." + echo "" fi