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
echo "Existing .bashrc file found in homefolder. .bashrc-old created"
fi
elif [ $? -eq 130 ]; then
exit 130
else
echo "Backup skipped."
fi

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

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

View File

@ -1,6 +1,12 @@
#!/bin/bash
#!/bin/sh
RED='\033[0;31m' #'0;31' is Red
GREEN='\033[0;32m' #'0;32' is Green
YELLOW='\033[1;32m' #'1;32' is Yellow
BLUE='\033[0;34m' #'0;34' is Blue
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
echo "Installation started."
elif [ $? -eq 130 ]; then
exit 130
else
echo "Installation canceled."
exit;

View File

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

View File

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

View File

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

View File

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

View File

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

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

@ -12,32 +12,10 @@ cat <<"EOF"
EOF
echo -e "${NONE}"
echo "Please select the Desktop Profile for your installation:"
echo "1 - Hyprland"
echo "2 - Qtile"
echo "3 - All"
echo "Nn - Cancel"
echo ""
while true; do
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 ""
echo "SPACE = select/unselect a profile. RETURN = confirm. No selection = CANCEL"
profile=$(gum choose --no-limit --cursor-prefix "( ) " --selected-prefix "(x) " --unselected-prefix "( ) " "Hyprland" "Qtile")
if [ -z $profile ] ;then
echo "No profile selected. Installation canceled."
exit
fi

View File

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

View File

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

View File

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

View File

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