From 53e7856d28d39f85fd6407440871610f7a20072e Mon Sep 17 00:00:00 2001 From: Jose Date: Fri, 14 Feb 2020 19:01:08 -0400 Subject: [PATCH] Ignore IPv4 check if there is no entry at all --- usr/local/share/bastille/start.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/usr/local/share/bastille/start.sh b/usr/local/share/bastille/start.sh index 7b0fd9a..8e457c0 100644 --- a/usr/local/share/bastille/start.sh +++ b/usr/local/share/bastille/start.sh @@ -68,11 +68,13 @@ for _jail in ${JAILS}; do ## test if not running elif [ ! "$(jls name | awk "/^${_jail}$/")" ]; then - ## warn if matching configured (but not online) ip4.addr + ## warn if matching configured (but not online) ip4.addr, ignore if there's no ip4.addr entry ip=$(grep 'ip4.addr' "${bastille_jailsdir}/${_jail}/jail.conf" | awk '{print $3}' | sed 's/\;//g') - if ifconfig | grep -w "${ip}" >/dev/null; then - echo -e "${COLOR_RED}Error: IP address (${ip}) already in use.${COLOR_RESET}" - exit 1 + if [ -n "${ip}" ]; then + if ifconfig | grep -w "${ip}" >/dev/null; then + echo -e "${COLOR_RED}Error: IP address (${ip}) already in use.${COLOR_RESET}" + exit 1 + fi fi ## start the container