diff --git a/usr/local/share/bastille/create.sh b/usr/local/share/bastille/create.sh index abe75daa..412b92a9 100644 --- a/usr/local/share/bastille/create.sh +++ b/usr/local/share/bastille/create.sh @@ -445,8 +445,8 @@ else fi ## don't allow for dots(.) in container names -if echo "${NAME}" | grep -q "[.]"; then - echo -e "${COLOR_RED}Container names may not contain a dot(.)!${COLOR_RESET}" +if echo "${NAME}" | grep -Eq '[.]|\ '; then + echo -e "${COLOR_RED}Container names may not contain a dot(.) nor spaces!${COLOR_RESET}" exit 1 fi diff --git a/usr/local/share/bastille/rename.sh b/usr/local/share/bastille/rename.sh index c4645f86..279919ce 100644 --- a/usr/local/share/bastille/rename.sh +++ b/usr/local/share/bastille/rename.sh @@ -57,8 +57,8 @@ TARGET="${1}" NEWNAME="${2}" shift -if echo "${NEWNAME}" | grep -q "[.]"; then - echo -e "${COLOR_RED}Container names may not contain a dot(.)!${COLOR_RESET}" +if echo "${NEWNAME}" | grep -Eq '[.]|\ '; then + echo -e "${COLOR_RED}Container names may not contain a dot(.) nor spaces!${COLOR_RESET}" exit 1 fi @@ -125,9 +125,11 @@ change_name() { fi } -# Check if container is running -if [ -n "$(jls name | awk "/^${TARGET}$/")" ]; then - error_notify "${COLOR_RED}${TARGET} is running, See 'bastille stop'.${COLOR_RESET}" +## check if a running jail matches name or already exist +if [ "$(jls name | awk "/^${TARGET}$/")" ]; then + error_notify "${COLOR_RED}Warning: ${TARGET} is running or the name does match.${COLOR_RESET}" +elif [ -d "${bastille_jailsdir}/${NEWNAME}" ]; then + error_notify "${COLOR_RED}Jail: ${NEWNAME} already exist.${COLOR_RESET}" fi change_name