Skip to content

Commit

Permalink
Merge pull request #300 from mekanix/feature/cleanup
Browse files Browse the repository at this point in the history
Cleanup
  • Loading branch information
mekanix authored Feb 27, 2023
2 parents ff66090 + 30c2051 commit 4e12491
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions scripts/mkjail.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/sh

set -e

if [ -f "/usr/local/etc/reggae.conf" ]; then
. "/usr/local/etc/reggae.conf"
fi
Expand Down Expand Up @@ -173,9 +175,8 @@ EOF
-e "s;MAC;${MAC};g" \
"${SCRIPT_DIR}/../templates/base-jail.conf" >>"/etc/jail.conf.d/${NAME}.conf"
echo -e "${OPTIONS}\n}" >>"/etc/jail.conf.d/${NAME}.conf"
sysrc -R "${BSDINSTALL_CHROOT}" ifconfig_eth0="ether ${MAC}"
if [ "${USE_IPV4}" = "yes" ]; then
sysrc -R "${BSDINSTALL_CHROOT}" ifconfig_eth0+="DHCP"
sysrc -R "${BSDINSTALL_CHROOT}" ifconfig_eth0="DHCP"
fi
if [ "${USE_IPV6}" = "yes" ]; then
sysrc -R "${BSDINSTALL_CHROOT}" ifconfig_eth0_ipv6="inet6 -ifdisabled accept_rtadv auto_linklocal"
Expand Down
10 changes: 5 additions & 5 deletions templates/base-jail.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
mount.devfs;
host.domainname = "HOST";
host.hostname = "${name}.${host.domainname}";
vnet.interface = "epair${id}a";
$host_interface = "epair${id}b";
$host_interface = "epair${id}a";
vnet.interface = "epair${id}b";
devfs_ruleset = 8;
allow.raw_sockets;

exec.clean;
exec.prepare = "ifconfig ${vnet.interface} && ifconfig ${host_interface} destroy || true";
exec.prestart = "ifconfig epair${id} create ether ${mac} group $(echo ${name} | cut -b 1-15) up || (ifconfig ${vnet.interface} destroy && false)";
exec.prestart += "ifconfig ${host_interface} up";
exec.prepare = "ifconfig ${host_interface} && ifconfig ${host_interface} destroy || true";
exec.prestart = "ifconfig epair${id} create group $(echo ${name} | cut -b 1-15) up || (ifconfig ${host_interface} destroy && false)";
exec.prestart += "ifconfig jails addm ${host_interface}";
exec.start = "ifconfig ${vnet.interface} name eth0";
exec.start += "ifconfig eth0 ether ${mac}";
exec.start += "service dhclient start eth0";
exec.start += "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
Expand Down

0 comments on commit 4e12491

Please sign in to comment.