@@ -164,12 +164,13 @@ update_jailconf_vnet() {
164
164
if ! grep -q " epair${_num} " " ${bastille_jailsdir} " /* /jail.conf; then
165
165
local uniq_epair=" bastille${_num} "
166
166
local uniq_epair_bridge=" ${_num} "
167
- # since we don't have access to the external_interface variable, we cat the jail.conf file to retrieve the mac prefix
167
+ # since we don't have access to the external_interface variable, we cat the jail.conf file to retrieve the mac prefix
168
168
# we also do not use the main generate_static_mac function here
169
169
local macaddr_prefix=" $( cat ${JAIL_CONFIG} | grep -m 1 ether | grep -oE ' ([0-9a-f]{2}(:[0-9a-f]{2}){5})' | awk -F: ' {print $1":"$2":"$3}' ) "
170
- local macaddr_suffix=" $( echo -n ${NEWNAME} | sha256 | cut -b -5 | sed ' s/\([0-9a-fA-F][0-9a-fA-F]\)\([0-9a-fA-F][0-9a-fA-F]\)\([0-9a-fA-F]\)/\1:\2:\3/' ) "
170
+ local macaddr_suffix=" $( echo -n ${NEWNAME} | sha256 | cut -b -5 | sed ' s/\([0-9a-fA-F][0-9a-fA-F]\)\([0-9a-fA-F][0-9a-fA-F]\)\([0-9a-fA-F]\)/\1:\2:\3/' ) "
171
+ local macaddr_suffix=" $( echo -n ${NEWNAME} | sha256 | cut -b -5 | sed ' s/\([0-9a-fA-F][0-9a-fA-F]\)\([0-9a-fA-F][0-9a-fA-F]\)\([0-9a-fA-F]\)/\1:\2:\3/' ) "
171
172
local macaddr=" ${macaddr_prefix} :${macaddr_suffix} "
172
- # Update the exec.* with uniq_epair when cloning jails.
173
+ # Update the exec.* with uniq_epair when cloning jails.
173
174
# for VNET jails
174
175
sed -i ' ' " s|bastille\([0-9]\{1,\}\)|${uniq_epair} |g" " ${JAIL_CONFIG} "
175
176
sed -i ' ' " s|e\([0-9]\{1,\}\)a_${NEWNAME} |e${uniq_epair_bridge} a_${NEWNAME} |g" " ${JAIL_CONFIG} "
@@ -200,15 +201,6 @@ update_fstab() {
200
201
# Update fstab to use the new name
201
202
FSTAB_CONFIG=" ${bastille_jailsdir} /${NEWNAME} /fstab"
202
203
if [ -f " ${FSTAB_CONFIG} " ]; then
203
- FSTAB_RELEASE=$( grep -owE ' ([1-9]{2,2})\.[0-9](-RELEASE|-RELEASE-i386|-RC[1-9]|-BETA[1-9]|-CURRENT)|([0-9]{1,2}(-stable-build-[0-9]{1,3}|-stable-LAST))|(current-build)-([0-9]{1,3})|(current-BUILD-LATEST)|([0-9]{1,2}-stable-BUILD-LATEST)' " ${FSTAB_CONFIG} " | uniq)
204
- FSTAB_CURRENT=$( grep -w " .*/releases/.*/jails/${TARGET} /root/.bastille" " ${FSTAB_CONFIG} " )
205
- FSTAB_NEWCONF=" ${bastille_releasesdir} /${FSTAB_RELEASE} ${bastille_jailsdir} /${NEWNAME} /root/.bastille nullfs ro 0 0"
206
- if [ -n " ${FSTAB_CURRENT} " ] && [ -n " ${FSTAB_NEWCONF} " ]; then
207
- # If both variables are set, update as needed
208
- if ! grep -qw " ${bastille_releasesdir} /${FSTAB_RELEASE} .*${bastille_jailsdir} /${NEWNAME} /root/.bastille" " ${FSTAB_CONFIG} " ; then
209
- sed -i ' ' " s|${FSTAB_CURRENT} |${FSTAB_NEWCONF} |" " ${FSTAB_CONFIG} "
210
- fi
211
- fi
212
204
# Update additional fstab paths with new jail path
213
205
sed -i ' ' " s|${bastille_jailsdir} /${TARGET} /root/|${bastille_jailsdir} /${NEWNAME} /root/|" " ${FSTAB_CONFIG} "
214
206
fi
0 commit comments