Merge pull request #181 from cynix/fix_first_vnet_jail

Fix empty interface name when creating the first VNET jail.
This commit is contained in:
Christer Edwards
2020-03-30 13:51:06 -06:00
committed by GitHub

View File

@@ -144,17 +144,19 @@ generate_vnet_jail_conf() {
## determine number of containers + 1 ## determine number of containers + 1
## iterate num and grep all jail configs ## iterate num and grep all jail configs
## define uniq_epair ## define uniq_epair
local list_jails_num=$(bastille list jails | wc -l | awk '{print $1}') local jail_list=$(bastille list jails)
local num_range=$(expr "${list_jails_num}" + 1) if [ -n "${jail_list}" ]; then
jail_list=$(bastille list jail) local list_jails_num=$(echo "${jail_list}" | wc -l | awk '{print $1}')
for _num in $(seq 0 "${num_range}"); do local num_range=$(expr "${list_jails_num}" + 1)
if [ -n "${jail_list}" ]; then for _num in $(seq 0 "${num_range}"); do
if ! grep -q "e0b_bastille${_num}" "${bastille_jailsdir}"/*/jail.conf; then if ! grep -q "e0b_bastille${_num}" "${bastille_jailsdir}"/*/jail.conf; then
uniq_epair="bastille${_num}" uniq_epair="bastille${_num}"
break break
fi fi
fi done
done else
uniq_epair="bastille0"
fi
## generate config ## generate config
cat << EOF > "${bastille_jail_conf}" cat << EOF > "${bastille_jail_conf}"