diff options
Diffstat (limited to 'ezjail.sh')
| -rwxr-xr-x | ezjail.sh | 16 |
1 files changed, 16 insertions, 0 deletions
| @@ -65,6 +65,8 @@ do_cmd() | |||
| 65 | eval ezjail_attachparams=\"\$jail_${ezjail}_attachparams\" | 65 | eval ezjail_attachparams=\"\$jail_${ezjail}_attachparams\" |
| 66 | eval ezjail_attachblocking=\"\$jail_${ezjail}_attachblocking\" | 66 | eval ezjail_attachblocking=\"\$jail_${ezjail}_attachblocking\" |
| 67 | eval ezjail_forceblocking=\"\$jail_${ezjail}_forceblocking\" | 67 | eval ezjail_forceblocking=\"\$jail_${ezjail}_forceblocking\" |
| 68 | eval ezjail_zfs_datasets=\"\$jail_${ezjail}_zfs_datasets\" | ||
| 69 | eval ezjail_cpuset=\"\$jail_${ezjail}_cpuset\" | ||
| 68 | 70 | ||
| 69 | # Do we still have a root to run in? | 71 | # Do we still have a root to run in? |
| 70 | [ ! -d "${ezjail_rootdir}" ] && echo " Warning: root directory ${ezjail_rootdir} of ${ezjail} does not exist." && continue | 72 | [ ! -d "${ezjail_rootdir}" ] && echo " Warning: root directory ${ezjail_rootdir} of ${ezjail} does not exist." && continue |
| @@ -88,6 +90,20 @@ do_cmd() | |||
| 88 | # Pass control to jail script which does the actual work | 90 | # Pass control to jail script which does the actual work |
| 89 | [ "${ezjail_pass}" ] && sh /etc/rc.d/jail one${action%crypto} ${ezjail_pass} | 91 | [ "${ezjail_pass}" ] && sh /etc/rc.d/jail one${action%crypto} ${ezjail_pass} |
| 90 | 92 | ||
| 93 | if [ "${action}" = "start" ]; then | ||
| 94 | ezjail_safename=`echo -n "${ezjail}" | tr -c '[:alnum:]' _` | ||
| 95 | # Get the JID of the jail | ||
| 96 | [ -f "/var/run/jail_${ezjail_safename}.id" ] && ezjail_id=`cat /var/run/jail_${ezjail_safename}.id` || return | ||
| 97 | |||
| 98 | # Attach ZFS-datasets to the jail | ||
| 99 | for zfs in ${ezjail_zfs_datasets}; do | ||
| 100 | /sbin/zfs jail ${ezjail_id} ${zfs} ||Êecho -n "Error: ${zfs} could not be configured" | ||
| 101 | done | ||
| 102 | |||
| 103 | # Configure processor sets for the jail via cpuset(1) | ||
| 104 | [ "${ezjail_cpuset}" ] && /usr/bin/cpuset -l ${ezjail_cpuset} -j ${ezjail_id} || echo -n "Error: The defined cpuset is malformed" | ||
| 105 | fi | ||
| 106 | |||
| 91 | # Can only detach after unmounting (from fstab.JAILNAME in /etc/rc.d/jail) | 107 | # Can only detach after unmounting (from fstab.JAILNAME in /etc/rc.d/jail) |
| 92 | attach_detach_post | 108 | attach_detach_post |
| 93 | } | 109 | } |
