[PC-BSD Commits] r3994 - pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts
svn at pcbsd.org
svn at pcbsd.org
Thu May 28 11:24:51 PDT 2009
Author: kris
Date: 2009-05-28 11:24:50 -0700 (Thu, 28 May 2009)
New Revision: 3994
Modified:
pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.FindUpdateParts.sh
Log:
Fixed our detection script which doing updates. Now we can find PC-BSD installs on ZFS
Modified: pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.FindUpdateParts.sh
===================================================================
--- pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.FindUpdateParts.sh 2009-05-28 17:38:33 UTC (rev 3993)
+++ pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.FindUpdateParts.sh 2009-05-28 18:24:50 UTC (rev 3994)
@@ -9,6 +9,7 @@
do
# Set our flag that we have not found any mounts
FOUNDMNT="0"
+ ZROOT=""
if [ -e "${i}a.journal" ]
then
@@ -25,6 +26,22 @@
echo "Found: ${i}"
PART="${i}"
+ # 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
+ fi
+
touch /tmp/TempUMount
# Check for the partitions in fstab, and mount them now
@@ -66,14 +83,14 @@
${PBREG} get /PC-BSD/Version >/.pcver 2>/.pcver
file /bin/sh >/.fbver 2>/.fbver' >${FSMNT}/getver.sh
- chmod 755 ${FSMNT}/getver.sh
- chroot ${FSMNT} /getver.sh
- VER="`cat ${FSMNT}/.pcver`"
- FBVER="`cat ${FSMNT}/.fbver`"
+ chmod 755 ${FSMNT}/getver.sh >/dev/null 2>/dev/null
+ chroot ${FSMNT} /getver.sh >/dev/null 2>/dev/null
+ VER="`cat ${FSMNT}/.pcver 2>/dev/null`"
+ FBVER="`cat ${FSMNT}/.fbver 2>/dev/null`"
# Remove old files
- rm ${FSMNT}/.pcver
- rm ${FSMNT}/.fbver
+ rm ${FSMNT}/.pcver >/dev/null 2>/dev/null
+ rm ${FSMNT}/.fbver >/dev/null 2>/dev/null
rm ${FSMNT}/getver.sh
# Check if this is running FreeBSD 7, otherwise don't upgrade it
@@ -86,10 +103,20 @@
fi # End of if /mnt/PCBSD
+ if [ ! -z "${ZROOT}" ]
+ then
+ umount ${FSMNT}/bootdir
+ fi
+
# Unmount FS
/bin/sh /tmp/TempUMount
- umount /mnt
+ umount ${FSMNT}
rm /tmp/TempUMount
+
+ if [ ! -z "${ZROOT}" ]
+ then
+ zpool export -f ${ZROOT}
+ fi
fi # End of if ${i}a
More information about the Commits
mailing list