[PC-BSD Commits] r3995 - pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts

svn at pcbsd.org svn at pcbsd.org
Thu May 28 11:45:17 PDT 2009


Author: kris
Date: 2009-05-28 11:45:17 -0700 (Thu, 28 May 2009)
New Revision: 3995

Modified:
   pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.MountUpgrade.sh
   pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.SysConfig.sh
Log:

Update install scripts to fix ZFS detection when doing upgrades

Still needs some work though ;)



Modified: pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.MountUpgrade.sh
===================================================================
--- pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.MountUpgrade.sh	2009-05-28 18:24:50 UTC (rev 3994)
+++ pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.MountUpgrade.sh	2009-05-28 18:45:17 UTC (rev 3995)
@@ -17,7 +17,24 @@
   mount ${PART}a ${FSMNT}${MNT} >/dev/null 2>/dev/null
 fi
 
+# Check if this is a ZFS boot partition
+cat ${FSMNT}/boot/loader.conf | grep '^vfs.root.mountfrom="zfs:' >/dev/null 2>/dev/null
+if [ "$?" = "0" ]
+then
+  ZROOT="`cat ${FSMNT}/boot/loader.conf | grep vfs.root.mountfrom | cut -d '=' -f 2 | cut -d ':' -f 2 | cut -d '/' -f 1`"
+  umount ${FSMNT}
+  # Import the zfs pool now
+  zpool import -f -R /mnt ${ZROOT}
 
+  # Now mount the root partition for ZFS
+  mount -t zfs ${ZROOT}/root ${FSMNT}
+
+  # Mount the bootdir now
+  mount ${PART}a ${FSMNT}/bootdir
+  echo "${ZROOT}" > /tmp/upgradeZFS
+fi
+
+
 # Check for the partitions in fstab, and mount them now
 LIST="d e f g h"
 for i in $LIST

Modified: pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.SysConfig.sh
===================================================================
--- pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.SysConfig.sh	2009-05-28 18:24:50 UTC (rev 3994)
+++ pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.SysConfig.sh	2009-05-28 18:45:17 UTC (rev 3995)
@@ -239,8 +239,19 @@
     fi
   done
 
+  if [ -e "/tmp/upgradeZFS" ]
+  then
+    ZROOT=`cat /tmp/upgradeZFS`
+    umount ${FSMNT}/bootdir
+  fi
+
   umount -f ${FSMNT} >/dev/null
 
+  if [ ! -z "${ZROOT}" ]
+  then
+    zpool export -f ${ZROOT}
+  fi
+
 fi
 
 # If we are not using a network URL, unmount the CD



More information about the Commits mailing list