Simplify release name handling, code improvements and fixes
This commit is contained in:
@@ -134,8 +134,29 @@ fi
|
||||
NAME="$1"
|
||||
|
||||
## check what should we clean
|
||||
if echo "${NAME}" | grep -qwE '^([0-9]{1,2})\.[0-9]-RELEASE$'; then
|
||||
case "${NAME}" in
|
||||
*-RELEASE|*-release|*-RC1|*-rc1|*-RC2|*-rc2)
|
||||
## check for FreeBSD releases name
|
||||
NAME_VERIFY=$(echo "${NAME}" | grep -iwE '^([1-9]{2,2})\.[0-9](-RELEASE|-RC[1-2])$' | tr '[:lower:]' '[:upper:]')
|
||||
if [ -n "${NAME_VERIFY}" ]; then
|
||||
NAME="${NAME_VERIFY}"
|
||||
destroy_rel
|
||||
else
|
||||
destroy_jail
|
||||
usage
|
||||
fi
|
||||
;;
|
||||
*-stable-LAST|*-STABLE-last|*-stable-last|*-STABLE-LAST)
|
||||
## check for HardenedBSD releases name
|
||||
NAME_VERIFY=$(echo "${NAME}" | grep -iwE '^([1-9]{2,2})(-stable-LAST|-STABLE-last|-stable-last|-STABLE-LAST)$' | sed 's/STABLE/stable/g' | sed 's/last/LAST/g')
|
||||
if [ -n "${NAME_VERIFY}" ]; then
|
||||
NAME="${NAME_VERIFY}"
|
||||
destroy_rel
|
||||
else
|
||||
usage
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
## just destroy a jail
|
||||
destroy_jail
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user