add gum confirm and profile selector

This commit is contained in:
Stephan Raabe 2023-11-21 21:19:51 +01:00
parent fe9c69d24d
commit 30c453df3f
14 changed files with 114 additions and 160 deletions

View File

@ -44,6 +44,8 @@ echo -e "${NONE}"
cp ~/.bashrc ~/dotfiles-versions/backups/$datets/.bashrc-old cp ~/.bashrc ~/dotfiles-versions/backups/$datets/.bashrc-old
echo "Existing .bashrc file found in homefolder. .bashrc-old created" echo "Existing .bashrc file found in homefolder. .bashrc-old created"
fi fi
elif [ $? -eq 130 ]; then
exit 130
else else
echo "Backup skipped." echo "Backup skipped."
fi fi

44
.install/bashrc.sh Normal file → Executable file
View File

@ -8,32 +8,24 @@ cat <<"EOF"
| '_ \ / _` / __| '_ \| '__/ __| | '_ \ / _` / __| '_ \| '__/ __|
_| |_) | (_| \__ \ | | | | | (__ _| |_) | (_| \__ \ | | | | | (__
(_)_.__/ \__,_|___/_| |_|_| \___| (_)_.__/ \__,_|___/_| |_|_| \___|
EOF EOF
echo -e "${NONE}" echo -e "${NONE}"
while true; do if [ ! -L ~/.bashrc ] && [ -f ~/.bashrc ]; then
if [ ! -L ~/.bashrc ] && [ -f ~/.bashrc ]; then echo "PLEASE NOTE AGAIN: The script has detected an existing .bashrc file."
echo "PLEASE NOTE AGAIN: The script has detected an existing .bashrc file." fi
fi if [ -f ~/dotfiles-versions/backups/$datets/.bashrc-old ]; then
if [ -f ~/dotfiles-versions/backups/$datets/.bashrc-old ]; then echo "Backup is already available here ~/dotfiles-versions/backups/$datets/.bashrc-old"
echo "Backup is already available here ~/dotfiles-versions/backups/$datets/.bashrc-old" fi
fi if [ ! -L ~/.bashrc ] && [ -f ~/.bashrc ]; then
if [ ! -L ~/.bashrc ] && [ -f ~/.bashrc ]; then bash_confirm="Do you want to replace your existing .bashrc file with the dotfiles .bashrc file?"
echo "" else
echo "Do you want to replace your existing .bashrc file with the dotfiles .bashrc file?" bash_confirm="Do you want to install the dotfiles .bashrc file now?"
else fi
echo "" if gum confirm "$bash_confirm" ;then
echo "Do you want to install the dotfiles .bashrc file now?" _installSymLink .bashrc ~/.bashrc ~/dotfiles/.bashrc ~/.bashrc
fi elif [ $? -eq 130 ]; then
read -p "Please confirm (Yy/Nn): " yn exit 130
case $yn in else
[Yy]* ) echo "Installation of the .bashrc file skipped."
_installSymLink .bashrc ~/.bashrc ~/dotfiles/.bashrc ~/.bashrc fi
break;;
[Nn]* )
echo "Installation of the .bashrc file skipped."
break;;
* ) echo "Please answer yes or no.";;
esac
done
echo "" echo ""

View File

@ -1,6 +1,12 @@
#!/bin/bash #!/bin/sh
RED='\033[0;31m' #'0;31' is Red RED='\033[0;31m' #'0;31' is Red
GREEN='\033[0;32m' #'0;32' is Green GREEN='\033[0;32m' #'0;32' is Green
YELLOW='\033[1;32m' #'1;32' is Yellow YELLOW='\033[1;32m' #'1;32' is Yellow
BLUE='\033[0;34m' #'0;34' is Blue BLUE='\033[0;34m' #'0;34' is Blue
NONE='\033[0m' # NO COLOR NONE='\033[0m' # NO COLOR
export GUM_CONFIRM_SELECTED_BACKGROUND="#FFF"
export GUM_CONFIRM_SELECTED_FOREGROUND="#000"
export GUM_CONFIRM_UNSELECTED_BACKGROUND="#333"
export GUM_CONFIRM_UNSELECTED_FOREGROUND="#FFF"

View File

@ -17,6 +17,8 @@ fi
if gum confirm "DO YOU WANT TO START THE INSTALLATION NOW?" ;then if gum confirm "DO YOU WANT TO START THE INSTALLATION NOW?" ;then
echo "Installation started." echo "Installation started."
elif [ $? -eq 130 ]; then
exit 130
else else
echo "Installation canceled." echo "Installation canceled."
exit; exit;

View File

@ -46,26 +46,21 @@ if [ ! -d ~/dotfiles ]; then
echo "" echo ""
fi fi
while true; do if gum confirm "Do you want to install the prepared dotfiles now?" ;then
read -p "Do you want to install the prepared dotfiles now? (Yy/Nn): " yn if [ ! $mode == "dev" ]; then
case $yn in echo "Copy started"
[Yy]* ) if [ ! -d ~/dotfiles ]; then
if [ ! $mode == "dev" ]; then mkdir ~/dotfiles
echo "Copy started" echo "~/dotfiles folder created."
if [ ! -d ~/dotfiles ]; then fi
mkdir ~/dotfiles rsync -a ~/dotfiles-versions/$version/ ~/dotfiles/
echo "~/dotfiles folder created." echo "All files from ~/dotfiles-versions/$version/ to ~/dotfiles/ copied."
fi else
rsync -a ~/dotfiles-versions/$version/ ~/dotfiles/ echo "Skipped: DEV MODE!"
echo "All files from ~/dotfiles-versions/$version/ to ~/dotfiles/ copied." fi
else elif [ $? -eq 130 ]; then
echo "Skipped: DEV MODE!" exit 130
fi else
break;; exit
[Nn]* ) fi
exit
break;;
* ) echo "Please answer yes or no.";;
esac
done
echo "" echo ""

View File

@ -5,12 +5,12 @@ disman=0
if [ -f /etc/systemd/system/display-manager.service ]; then if [ -f /etc/systemd/system/display-manager.service ]; then
echo -e "${GREEN}" echo -e "${GREEN}"
cat <<"EOF" cat <<"EOF"
___ _ _ ____ _ _ __ __
|_ _|_ __ ___ _ __ ___ _ __| |_ __ _ _ __ | |_ | _ \(_)___ _ __ | | __ _ _ _ | \/ | __ _ _ __ __ _ __ _ ___ _ __
| || '_ ` _ \| '_ \ / _ \| '__| __/ _` | '_ \| __| | | | | / __| '_ \| |/ _` | | | | | |\/| |/ _` | '_ \ / _` |/ _` |/ _ \ '__|
| || | | | | | |_) | (_) | | | || (_| | | | | |_ | |_| | \__ \ |_) | | (_| | |_| | | | | | (_| | | | | (_| | (_| | __/ |
|___|_| |_| |_| .__/ \___/|_| \__\__,_|_| |_|\__| |____/|_|___/ .__/|_|\__,_|\__, | |_| |_|\__,_|_| |_|\__,_|\__, |\___|_|
|_| |_| |___/ |___/
EOF EOF
echo -e "${NONE}" echo -e "${NONE}"
@ -31,23 +31,19 @@ echo -e "${NONE}"
echo "But if you want to use the tty based (terminal) login instead, you can disable the display manager now." echo "But if you want to use the tty based (terminal) login instead, you can disable the display manager now."
fi fi
echo "" echo ""
while true; do
read -p "Do you want to deactive the current display manager (Yy/Nn): " yn if gum confirm "Do you want to deactive the current display manager?" ;then
case $yn in if [ -f /etc/systemd/system/display-manager.service ]; then
[Yy]* ) sudo rm /etc/systemd/system/display-manager.service
if [ -f /etc/systemd/system/display-manager.service ]; then echo "Current display manager removed."
sudo rm /etc/systemd/system/display-manager.service fi
echo "Current display manager removed." disman=1
fi elif [ $? -eq 130 ]; then
disman=1 exit 130
break;; else
[Nn]* ) echo "Disable display manager skipped."
echo "Disable display manager skipped." echo "You can run ~/dotfiles/hypr/script/disablewm.sh at a later point of time if needed."
echo "You can run ~/dotfiles/hypr/script/disablewm.sh at a later point of time if needed." fi
break;;
* ) echo "Please answer yes or no.";;
esac
done
echo "" echo ""
else else
disman=1 disman=1

View File

@ -1,6 +1,7 @@
.gitignore .gitignore
.git .git
.install .install
.dev
README.md README.md
CHANGELOG CHANGELOG
LICENSE LICENSE

View File

@ -1,17 +1,6 @@
# ------------------------------------------------------ # ------------------------------------------------------
# Install required packages # Install required packages
# ------------------------------------------------------ # ------------------------------------------------------
echo -e "${GREEN}"
cat <<"EOF"
___ _ _ _ _
|_ _|_ __ ___| |_ __ _| | | _ __ __ _ ___| | ____ _ __ _ ___ ___
| || '_ \/ __| __/ _` | | | | '_ \ / _` |/ __| |/ / _` |/ _` |/ _ \/ __|
| || | | \__ \ || (_| | | | | |_) | (_| | (__| < (_| | (_| | __/\__ \
|___|_| |_|___/\__\__,_|_|_| | .__/ \__,_|\___|_|\_\__,_|\__, |\___||___/
|_| |___/
EOF
echo -e "${NONE}"
_installPackagesPacman "${packagesPacman[@]}"; _installPackagesPacman "${packagesPacman[@]}";
_installPackagesYay "${packagesYay[@]}"; _installPackagesYay "${packagesYay[@]}";
echo "" echo ""

View File

@ -16,6 +16,8 @@ EOF
echo -e "${NONE}" echo -e "${NONE}"
if gum confirm "Do you want to install the custom tty login issue?" ;then if gum confirm "Do you want to install the custom tty login issue?" ;then
sudo cp login/issue /etc/issue sudo cp login/issue /etc/issue
elif [ $? -eq 130 ]; then
exit 130
else else
echo "Setup tty login skipped." echo "Setup tty login skipped."
fi fi

36
.install/profile.sh Normal file → Executable file
View File

@ -12,32 +12,10 @@ cat <<"EOF"
EOF EOF
echo -e "${NONE}" echo -e "${NONE}"
echo "Please select the Desktop Profile for your installation:"
echo "1 - Hyprland" echo "SPACE = select/unselect a profile. RETURN = confirm. No selection = CANCEL"
echo "2 - Qtile" profile=$(gum choose --no-limit --cursor-prefix "( ) " --selected-prefix "(x) " --unselected-prefix "( ) " "Hyprland" "Qtile")
echo "3 - All" if [ -z $profile ] ;then
echo "Nn - Cancel" echo "No profile selected. Installation canceled."
echo "" exit
while true; do fi
read -p "PLEASE SELECT: " yn
case $yn in
[1]* )
profile="Hyprland"
break;;
[2]* )
profile="Qtile"
break;;
[3]* )
profile="All"
break;;
[Nn]* )
echo "Installation canceled."
exit;
break;;
* ) echo "Please answer yes or no.";;
esac
done
echo ""
echo "Installing profile $profile ..."
sleep 2
echo ""

View File

@ -2,6 +2,7 @@
# Check for required packages to run the installation # Check for required packages to run the installation
# ------------------------------------------------------ # ------------------------------------------------------
echo "Checking that rsync and gum is installed..." echo "Checking that required packages for the installation are installed..."
_installPackagesPacman "rsync"; echo ""
_installPackagesPacman "gum"; _installPackagesPacman "rsync" "gum";
echo ""

View File

@ -22,7 +22,7 @@ echo -e "${NONE}"
if [ -f ~/dotfiles/.bashrc ]; then if [ -f ~/dotfiles/.bashrc ]; then
echo ".bashrc file: ~/dotfiles/.bashrc" echo ".bashrc file: ~/dotfiles/.bashrc"
fi fi
if [ $profile == "Hyprland" ] || [ $profile == "All" ]; then if [[ $profile == *"Hyprland"* ]]; then
if [ -f ~/dotfiles/hypr/conf/keyboard.conf ]; then if [ -f ~/dotfiles/hypr/conf/keyboard.conf ]; then
echo "Hyprland keyboard layout: ~/dotfiles/hypr/conf/keyboard.conf" echo "Hyprland keyboard layout: ~/dotfiles/hypr/conf/keyboard.conf"
fi fi
@ -33,38 +33,40 @@ echo -e "${NONE}"
echo "Hyprland keybindings: ~/dotfiles/hypr/conf/keybindings.conf" echo "Hyprland keybindings: ~/dotfiles/hypr/conf/keybindings.conf"
fi fi
fi fi
if [ $profile == "Qtile" ] || [ $profile == "All" ]; then if [[ $profile == *"Qtile"* ]]; then
if [ -f ~/dotfiles/qtile/conf/keyboard.py ]; then if [ -f ~/dotfiles/qtile/conf/keyboard.py ]; then
echo "Qtile keyboard layout: ~/dotfiles/qtile/conf/keyboard.py" echo "Qtile keyboard layout: ~/dotfiles/qtile/conf/keyboard.py"
fi fi
fi fi
echo "" echo ""
if gum confirm "Do you want to restore the files now and use it on your new installation?" ;then if gum confirm "Do you want to restore the files now and use it on your new installation?" ;then
if [ -f ~/dotfiles/.bashrc ]; then if [ -f ~/dotfiles/.bashrc ]; then
cp ~/dotfiles/.bashrc ~/dotfiles-versions/$version/ cp ~/dotfiles/.bashrc ~/dotfiles-versions/$version/
echo ".bashrc restored!" echo ".bashrc restored!"
fi
if [[ $profile == *"Hyprland"* ]]; then
if [ -f ~/dotfiles/hypr/conf/keyboard.conf ]; then
cp ~/dotfiles/hypr/conf/keyboard.conf ~/dotfiles-versions/$version/hypr/conf/
echo "Hyprland keyboard.conf restored!"
fi fi
if [ $profile == "Hyprland" ] || [ $profile == "All" ]; then if [ -f ~/dotfiles/hypr/conf/monitor.conf ]; then
if [ -f ~/dotfiles/hypr/conf/keyboard.conf ]; then cp ~/dotfiles/hypr/conf/monitor.conf ~/dotfiles-versions/$version/hypr/conf/
cp ~/dotfiles/hypr/conf/keyboard.conf ~/dotfiles-versions/$version/hypr/conf/ echo "Hyprland monitor.conf restored!"
echo "Hyprland keyboard.conf restored!"
fi
if [ -f ~/dotfiles/hypr/conf/monitor.conf ]; then
cp ~/dotfiles/hypr/conf/monitor.conf ~/dotfiles-versions/$version/hypr/conf/
echo "Hyprland monitor.conf restored!"
fi
if [ -f ~/dotfiles/hypr/conf/keybindings.conf ]; then
cp ~/dotfiles/hypr/conf/keybindings.conf ~/dotfiles-versions/$version/hypr/conf/
echo "Hyprland keybindings.conf restored!"
fi
fi fi
if [ $profile == "Qtile" ] || [ $profile == "All" ]; then if [ -f ~/dotfiles/hypr/conf/keybindings.conf ]; then
if [ -f ~/dotfiles/qtile/conf/keyboard.py ]; then cp ~/dotfiles/hypr/conf/keybindings.conf ~/dotfiles-versions/$version/hypr/conf/
cp ~/dotfiles/qtile/conf/keyboard.py ~/dotfiles-versions/$version/qtile/conf/ echo "Hyprland keybindings.conf restored!"
echo "Qtile keyboard.py restored!"
fi
fi fi
restored=1 fi
if [[ $profile == *"Qtile"* ]]; then
if [ -f ~/dotfiles/qtile/conf/keyboard.py ]; then
cp ~/dotfiles/qtile/conf/keyboard.py ~/dotfiles-versions/$version/qtile/conf/
echo "Qtile keyboard.py restored!"
fi
fi
restored=1
elif [ $? -eq 130 ]; then
exit 130
else else
echo "Restore skipped" echo "Restore skipped"
fi fi

View File

@ -24,6 +24,8 @@ if [ ! -d ~/wallpaper ]; then
fi fi
cp ~/Downloads/wallpaper-main/* ~/wallpaper/ cp ~/Downloads/wallpaper-main/* ~/wallpaper/
echo "Wallpapers frpm the repository installed successfully." echo "Wallpapers frpm the repository installed successfully."
elif [ $? -eq 130 ]; then
exit 130
else else
if [ -d ~/wallpaper/ ]; then if [ -d ~/wallpaper/ ]; then
echo "wallpaper folder already exists." echo "wallpaper folder already exists."

View File

@ -33,24 +33,14 @@ source .install/confirm-start.sh
source .install/backup.sh source .install/backup.sh
source .install/preparation.sh source .install/preparation.sh
source .install/profile.sh source .install/profile.sh
if [ $profile == "Hyprland" ]; then
source .install/hyprland.sh
fi
if [ $profile == "Qtile" ]; then
source .install/qtile.sh
fi
source .install/yay.sh source .install/yay.sh
if [ $profile == "Hyprland" ]; then if [[ $profile == *"Hyprland"* ]]; then
source .install/hyprland.sh
source .install/hyprland-packages.sh source .install/hyprland-packages.sh
source .install/install-packages.sh source .install/install-packages.sh
fi fi
if [ $profile == "Qtile" ]; then if [[ $profile == *"Qtile"* ]]; then
source .install/qtile-packages.sh source .install/qtile.sh
source .install/install-packages.sh
fi
if [ $profile == "All" ]; then
source .install/hyprland-packages.sh
source .install/install-packages.sh
source .install/qtile-packages.sh source .install/qtile-packages.sh
source .install/install-packages.sh source .install/install-packages.sh
fi fi
@ -63,14 +53,10 @@ source .install/keyboard.sh
source .install/copy.sh source .install/copy.sh
source .install/config-folder.sh source .install/config-folder.sh
source .install/init-pywal.sh source .install/init-pywal.sh
if [ $profile == "Hyprland" ]; then if [[ $profile == *"Hyprland"* ]]; then
source .install/hyprland-dotfiles.sh source .install/hyprland-dotfiles.sh
fi fi
if [ $profile == "Qtile" ]; then if [[ $profile == *"Qtile"* ]]; then
source .install/qtile-dotfiles.sh
fi
if [ $profile == "All" ]; then
source .install/hyprland-dotfiles.sh
source .install/qtile-dotfiles.sh source .install/qtile-dotfiles.sh
fi fi
source .install/bashrc.sh source .install/bashrc.sh