Refactor: allow pre-setting variables before execution in install script (#1578)

* refactor: improve readability and structure of installation prompts in KlipperScreen-install.sh

* refactor: streamline user prompt and normalize input for NetworkManager installation
This commit is contained in:
Jack_up 2025-05-25 14:50:07 +02:00 committed by GitHub
parent 8aa2fcc019
commit e1aeaa6f23
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -41,6 +41,7 @@ install_graphical_backend()
echo_text ""
echo "Press enter for default (Xserver)"
read -r -e -p "Backend Xserver or Wayland (cage)? [X/w]" BACKEND
fi
if [[ "$BACKEND" =~ ^[wW]$ ]]; then
echo_text "Installing Wayland Cage Kiosk"
if sudo apt install -y $CAGE; then
@ -63,7 +64,6 @@ install_graphical_backend()
exit 1
fi
fi
fi
done
}
@ -293,6 +293,8 @@ install_network_manager()
if [ -z "$NETWORK" ]; then
echo "Press enter for default (Yes)"
read -r -e -p "Install NetworkManager for the network panel [Y/n]" NETWORK
fi
if [[ $NETWORK =~ ^[nN]$ ]]; then
echo_error "Not installing NetworkManager for the network panel"
else
@ -313,7 +315,6 @@ EOF
sync
systemctl reboot
fi
fi
}
# Script start
@ -331,18 +332,20 @@ if [ -z "$SERVICE" ]; then
echo_text ""
echo "Press enter for default (Yes)"
read -r -e -p "[Y/n]" SERVICE
if [[ $SERVICE =~ ^[nN]$ ]]; then
fi
if [[ $SERVICE =~ ^[nN]$ ]]; then
echo_text "Not installing the service"
echo_text "The graphical backend will NOT be installed"
else
else
install_graphical_backend
install_systemd_service
if [ -z "$START" ]; then
START=1
fi
fi
fi
install_packages
create_virtualenv
create_policy