Skip to content

Commit

Permalink
check for root - user feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jvonau committed Sep 19, 2020
1 parent 2d0ebe4 commit 3608a8c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
7 changes: 7 additions & 0 deletions 7.2-install.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ case $OS_VER in
;;
esac

# Everything else needs to be run as root
if [ $(id -u) -ne 0 ]; then
echo -e "$SCRIPT must be run as root. Try 'sudo $SCRIPT'\n"
exit 1
fi


echo -e "\n\nDOWNLOAD (CLONE) IIAB'S 3 KEY REPOS INTO $BASE ...\n"
/usr/bin/apt -y install git nano whiptail
mkdir -p $BASE
Expand Down
30 changes: 17 additions & 13 deletions iiab-upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ UPDATE=0
MASTER=1
MIN_RPI_KERN=1336
SELFUPDATE_SCRIPT="/tmp/.updateScript.sh"

# scrape the command line
if [ "$1" = "--interactive" ]; then
shift 1
Expand All @@ -43,13 +44,24 @@ CURR_KERN=`uname -v | awk '{print $1}' | sed -e s'/#//'`
echo "Found Kernel ""$CURR_KERN"
if version_gt $MIN_RPI_KERN $CURR_KERN; then
echo -e "\033[31;5mWARNING: Kernel ""$MIN_RPI_KERN"" or higher required with Raspbian.\033[0m"
echo -e "\033[31;5mPLEASE RUN 'apt update' then 'apt install raspberrypi-kernel' then reboot.\033[0m"
echo -e "\033[31;5mPLEASE RUN 'sudo apt update' then 'sudo apt install raspberrypi-kernel' then reboot.\033[0m"
echo -e "\033[31;5mTHEN recheck the kernel version with iiab-upgrade --kernel-check \033[0m"
echo -e "\033[31;5mTHEN IF NEC run 'rpi-update' to install a more recent kernel \033[0m"
echo -e "\033[31;5mPlease check with developers before running the above command"
echo -e "\033[31;5mPlease check with developers before running the below command"
echo -e "\033[31;5mTHEN IF NEC run 'sudo rpi-update' to install a more recent kernel \033[0m"
fi
}

if [ "$1" = "--kernel-check" ]; then
check_kernel
exit 0
fi

# Everything else needs to be run as root
if [ $(id -u) -ne 0 ]; then
echo -e "$SCRIPT must be run as root. Try 'sudo $SCRIPT'\n"
exit 1
fi

# Subroutines for upgrade logic
check_branch(){
git -C $BASEDIR/iiab branch | grep \* | grep release-7 | wc -l
Expand Down Expand Up @@ -104,7 +116,6 @@ function update_master(){
fi
}


function check_revision(){
if [ -f $IIABENV ]; then
source $IIABENV
Expand Down Expand Up @@ -157,11 +168,6 @@ check_user_pwd() {
}

# start exec here
if [ "$1" = "--kernel-check" ]; then
check_kernel
exit 0
fi

update_self

if [ `check_branch` -gt 0 ]; then
Expand Down Expand Up @@ -343,11 +349,9 @@ fi

echo -e "\n┌──────────────────────────────────────────────────────────────────────────────┐"
echo -e "│ │"
echo -e "│ NOW INSTALL IIAB SOFTWARE! If glitches arise (connectivity or otherwise) │"
echo -e "│ │"
echo -e "│ PLEASE TRY TO CONTINUE BY RE-RUNNING PARENT SCRIPT 'sudo iiab' -- or run │"
echo -e "│ NOW UPGRADE IIAB SOFTWARE! If glitches arise (connectivity or otherwise) │"
echo -e "│ │"
echo -e "child script ./iiab-install -- both avoid repeating any of the 9 stages."
echo -e " PLEASE TRY TO CONTINUE BY RE-RUNNING SCRIPT 'sudo iiab-upgrade' "
echo -e "│ │"
echo -e "└──────────────────────────────────────────────────────────────────────────────┘"
cd $BASEDIR/iiab/
Expand Down

0 comments on commit 3608a8c

Please sign in to comment.