1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-14 20:22:08 +00:00

Merge pull request #2039 from holta/rpi-update-warning

iiab-install: rpi-update kernel warning + cleaner bash syntax: echo "$var"
This commit is contained in:
A Holt 2019-11-14 12:11:53 -05:00 committed by GitHub
commit ff764f4088
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -68,10 +68,11 @@ version_gt() { [ "$(printf '%s\n' "$@" | sort -V | head -1)" != "$1" ]; }
# Verify that Raspbian is running a recent enough kernel. As Raspbian
# updates on 4.9.41-v7+ broke bridging, WiFi AP & OpenVPN in Oct/Nov 2017.
CURR_KERN=`uname -r`
echo "Found Kernel "$CURR_KERN""
echo "Found Kernel ""$CURR_KERN"
if [ "$OS" == "raspbian" ] && version_gt $MIN_RPI_KERN $CURR_KERN ; then
echo -e "\nEXITING: Kernel "$MIN_RPI_KERN" or higher required with Raspbian."
echo -e "\nEXITING: Kernel ""$MIN_RPI_KERN"" or higher required with Raspbian."
echo -e "PLEASE RUN 'apt update' then 'apt install raspberrypi-kernel' then reboot."
echo -e "THEN IF NEC run 'rpi-update' to install a more recent kernel, then reboot."
echo -e "IIAB INSTALL INSTRUCTIONS: https://github.com/iiab/iiab/wiki/IIAB-Installation"
exit 1
fi
@ -89,10 +90,10 @@ if [[ `command -v ansible` ]]; then # "command -v" is POSIX compliant; it
#CURR_ANSIBLE_VER=`ansible --version | head -1 | sed -e 's/.* //'`
#CURR_ANSIBLE_VER=`ansible --version | head -1 | cut -f 2 -d " "`
CURR_ANSIBLE_VER=`ansible --version | head -1 | awk '{print $2}'` # to match scripts/ansible
echo "Found Ansible "$CURR_ANSIBLE_VER""
echo "Found Ansible ""$CURR_ANSIBLE_VER"
fi
if version_gt $MIN_ANSIBLE_VER $CURR_ANSIBLE_VER ; then
echo -e "\nEXITING: Ansible "$MIN_ANSIBLE_VER" or higher required.\n"
echo -e "\nEXITING: Ansible ""$MIN_ANSIBLE_VER"" or higher required.\n"
echo -e "REMOVE PRIOR VERSIONS using 'apt purge ansible' and/or 'pip uninstall ansible'."
echo -e "THEN RUN 'scripts/ansible' to install the latest Ansible from PPA or RPM."
@ -108,12 +109,12 @@ STAGE=0
if [ -f /etc/iiab/iiab.env ]; then
if grep -q STAGE= /etc/iiab/iiab.env ; then
source /etc/iiab/iiab.env
echo "Extracted STAGE="$STAGE" (counter) from /etc/iiab/iiab.env"
echo "Extracted STAGE=""$STAGE"" (counter) from /etc/iiab/iiab.env"
if ! [ "$STAGE" -eq "$STAGE" ] 2> /dev/null; then
echo -e "\nEXITING: STAGE (counter) value == "$STAGE" is non-integer in /etc/iiab/iiab.env"
echo -e "\nEXITING: STAGE (counter) value == ""$STAGE"" is non-integer in /etc/iiab/iiab.env"
exit 1
elif [ "$STAGE" -lt 0 ] || [ "$STAGE" -gt 9 ]; then
echo -e "\nEXITING: STAGE (counter) value == "$STAGE" is out-of-range in /etc/iiab/iiab.env"
echo -e "\nEXITING: STAGE (counter) value == ""$STAGE"" is out-of-range in /etc/iiab/iiab.env"
exit 1
fi
fi
@ -124,7 +125,7 @@ if [ -f /etc/iiab/iiab.env ]; then
echo "Removed /etc/iiab/iiab.env effectively resetting STAGE (counter)."
elif [ "$1" == "--reinstall" ]; then
STAGE=0
ARGS="$ARGS --extra-vars reinstall=True"
ARGS="$ARGS"" --extra-vars reinstall=True"
sed -i 's/^STAGE=.*/STAGE=0/' /etc/iiab/iiab.env
echo "Wrote STAGE=0 (counter) to /etc/iiab/iiab.env"
elif [ "$STAGE" -ge 2 ] && [ "$1" == "--debug" ]; then
@ -148,7 +149,7 @@ echo -e "\nTRY TO RERUN './iiab-install' IF IT FAILS DUE TO CONNECTIVITY ISSUES
echo -e "Running local playbooks....Stage 0 will now run....followed by Stages $(($STAGE + 1))-9"
export ANSIBLE_LOG_PATH="$CWD/iiab-install.log"
export ANSIBLE_LOG_PATH="$CWD""/iiab-install.log"
ansible -m setup -i $INVENTORY localhost --connection=local | grep python
ansible -m setup -i $INVENTORY localhost --connection=local >> /dev/null # So vars are recorded in /opt/iiab/iiab/iiab-install.log