@@ -18,6 +18,7 @@ UPDATE=0
1818MASTER=1
1919MIN_RPI_KERN=1336
2020SELFUPDATE_SCRIPT=" /tmp/.updateScript.sh"
21+
2122# scrape the command line
2223if [ " $1 " = " --interactive" ]; then
2324 shift 1
@@ -43,13 +44,24 @@ CURR_KERN=`uname -v | awk '{print $1}' | sed -e s'/#//'`
4344echo " Found Kernel " " $CURR_KERN "
4445if version_gt $MIN_RPI_KERN $CURR_KERN ; then
4546 echo -e " \033[31;5mWARNING: Kernel " " $MIN_RPI_KERN " " or higher required with Raspbian.\033[0m"
46- echo -e " \033[31;5mPLEASE RUN 'apt update' then 'apt install raspberrypi-kernel' then reboot.\033[0m"
47+ echo -e " \033[31;5mPLEASE RUN 'sudo apt update' then 'sudo apt install raspberrypi-kernel' then reboot.\033[0m"
4748 echo -e " \033[31;5mTHEN recheck the kernel version with iiab-upgrade --kernel-check \033[0m"
48- echo -e " \033[31;5mTHEN IF NEC run 'rpi-update' to install a more recent kernel \033[0m "
49- echo -e " \033[31;5mPlease check with developers before running the above command "
49+ echo -e " \033[31;5mPlease check with developers before running the below command "
50+ echo -e " \033[31;5mTHEN IF NEC run 'sudo rpi-update' to install a more recent kernel \033[0m "
5051fi
5152}
5253
54+ if [ " $1 " = " --kernel-check" ]; then
55+ check_kernel
56+ exit 0
57+ fi
58+
59+ # Everything else needs to be run as root
60+ if [ $( id -u) -ne 0 ]; then
61+ echo -e " $SCRIPT must be run as root. Try 'sudo $SCRIPT '\n"
62+ exit 1
63+ fi
64+
5365# Subroutines for upgrade logic
5466check_branch (){
5567 git -C $BASEDIR /iiab branch | grep \* | grep release-7 | wc -l
@@ -104,7 +116,6 @@ function update_master(){
104116 fi
105117}
106118
107-
108119function check_revision(){
109120 if [ -f $IIABENV ]; then
110121 source $IIABENV
@@ -157,11 +168,6 @@ check_user_pwd() {
157168}
158169
159170# start exec here
160- if [ " $1 " = " --kernel-check" ]; then
161- check_kernel
162- exit 0
163- fi
164-
165171update_self
166172
167173if [ ` check_branch` -gt 0 ]; then
343349
344350echo -e " \n┌──────────────────────────────────────────────────────────────────────────────┐"
345351echo -e " │ │"
346- echo -e " │ NOW INSTALL IIAB SOFTWARE! If glitches arise (connectivity or otherwise) │"
347- echo -e " │ │"
348- echo -e " │ PLEASE TRY TO CONTINUE BY RE-RUNNING PARENT SCRIPT 'sudo iiab' -- or run │"
352+ echo -e " │ NOW UPGRADE IIAB SOFTWARE! If glitches arise (connectivity or otherwise) │"
349353echo -e " │ │"
350- echo -e " │ child script ./iiab-install -- both avoid repeating any of the 9 stages. │"
354+ echo -e " │ PLEASE TRY TO CONTINUE BY RE-RUNNING SCRIPT 'sudo iiab-upgrade' │"
351355echo -e " │ │"
352356echo -e " └──────────────────────────────────────────────────────────────────────────────┘"
353357cd $BASEDIR /iiab/
0 commit comments