[PC-BSD Commits] r6311 - pcbsd/trunk/pc-sysinstall/backend

svn at pcbsd.org svn at pcbsd.org
Mon Mar 1 08:55:51 PST 2010


Author: kris
Date: 2010-03-01 08:55:51 -0800 (Mon, 01 Mar 2010)
New Revision: 6311

Modified:
   pcbsd/trunk/pc-sysinstall/backend/functions-cleanup.sh
   pcbsd/trunk/pc-sysinstall/backend/functions-mountdisk.sh
   pcbsd/trunk/pc-sysinstall/backend/functions-newfs.sh
   pcbsd/trunk/pc-sysinstall/backend/functions.sh
Log:

Updated pc-sysinstall, now we can use a different "zpool" name, such as "tank0,tank1" etc for each device,
little nicer to deal with



Modified: pcbsd/trunk/pc-sysinstall/backend/functions-cleanup.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-cleanup.sh	2010-03-01 16:23:16 UTC (rev 6310)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-cleanup.sh	2010-03-01 16:55:51 UTC (rev 6311)
@@ -10,6 +10,9 @@
   do
     PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`"
     PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`"
+    get_zpool_name "${PART}"
+    ZPOOLNAME="${VAL}"
+
     if [ "$PARTFS" = "ZFS" ]
     then
       # Check if we have multiple zfs mounts specified
@@ -17,8 +20,8 @@
       do
         if [ "${ZMNT}" = "/" ]
         then
-          echo "vfs.root.mountfrom=\"zfs:${PART}\"" >> ${FSMNT}/boot/loader.conf
-          FOUNDZFSROOT="${PART}"
+          echo "vfs.root.mountfrom=\"zfs:${ZPOOLNAME}\"" >> ${FSMNT}/boot/loader.conf
+          FOUNDZFSROOT="${ZPOOLNAME}"
         fi
       done
       FOUNDZFS="1"
@@ -53,6 +56,8 @@
     PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`"
     PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`"
     PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`"
+    get_zpool_name "${PART}"
+    ZPOOLNAME="${VAL}"
 
     if [ "$PARTFS" = "ZFS" ]
     then
@@ -66,8 +71,8 @@
       do
         if [ "${ZMNT}" != "/" ]
         then
-          rc_halt "zfs set mountpoint=${ZMNT} ${PART}${ZMNT}"
-          rc_halt "zfs unmount ${PART}${ZMNT}"
+          rc_halt "zfs set mountpoint=${ZMNT} ${ZPOOLNAME}${ZMNT}"
+          rc_halt "zfs unmount ${ZPOOLNAME}${ZMNT}"
           sleep 2
         fi
       done

Modified: pcbsd/trunk/pc-sysinstall/backend/functions-mountdisk.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-mountdisk.sh	2010-03-01 16:23:16 UTC (rev 6310)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-mountdisk.sh	2010-03-01 16:55:51 UTC (rev 6311)
@@ -26,6 +26,8 @@
   #We are on ZFS, lets setup this mount-point
   if [ "${PARTFS}" = "ZFS" ]
   then
+     get_zpool_name "${PART}"
+     ZPOOLNAME="${VAL}"
 
      # Check if we have multiple zfs mounts specified
      for ZMNT in `echo ${MNTPOINT} | sed 's|,| |g'`
@@ -39,14 +41,14 @@
          ZNAME=""
        else
          ZNAME="${ZMNT}"
-         echo_log "zfs create ${PART}${ZNAME}"
-         rc_halt "zfs create ${PART}${ZNAME}"
+         echo_log "zfs create ${ZPOOLNAME}${ZNAME}"
+         rc_halt "zfs create ${ZPOOLNAME}${ZNAME}"
        fi
        sleep 2
-       rc_halt "zfs set mountpoint=${FSMNT}${ZNAME} ${PART}${ZNAME}"
+       rc_halt "zfs set mountpoint=${FSMNT}${ZNAME} ${ZPOOLNAME}${ZNAME}"
 
        # Disable atime for this zfs partition, speed increase
-       rc_nohalt "zfs set atime=off ${PART}${ZNAME}"
+       rc_nohalt "zfs set atime=off ${ZPOOLNAME}${ZNAME}"
      done 
 
   else

Modified: pcbsd/trunk/pc-sysinstall/backend/functions-newfs.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-newfs.sh	2010-03-01 16:23:16 UTC (rev 6310)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-newfs.sh	2010-03-01 16:55:51 UTC (rev 6311)
@@ -11,10 +11,14 @@
   EXT="$4"
   PARTGEOM="$5"
   ROOTSLICE="`echo ${PART} | rev | cut -b 2- | rev`"
-  rc_halt "zpool create -m none -f ${PART} ${PART}${EXT}"
+  get_zpool_name "${PART}"
+  ZPOOLNAME="${VAL}"
 
+
+  rc_halt "zpool create -m none -f ${ZPOOLNAME} ${PART}${EXT}"
+
   # Disable atime for this zfs partition, speed increase
-  rc_nohalt "zfs set atime=off ${PART}"
+  rc_nohalt "zfs set atime=off ${ZPOOLNAME}"
 
   # Check if we have multiple zfs mounts specified
   for i in `echo ${PARTMNT} | sed 's|,| |g'`
@@ -26,11 +30,11 @@
       then
         # Lets stamp the proper ZFS boot loader
         echo_log "Setting up ZFS boot loader support" 
-        rc_halt "zpool set bootfs=${PART} ${PART}"
-        rc_halt "zpool export ${PART}"
+        rc_halt "zpool set bootfs=${ZPOOLNAME} ${ZPOOLNAME}"
+        rc_halt "zpool export ${${ZPOOLNAME}"
         rc_halt "dd if=/boot/zfsboot of=/dev/${ROOTSLICE} count=1"
         rc_halt "dd if=/boot/zfsboot of=/dev/${PART}${EXT} skip=1 seek=1024"
-        rc_halt "zpool import ${PART}"
+        rc_halt "zpool import ${ZPOOLNAME}"
       fi
     fi
   done 

Modified: pcbsd/trunk/pc-sysinstall/backend/functions.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions.sh	2010-03-01 16:23:16 UTC (rev 6310)
+++ pcbsd/trunk/pc-sysinstall/backend/functions.sh	2010-03-01 16:55:51 UTC (rev 6311)
@@ -212,3 +212,30 @@
 return $EXIT
 
 };
+
+# Function to return a the zpool name for this device
+get_zpool_name()
+{
+  DEVICE="$1"
+
+  # Set the base name we use for zpools
+  BASENAME="tank"
+
+  if [ ! -d "${TMPDIR}/.zpools" ] ; then
+    mkdir -p ${TMPDIR}/.zpools
+  fi
+
+  if [ -e "${TMPDIR}/.zpools/${DEVICE}" ] ; then
+    VAL="`cat ${TMPDIR}/.zpools/${DEVICE}`"
+    export VAL
+    return 0
+  else
+    # Need to generate a zpool name for this device
+    NUM=`ls ${TMPDIR}/.zpools/ | wc -l | sed 's| ||g'`
+    NEWNAME="${BASENAME}${NUM}"
+    echo "$NEWNAME" >${TMPDIR}/.zpools/${DEVICE} 
+    VAL="${NEWNAME}"
+    export VAL
+    return
+  fi
+};



More information about the Commits mailing list