1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-12 11:12:06 +00:00

Toughened for recent legacy installs etc, that lack STAGE=<value> in iiab.env

This commit is contained in:
A Holt 2017-11-10 05:09:07 -05:00 committed by GitHub
parent e3bf302ccd
commit 66c51a7367
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,13 +1,14 @@
#!/bin/bash -e
# running from a git repo
# Running from a git repo
# Add cmdline options for passing to ansible
# todo add proper shift to gobble up --debug --reinstall
# Todo add proper shift to gobble up --debug --reinstall
if [ "$1" != "--debug" ] && [ "$1" != "--reinstall" ] && [ "$1" != "" ]; then
echo "Use 'iiab-install' for regular installs, or to continue an install."
echo "Use 'iiab-install --reinstall' to force running all Stages 0-9."
echo "Use 'iiab-install --debug' to run Stage 0, followed by Stages 3-9."
echo "Use './iiab-install' for regular installs, or to continue an install."
echo "Use './iiab-install --reinstall' to force running all Stages 0-9."
echo "Use './iiab-install --debug' to run Stage 0, followed by Stages 3-9."
echo "Use './runtags' to run a single Stage or Tag or Role."
echo "Use './iiab-network' to run Network sections."
exit 1
fi
@ -72,15 +73,18 @@ STAGE=0
if [ ! -f /etc/iiab/iiab.env ]; then
mkdir -p /etc/iiab
else
source /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"
exit 1
elif [ "$STAGE" -lt 1 ] || [ "$STAGE" -gt 9 ]; then
echo -e "\nEXITING: STAGE (counter) value == "$STAGE" is out-of-range in /etc/iiab/iiab.env"
exit 1
elif [[ `grep XSCE /etc/iiab/iiab.env` ]] || [ "$1" == "--reinstall" ]; then
if [[ `grep STAGE= /etc/iiab/iiab.env` ]]; then
source /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"
exit 1
elif [ "$STAGE" -lt 1 ] || [ "$STAGE" -gt 9 ]; then
echo -e "\nEXITING: STAGE (counter) value == "$STAGE" is out-of-range in /etc/iiab/iiab.env"
exit 1
fi
fi
if [[ `grep XSCE /etc/iiab/iiab.env` ]] || [ "$1" == "--reinstall" ]; then
STAGE=0
rm /etc/iiab/iiab.env
echo "Removed /etc/iiab/iiab.env effectively resetting STAGE (counter)."
@ -90,9 +94,10 @@ else
echo "Wrote STAGE=2 (counter) to /etc/iiab/iiab.env"
elif [ "$STAGE" -eq 9 ]; then
echo -e "\nEXITING: STAGE (counter) in /etc/iiab/iiab.env shows Stage 9 Is Already Done."
echo "Use 'iiab-install --reinstall' to force running all Stages 0-9."
echo "Use 'iiab-install --debug' to run Stage 0, followed by Stages 3-9."
echo "Use './iiab-install --reinstall' to force running all Stages 0-9."
echo "Use './iiab-install --debug' to run Stage 0, followed by Stages 3-9."
echo "Use './runtags' to run a single Stage or Tag or Role."
echo "Use './iiab-network' to run Network sections."
exit 1
fi
fi