aboutsummaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorRalf S. Engelschall <rse@FreeBSD.org>2004-12-10 14:18:52 +0000
committerRalf S. Engelschall <rse@FreeBSD.org>2004-12-10 14:18:52 +0000
commit232ffe028b8eb77c68ccce2b448c9a043eceb4ff (patch)
treebfebe1e8f7a711e61871a39f5f303c473127364f /etc
parentb6a1cbc0b60fe3a9c264fe82cb21b56d4d54cfd3 (diff)
Notes
Diffstat (limited to 'etc')
-rw-r--r--etc/defaults/rc.conf2
-rw-r--r--etc/rc.d/jail19
2 files changed, 21 insertions, 0 deletions
diff --git a/etc/defaults/rc.conf b/etc/defaults/rc.conf
index 4a79d1718e1bb..c7d4397d13604 100644
--- a/etc/defaults/rc.conf
+++ b/etc/defaults/rc.conf
@@ -495,7 +495,9 @@ jail_sysvipc_allow="NO" # Allow SystemV IPC use from within a jail
#jail_example_devfs_enable="NO" # mount devfs in the jail
#jail_example_fdescfs_enable="NO" # mount fdescfs in the jail
#jail_example_procfs_enable="NO" # mount procfs in jail
+#jail_example_mount_enable="NO" # mount/umount jail's fs
#jail_example_devfs_ruleset="ruleset_name" # devfs ruleset to apply to jail
+#jail_example_fstab="" # fstab(5) for mount/umount
##############################################################
### Define source_rc_confs, the mechanism used by /etc/rc.* ##
diff --git a/etc/rc.d/jail b/etc/rc.d/jail
index bdb797adacc7c..38d20c638b21b 100644
--- a/etc/rc.d/jail
+++ b/etc/rc.d/jail
@@ -45,11 +45,18 @@ init_variables()
eval jail_procfs=\"\$jail_${_j}_procfs_enable\"
[ -z "${jail_procfs}" ] && jail_procfs="NO"
+ eval jail_mount=\"\$jail_${_j}_mount_enable\"
+ [ -z "${jail_mount}" ] && jail_mount="NO"
+ # "/etc/fstab.${_j}" will be used for {,u}mount(8) if none is specified.
+ eval jail_fstab=\"\$jail_${_j}_fstab\"
+ [ -z "${jail_fstab}" ] && jail_fstab="/etc/fstab.${_j}"
+
# Debugging aid
#
debug "$_j devfs enable: $jail_devfs"
debug "$_j fdescfs enable: $jail_fdescfs"
debug "$_j procfs enable: $jail_procfs"
+ debug "$_j mount enable: $jail_mount"
debug "$_j hostname: $jail_hostname"
debug "$_j ip: $jail_ip"
debug "$_j root: $jail_rootdir"
@@ -57,6 +64,7 @@ init_variables()
debug "$_j fdescdir: $jail_fdescdir"
debug "$_j procdir: $jail_procdir"
debug "$_j ruleset: $jail_ruleset"
+ debug "$_j fstab: $jail_fstab"
}
# set_sysctl rc_knob mib msg
@@ -108,6 +116,10 @@ jail_umount_fs()
umount -f ${jail_procdir} >/dev/null 2>&1
fi
fi
+ if checkyesno jail_mount; then
+ [ -f "${jail_fstab}" ] || warn "${jail_fstab} does not exist"
+ umount -a -F "${jail_fstab}" >/dev/null 2>&1
+ fi
}
jail_start()
@@ -127,6 +139,13 @@ jail_start()
for _jail in ${jail_list}
do
init_variables $_jail
+ if checkyesno jail_mount; then
+ info "Mounting fstab for jail ${_jail} (${jail_fstab})"
+ if [ ! -f "${jail_fstab}" ]; then
+ err 3 "$name: ${jail_fstab} does not exist"
+ fi
+ mount -a -F "${jail_fstab}"
+ fi
if checkyesno jail_devfs; then
info "Mounting devfs on ${jail_devdir}"
devfs_mount_jail "${jail_devdir}" ${jail_ruleset}