Minor code cleanup
This commit is contained in:
@@ -43,7 +43,7 @@ error_notify() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
validate_name() {
|
validate_name() {
|
||||||
local NAME_VERIFY=${NAME}
|
local NAME_VERIFY=${NEWNAME}
|
||||||
local NAME_SANITY=$(echo "${NAME_VERIFY}" | tr -c -d 'a-zA-Z0-9-_')
|
local NAME_SANITY=$(echo "${NAME_VERIFY}" | tr -c -d 'a-zA-Z0-9-_')
|
||||||
if [ "${NAME_VERIFY}" != "${NAME_SANITY}" ]; then
|
if [ "${NAME_VERIFY}" != "${NAME_SANITY}" ]; then
|
||||||
error_notify "${COLOR_RED}Container names may not contain special characters!${COLOR_RESET}"
|
error_notify "${COLOR_RED}Container names may not contain special characters!${COLOR_RESET}"
|
||||||
@@ -65,11 +65,6 @@ TARGET="${1}"
|
|||||||
NEWNAME="${2}"
|
NEWNAME="${2}"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
if echo "${NEWNAME}" | grep -Eq '[.]|\ '; then
|
|
||||||
echo -e "${COLOR_RED}Container names may not contain a dot(.) nor spaces!${COLOR_RESET}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
update_jailconf() {
|
update_jailconf() {
|
||||||
# Update jail.conf
|
# Update jail.conf
|
||||||
JAIL_CONFIG="${bastille_jailsdir}/${NEWNAME}/jail.conf"
|
JAIL_CONFIG="${bastille_jailsdir}/${NEWNAME}/jail.conf"
|
||||||
@@ -141,7 +136,7 @@ elif [ -d "${bastille_jailsdir}/${NEWNAME}" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
## validate jail name
|
## validate jail name
|
||||||
if [ -n "${NAME}" ]; then
|
if [ -n "${NEWNAME}" ]; then
|
||||||
validate_name
|
validate_name
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user