소스 검색

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,12 +32,25 @@ COMPLETION_FILE=$HOME/freedombone-completed.txt
32 32
 SELECTED_USERNAME=
33 33
 SIP_CONFIG_FILE=/etc/sipwitch.conf
34 34
 ADMIN_USER=
35
+UPGRADE_SCRIPT_NAME="freedombone-upgrade"
35 36
 
36 37
 function any_key {
37 38
     echo ' '
38 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 54
 function add_user {
42 55
     data=$(tempfile 2>/dev/null)
43 56
     trap "rm -f $data" 0 1 2 5 15
@@ -789,7 +802,7 @@ function menu_top_level {
789 802
         trap "rm -f $data" 0 1 2 5 15
790 803
         dialog --backtitle "Freedombone Control Panel" \
791 804
                --title "Control Panel" \
792
-               --radiolist "Choose an operation:" 18 70 11 \
805
+               --radiolist "Choose an operation:" 19 70 12 \
793 806
                1 "Backup and Restore" off \
794 807
                2 "Show SIP Phone Extensions" off \
795 808
                3 "Reset Tripwire" off \
@@ -798,9 +811,10 @@ function menu_top_level {
798 811
                6 "Email Filtering Rules" off \
799 812
                7 "Security Settings" off \
800 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 818
         sel=$?
805 819
         case $sel in
806 820
             1) exit 1;;
@@ -815,9 +829,10 @@ function menu_top_level {
815 829
             6) menu_email;;
816 830
             7) security_settings;;
817 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 836
         esac
822 837
     done
823 838
 }