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

svn at pcbsd.org svn at pcbsd.org
Tue Jun 10 14:06:18 PDT 2008


Author: kris
Date: 2008-06-10 14:06:05 -0700 (Tue, 10 Jun 2008)
New Revision: 2083

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

More script fixes for ZFS support



Modified: pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.MountDisk.sh
===================================================================
--- pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.MountDisk.sh	2008-06-10 16:38:41 UTC (rev 2082)
+++ pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.MountDisk.sh	2008-06-10 21:06:05 UTC (rev 2083)
@@ -3,14 +3,7 @@
 # Configuration file
 . /usr/local/pcbsd/scripts/PCBSD.Config
 
-if [ -e "/tmp/mirrorDrive" ]
-then
-  ROOTPART="/dev/mirror/gm0s1"
-  IDRIVE="`cat /tmp/mirrorDrive | cut -d " " -f 2`"
-  swapon /dev/mirror/gm0s1b
-else
-  ROOTPART="${1}"
-fi
+ROOTPART="${1}"
 
 # Check which filesystem type we are using
 case ${2} in
@@ -31,35 +24,7 @@
 fi
 
 
-echo "Creating fstab file";
 
-mount -o rw${MNTOPTS} ${ROOTPART}a${EXTENSION} ${FSMNT} >/dev/null 2>/dev/null
-
-if [ -e "/tmp/mirrorDrive" ]
-then
-  gmirror configure -a gm0
-  gmirror insert gm0 /dev/${IDRIVE}
- 
-  sleep 3
-
-  while
-  i=1
-  do
-  
-  sleep 10 
-
-  gmirror list | grep "SYNC" >/dev/null 2>/dev/null
-  if [ "$?" != "0" ]
-  then
-    break;
-  fi
-
-  done
-  
-fi
-
-mkdir ${FSMNT}/etc
-
 if [ -e "/tmp/encSwap" ]
 then
   ENC=".bde"
@@ -67,11 +32,32 @@
   ENC=""
 fi
 
+# If we are on ZFS, make sure that we set the root mountpoint properly
+if [ "$FS" = "ZFS" ]
+then
+  echo "Creating fstab file";
+  mount -o rw${MNTOPTS} ${ROOTPART}e${EXTENSION} ${FSMNT} >/dev/null 2>/dev/null
+  mkdir ${FSMNT}/etc
+  mkdir ${FSMNT}/bootdir
+  mount -o rw${MNTOPTS} ${ROOTPART}a${EXTENSION} ${FSMNT}/bootdir >/dev/null 2>/dev/null
+  zfs set mountpoint=legacy ${ROOTPART}e 
 
-# Create the FSTAB file
-echo "# Device                Mountpoint      FStype  Options         Dump    Pass#
+  # Create the FSTAB file
+  echo "# Device                Mountpoint      FStype  Options         Dump    Pass#
 ${ROOTPART}b${ENC}          	none            swap    sw              0       0
+${ROOTPART}a${EXTENSION}         	/bootdir               ufs     rw${MNTOPTS}              1       1 " > /tmp/fstab
+
+else
+  # Using regular UFS
+  echo "Creating fstab file";
+  mount -o rw${MNTOPTS} ${ROOTPART}a${EXTENSION} ${FSMNT} >/dev/null 2>/dev/null
+  mkdir ${FSMNT}/etc
+
+  # Create the FSTAB file
+  echo "# Device                Mountpoint      FStype  Options         Dump    Pass#
+${ROOTPART}b${ENC}          	none            swap    sw              0       0
 ${ROOTPART}a${EXTENSION}          	/               ufs     rw${MNTOPTS}              1       1 " > /tmp/fstab
+fi
 
 ##
 # Check for any extra mount points and do it now
@@ -88,10 +74,20 @@
   eval cur_part="\$${varname}"
   if [ "${cur_part}" ]
   then
-   mkdir -p ${FSMNT}${cur_part}
-   echo "${ROOTPART}${lpart}{EXTENSION}               ${cur_part}               ufs     rw${MNTOPTS}              1       1  
+   if [ "${cur_part}" != "/" -a "${cur_part}" != "/bootdir" ]
+   then
+     mkdir -p ${FSMNT}${cur_part}
+     echo "${ROOTPART}${lpart}{EXTENSION}               ${cur_part}               ufs     rw${MNTOPTS}              1       1  
 " >> /tmp/fstab
-   mount -o rw${MNTOPTS} ${ROOTPART}${lpart}{EXTENSION} ${FSMNT}${cur_part}
+
+     mount -o rw${MNTOPTS} ${ROOTPART}${lpart}{EXTENSION} ${FSMNT}${cur_part}
+   fi
+
+   if [ "$FS" = "ZFS" -a "${cur_part}" != "/bootdir" ]
+   then
+      # Setup our mount info for ZFS 
+      zfs set mountpoint=${cur_part} ${ROOTPART}${lpart}
+   fi
   fi
 done
 

Modified: pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.NewFS.sh
===================================================================
--- pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.NewFS.sh	2008-06-10 16:38:41 UTC (rev 2082)
+++ pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.NewFS.sh	2008-06-10 21:06:05 UTC (rev 2083)
@@ -34,8 +34,19 @@
 
 if [ "${FS}" = "ZFS" ]
 then
+  # Setup UFS on our /bootdir partition for ZFS
+  newfs ${1}a >/dev/null 2>/dev/null
 
+  for DevName in `ls -1 ${1}[e-h]`
+  do
+    echo "Running Newfs on ${DevName}"
+    BASENAME="`echo $DevName | cut -d '/' -f 3`"
+    zpool create ${BASENAME} ${DevName}
+  done
+
+  echo "${1}e" > /uzip/ZFS-root
   exit 0
+
 fi
 
 

Modified: pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.SysConfig.sh
===================================================================
--- pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.SysConfig.sh	2008-06-10 16:38:41 UTC (rev 2082)
+++ pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.SysConfig.sh	2008-06-10 21:06:05 UTC (rev 2083)
@@ -131,6 +131,21 @@
 # Make sure each dir is "chowned" properly
 /usr/local/pcbsd/scripts/PCBSD.SetUserPerms.sh
 
+# Make sure we set any final ZFS options if we need it
+if [ -e "/uzip/ZFS-root" ]
+then
+  ZFSROOT="`cat /uzip/ZFS-root`"
+  echo 'zfs_load="YES"' >> ${FSMNT}/boot/loader.conf
+  echo 'vfs.root.mountfrom="zfs:${ZFSROOT}"' >> ${FSMNT}/boot/loader.conf
+
+  # Move the kernel to /bootdir so we can bootup properly
+  mv -f ${FSMNT}/boot/* ${FSMNT}/bootdir/
+  rmdir ${FSMNT}/boot
+  # Create our link to /boot on the ZFS partition
+  ln -s /bootdir ${FSMNT}/boot
+fi
+
+
 #echo "Unmounting Disk...";
 # Get the disks to unmount
 UMNTDEVS="`cat ${FSMNT}/etc/fstab | grep ufs | cut -d ' ' -f 1`"



More information about the Commits mailing list