From f40cb8f8b3afe676f65359c682cb3bd85e489c90 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 26 Nov 2015 10:53:54 +0000 Subject: [PATCH] Check for updates on the control panel --- src/freedombone-controlpanel | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/freedombone-controlpanel b/src/freedombone-controlpanel index 89ff7280..2cbc6139 100755 --- a/src/freedombone-controlpanel +++ b/src/freedombone-controlpanel @@ -32,12 +32,25 @@ COMPLETION_FILE=$HOME/freedombone-completed.txt SELECTED_USERNAME= SIP_CONFIG_FILE=/etc/sipwitch.conf ADMIN_USER= +UPGRADE_SCRIPT_NAME="freedombone-upgrade" function any_key { echo ' ' read -n1 -r -p "Press any key to continue..." key } +function check_for_updates { + if [ ! -f /etc/cron.weekly/$UPGRADE_SCRIPT_NAME ]; then + dialog --title "Check for updates" \ + --msgbox "Upgrade script was not found" 6 40 + return + fi + + clear + ./etc/cron.weekly/$UPGRADE_SCRIPT_NAME + any_key +} + function add_user { data=$(tempfile 2>/dev/null) trap "rm -f $data" 0 1 2 5 15 @@ -789,7 +802,7 @@ function menu_top_level { trap "rm -f $data" 0 1 2 5 15 dialog --backtitle "Freedombone Control Panel" \ --title "Control Panel" \ - --radiolist "Choose an operation:" 18 70 11 \ + --radiolist "Choose an operation:" 19 70 12 \ 1 "Backup and Restore" off \ 2 "Show SIP Phone Extensions" off \ 3 "Reset Tripwire" off \ @@ -798,9 +811,10 @@ function menu_top_level { 6 "Email Filtering Rules" off \ 7 "Security Settings" off \ 8 "Hubzilla" off \ - 9 "Power off the system" off \ - 10 "Restart the system" off \ - 11 "Exit" on 2> $data + 9 "Check for updates" off \ + 10 "Power off the system" off \ + 11 "Restart the system" off \ + 12 "Exit" on 2> $data sel=$? case $sel in 1) exit 1;; @@ -815,9 +829,10 @@ function menu_top_level { 6) menu_email;; 7) security_settings;; 8) menu_hubzilla;; - 9) shut_down_system;; - 10) restart_system;; - 11) break;; + 9) check_for_updates;; + 10) shut_down_system;; + 11) restart_system;; + 12) break;; esac done }