diff --git a/smithy b/smithy index 37093d56..a7bff82c 100755 --- a/smithy +++ b/smithy @@ -258,6 +258,13 @@ greatest_version() done | sort --version-sort --reverse | head -n1 } +smallest_version() +{ + for arg in "$@"; do + echo "$arg" + done | sort --version-sort | head -n1 +} + ## Identify which bootstrap configuration file to use: either set ## explicitly (BSCONF_FILE) or determined based on the os distribution: BSCONF_DIR="${BSCONF_DIR:-$(dirname $(readlink -f "$0"))/tools/bootstrap}" @@ -344,9 +351,19 @@ if [ ! -f "$BSCONF_FILE" ]; then else MIN_RELEASE=${MIN_RELEASE:?"Error: MIN_RELEASE is undefined!"} SHORTNAME=${SHORTNAME:?"Error: SHORTNAME is undefined!"} - if [ "$RELEASE" != "$(greatest_version "$RELEASE" "$MIN_RELEASE")" ]; then - echo "This script must be run on $SHORTNAME $MIN_RELEASE+ and not $SHORTNAME $RELEASE." >&2 - puke + if [ "$MIN_RELEASE" != "$RELEASE" ]; then + if [ "$RELEASE" != "$(greatest_version "$RELEASE" "$MIN_RELEASE")" ]; then + echo "This script must be run on $SHORTNAME $MIN_RELEASE and newer and not $SHORTNAME $RELEASE." >&2 + puke + fi + fi + if [ -n "$MAX_RELEASE" ]; then + if [ "$MAX_RELEASE" != "$RELEASE" ]; then + if [ "$MAX_RELEASE" == "$(smallest_version "$MAX_RELEASE" "$RELEASE")" ]; then + echo "This script must be run on $SHORTNAME $MAX_RELEASE or older and not $SHORTNAME $RELEASE." >&2 + puke + fi + fi fi fi diff --git a/tools/bootstrap/CentOS b/tools/bootstrap/CentOS index e143c6d9..2d4c0421 100644 --- a/tools/bootstrap/CentOS +++ b/tools/bootstrap/CentOS @@ -1,6 +1,7 @@ # -*- sh -*- -## Bootstrap for CentOS Linux 7.x +## Bootstrap for CentOS Linux 6.0 <-> 7.0 SHORTNAME=CENTOS -MIN_RELEASE=7.0 +MAX_RELEASE=7.0 +MIN_RELEASE=6.0 source "$BSCONF_DIR/CommonRedHat" diff --git a/tools/bootstrap/OracleLinuxServer b/tools/bootstrap/OracleLinuxServer index 0da23ead..e9338ce2 100644 --- a/tools/bootstrap/OracleLinuxServer +++ b/tools/bootstrap/OracleLinuxServer @@ -1,6 +1,7 @@ # -*- sh -*- -## Bootstrap OEL 6.3+ for Openstack Anvil +## Bootstrap OEL 6.3 <-> 7.0 for Openstack Anvil SHORTNAME=OEL MIN_RELEASE=6.3 +MAX_RELEASE=7.0 source "$BSCONF_DIR/CommonRedHat" diff --git a/tools/bootstrap/RedHatEnterpriseLinuxServer b/tools/bootstrap/RedHatEnterpriseLinuxServer index c6d27f18..b79091e8 100644 --- a/tools/bootstrap/RedHatEnterpriseLinuxServer +++ b/tools/bootstrap/RedHatEnterpriseLinuxServer @@ -1,6 +1,7 @@ # -*- sh -*- -## Bootstrap for Redhat Enterprise Linux 7.x +## Bootstrap for Redhat Enterprise Linux 6.0 <-> 7.0 SHORTNAME=RHEL -MIN_RELEASE=7.0 +MAX_RELEASE=7.0 +MIN_RELEASE=6.0 source "$BSCONF_DIR/CommonRedHat"