瀏覽代碼

Check for updates on the control panel

Bob Mottram 9 年之前
父節點
當前提交
f40cb8f8b3
共有 1 個文件被更改,包括 22 次插入7 次删除
  1. 22
    7
      src/freedombone-controlpanel

+ 22
- 7
src/freedombone-controlpanel 查看文件

32
 SELECTED_USERNAME=
32
 SELECTED_USERNAME=
33
 SIP_CONFIG_FILE=/etc/sipwitch.conf
33
 SIP_CONFIG_FILE=/etc/sipwitch.conf
34
 ADMIN_USER=
34
 ADMIN_USER=
35
+UPGRADE_SCRIPT_NAME="freedombone-upgrade"
35
 
36
 
36
 function any_key {
37
 function any_key {
37
     echo ' '
38
     echo ' '
38
     read -n1 -r -p "Press any key to continue..." key
39
     read -n1 -r -p "Press any key to continue..." key
39
 }
40
 }
40
 
41
 
42
+function check_for_updates {
43
+    if [ ! -f /etc/cron.weekly/$UPGRADE_SCRIPT_NAME ]; then
44
+        dialog --title "Check for updates" \
45
+               --msgbox "Upgrade script was not found" 6 40
46
+        return
47
+    fi
48
+
49
+    clear
50
+    ./etc/cron.weekly/$UPGRADE_SCRIPT_NAME
51
+    any_key
52
+}
53
+
41
 function add_user {
54
 function add_user {
42
     data=$(tempfile 2>/dev/null)
55
     data=$(tempfile 2>/dev/null)
43
     trap "rm -f $data" 0 1 2 5 15
56
     trap "rm -f $data" 0 1 2 5 15
789
         trap "rm -f $data" 0 1 2 5 15
802
         trap "rm -f $data" 0 1 2 5 15
790
         dialog --backtitle "Freedombone Control Panel" \
803
         dialog --backtitle "Freedombone Control Panel" \
791
                --title "Control Panel" \
804
                --title "Control Panel" \
792
-               --radiolist "Choose an operation:" 18 70 11 \
805
+               --radiolist "Choose an operation:" 19 70 12 \
793
                1 "Backup and Restore" off \
806
                1 "Backup and Restore" off \
794
                2 "Show SIP Phone Extensions" off \
807
                2 "Show SIP Phone Extensions" off \
795
                3 "Reset Tripwire" off \
808
                3 "Reset Tripwire" off \
798
                6 "Email Filtering Rules" off \
811
                6 "Email Filtering Rules" off \
799
                7 "Security Settings" off \
812
                7 "Security Settings" off \
800
                8 "Hubzilla" off \
813
                8 "Hubzilla" off \
801
-               9 "Power off the system" off \
802
-               10 "Restart the system" off \
803
-               11 "Exit" on 2> $data
814
+               9 "Check for updates" off \
815
+               10 "Power off the system" off \
816
+               11 "Restart the system" off \
817
+               12 "Exit" on 2> $data
804
         sel=$?
818
         sel=$?
805
         case $sel in
819
         case $sel in
806
             1) exit 1;;
820
             1) exit 1;;
815
             6) menu_email;;
829
             6) menu_email;;
816
             7) security_settings;;
830
             7) security_settings;;
817
             8) menu_hubzilla;;
831
             8) menu_hubzilla;;
818
-            9) shut_down_system;;
819
-            10) restart_system;;
820
-            11) break;;
832
+            9) check_for_updates;;
833
+            10) shut_down_system;;
834
+            11) restart_system;;
835
+            12) break;;
821
         esac
836
         esac
822
     done
837
     done
823
 }
838
 }