From 5c49283d1874090324c12ff47e8a8f23882d02f9 Mon Sep 17 00:00:00 2001 From: John Hixson Date: Tue, 30 Jun 2015 17:16:40 -0700 Subject: [PATCH] Fix jail template migrations - Finally found the /mnt/mnt issue - Looks like the output of "file" changed just enoug in 9.3 to piss off the template system to always force migrations, fixed! Ticket: #10408 --- src/freenas/etc/ix.rc.d/ix-warden | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/freenas/etc/ix.rc.d/ix-warden b/src/freenas/etc/ix.rc.d/ix-warden index fe2c1fdf8be4..1f87713beb04 100755 --- a/src/freenas/etc/ix.rc.d/ix-warden +++ b/src/freenas/etc/ix.rc.d/ix-warden @@ -123,6 +123,8 @@ migrate_warden_templates() local template local ta local tv + local pool + local altroot template="${jc_path}/.warden-template-${t}" if [ ! -d "${template}" ] @@ -152,6 +154,12 @@ migrate_warden_templates() newmp="${jc_path}/.warden-template-${t}-${tv}-${ta}-${timestr}" fi + pool="$(echo "${jc_dataset}"|cut -f1 -d '/')" + if [ -n "${pool}" ] + then + altroot="$(zpool get -H altroot "${pool}"|awk '{ print $3 }')" + fi + _w zfs set mountpoint='none' "${template}" if [ "$?" != "0" ] then @@ -170,6 +178,11 @@ migrate_warden_templates() continue fi + if [ -n "${altroot}" ] + then + newmp="${newmp##${altroot}}" + fi + _w zfs set mountpoint="${newmp}" "${newt}" if [ "$?" != "0" ] then @@ -191,8 +204,7 @@ get_tv() fi sysctl_path="${path}/sbin/sysctl" - - version="$(file -b "${sysctl_path}"|cut -d ',' -f 5|awk '{ print $3 }')" + version="$(file -b "${sysctl_path}"|cut -d ',' -f 6|awk '{ print $3 }')" if [ -n "${version}" ] then echo "${version}"