Use min/max releases for rhel variants

Change-Id: I0e09977841ea4185a18d87f0d56f7e7d073db269
This commit is contained in:
Joshua Harlow 2015-03-09 21:16:43 -07:00
parent d2a181b75a
commit ecb32fa319
4 changed files with 28 additions and 8 deletions

23
smithy
View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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"