Date: Fri, 9 Jun 2006 16:23:52 GMT From: skv@FreeBSD.org To: FreeBSD-gnats-submit@FreeBSD.org Subject: conf/98758: Templatize 'jail_fstab' in /etc/rc.d/jail Message-ID: <200606091623.k59GNqQe046315@freefall.freebsd.org> Resent-Message-ID: <200606091630.k59GU79r046599@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 98758
>Category: conf
>Synopsis: Templatize 'jail_fstab' in /etc/rc.d/jail
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Fri Jun 09 16:30:07 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator: Sergey Skvortsov
>Release: FreeBSD 6.1-STABLE i386
>Organization:
<Organization of PR author (multiple lines)>
>Environment:
>Description:
Allow define template for jail's fstab.
>How-To-Repeat:
/etc/rc.conf.d/jail:
jail_fstab="/etc/fstab.jail" # TEMPLATE
jail_list="host1 host2"
jail_host1_rootdir="/data/jails/host1"
jail_host2_rootdir="/data/jails/host2"
/etc/fstab.jail:
# Device Mountpoint FStype Options Dump Pass#
/usr/ports %%JAIL_ROOT%%/usr/ports nullfs rw 0 0
Mounts will be maded accordingly to the template:
/usr/ports on /data/jails/host1/usr/ports (nullfs, local)
/usr/ports on /data/jails/host2/usr/ports (nullfs, local)
>Fix:
--- jail.orig Fri Jun 9 20:04:50 2006
+++ jail Fri Jun 9 20:08:22 2006
@@ -150,7 +150,8 @@
fi
if checkyesno _mount; then
[ -f "${_fstab}" ] || warn "${_fstab} does not exist"
- umount -a -F "${_fstab}" >/dev/null 2>&1
+ sed -e "s=%%JAIL_ROOT%%=${_rootdir}=" "${_fstab}" | \
+ umount -a -F /dev/fd/0 >/dev/null 2>&1
fi
}
@@ -183,7 +184,8 @@
if [ ! -f "${_fstab}" ]; then
err 3 "$name: ${_fstab} does not exist"
fi
- mount -a -F "${_fstab}"
+ sed -e "s=%%JAIL_ROOT%%=${_rootdir}=" "${_fstab}" | \
+ mount -a -F /dev/fd/0
fi
if checkyesno _devfs; then
# If devfs is already mounted here, skip it.
>Release-Note:
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606091623.k59GNqQe046315>
