Skip to content

Commit 3608a8c

Browse files
committed
check for root - user feedback
1 parent 2d0ebe4 commit 3608a8c

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

7.2-install.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ case $OS_VER in
7070
;;
7171
esac
7272

73+
# Everything else needs to be run as root
74+
if [ $(id -u) -ne 0 ]; then
75+
echo -e "$SCRIPT must be run as root. Try 'sudo $SCRIPT'\n"
76+
exit 1
77+
fi
78+
79+
7380
echo -e "\n\nDOWNLOAD (CLONE) IIAB'S 3 KEY REPOS INTO $BASE ...\n"
7481
/usr/bin/apt -y install git nano whiptail
7582
mkdir -p $BASE

iiab-upgrade

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ UPDATE=0
1818
MASTER=1
1919
MIN_RPI_KERN=1336
2020
SELFUPDATE_SCRIPT="/tmp/.updateScript.sh"
21+
2122
# scrape the command line
2223
if [ "$1" = "--interactive" ]; then
2324
shift 1
@@ -43,13 +44,24 @@ CURR_KERN=`uname -v | awk '{print $1}' | sed -e s'/#//'`
4344
echo "Found Kernel ""$CURR_KERN"
4445
if 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"
5051
fi
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
5466
check_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-
108119
function 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-
165171
update_self
166172

167173
if [ `check_branch` -gt 0 ]; then
@@ -343,11 +349,9 @@ fi
343349

344350
echo -e "\n┌──────────────────────────────────────────────────────────────────────────────┐"
345351
echo -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) │"
349353
echo -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' "
351355
echo -e "│ │"
352356
echo -e "└──────────────────────────────────────────────────────────────────────────────┘"
353357
cd $BASEDIR/iiab/

0 commit comments

Comments
 (0)