浏览代码

attempt numbero 2

Kablersalat 9 月之前
父节点
当前提交
6c855ada4d
共有 1 个文件被更改,包括 8 次插入10 次删除
  1. 8 10
      kiosk.sh

+ 8 - 10
kiosk.sh

@@ -191,6 +191,7 @@ if [[ $1 == "--auto" ]]; then
 else
 else
 dialog --title "WARNING !!!" --msgbox "Do not run this script under any user other than "kiosk" and make sure the Kiosk user has sudo rights for the duration of the installation. In addition check out the -h command on this script if you wish to do the installation more automated!" 10 50
 dialog --title "WARNING !!!" --msgbox "Do not run this script under any user other than "kiosk" and make sure the Kiosk user has sudo rights for the duration of the installation. In addition check out the -h command on this script if you wish to do the installation more automated!" 10 50
   # Main menu for guided installation
   # Main menu for guided installation
+  current_step=1
   while true; do
   while true; do
     CHOICE=$(dialog --title "Rafisa Kiosk Configuration Menu" --menu "Choose an option:" 20 60 10 \
     CHOICE=$(dialog --title "Rafisa Kiosk Configuration Menu" --menu "Choose an option:" 20 60 10 \
       1 "Install Required Packages" \
       1 "Install Required Packages" \
@@ -211,21 +212,18 @@ dialog --title "WARNING !!!" --msgbox "Do not run this script under any user oth
       *) echo "Invalid option. Try another one." >&2
       *) echo "Invalid option. Try another one." >&2
     esac
     esac
 
 
-    # Automatically proceed because end users dont understand otherwise
+    # Automatically proceed to the next step if the previous step was successful
     if [ $? -eq 0 ]; then
     if [ $? -eq 0 ]; then
-      case $CHOICE in
-        1) CHOICE=2 ;;
-        2) CHOICE=3 ;;
-        3) CHICE=4 ;;
-        4) CHOICE=5 ;;
-        5) CHOICE=6 ;;
-      esac
+      current_step=$((current_step + 1))
+      if [ $current_step -gt 5 ]; then
+        current_step=6
+      fi
     else
     else
       dialog --title "Error" --msgbox "An error occurred. Please check the output and try again." 10 50
       dialog --title "Error" --msgbox "An error occurred. Please check the output and try again." 10 50
     fi
     fi
 
 
-    # safety ooooooo 
-    if [ $CHOICE -eq 6 ]; then
+    # Exit the loop if the last step is completed
+    if [ $current_step -eq 6 ]; then
       break
       break
     fi
     fi
   done
   done