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

svn at pcbsd.org svn at pcbsd.org
Wed Dec 30 11:02:49 PST 2009


Author: kris
Date: 2009-12-30 11:02:49 -0800 (Wed, 30 Dec 2009)
New Revision: 5718

Modified:
   pcbsd/trunk/pc-sysinstall/backend/functions-unmount.sh
Log:

Added fail-safe check on glabel status after doing an install. Still was seeing cases of labels "disappearing"
and want to give it a last confirmation before the user reboots. 



Modified: pcbsd/trunk/pc-sysinstall/backend/functions-unmount.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-unmount.sh	2009-12-30 18:47:39 UTC (rev 5717)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-unmount.sh	2009-12-30 19:02:49 UTC (rev 5718)
@@ -34,27 +34,59 @@
      PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`"
      PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`"
      PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`"
+     PARTLABEL="`cat ${PARTDIR}/${PART} | cut -d ':' -f 4`"
 
+     if [ "${PARTENC}" = "ON" ]
+     then
+       EXT=".eli"
+     else
+       EXT=""
+     fi
+
      if [ "${PARTFS}" = "SWAP" ]
      then
-       if [ "${PARTENC}" = "ON" ]
-       then
-         rc_nohalt "swapoff /dev/${PART}.eli"
-       else
-         rc_nohalt "swapoff /dev/${PART}"
-       fi
+       rc_nohalt "swapoff /dev/${PART}${EXT}"
      fi
 
-     # Check if we've found "/" again, don't need to mount it twice
+     # Check if we've found "/", and unmount that last
      if [ "$PARTMNT" != "/" -a "${PARTMNT}" != "none" -a "${PARTFS}" != "ZFS" ]
      then
        rc_nohalt "umount -f ${FSMNT}${PARTMNT}"
+
+       # Re-check if we are missing a label for this device and create it again if so
+       if [ ! -e "/dev/label/${PARTLABEL}" ]
+       then
+         case ${PARTFS} in
+             UFS) glabel label ${PARTLABEL} /dev/${PART}${EXT} ;;
+           UFS+S) glabel label ${PARTLABEL} /dev/${PART}${EXT} ;;
+           UFS+J) glabel label ${PARTLABEL} /dev/${PART}${EXT}.journal ;;
+               *) ;;
+         esac 
+       fi
      fi
+
+     # Check if we've found "/" and make sure the label exists
+     if [ "$PARTMNT" = "/" -a "${PARTFS}" != "ZFS" ]
+     then
+       if [ ! -e "/dev/label/${PARTLABEL}" ]
+       then
+         case ${PARTFS} in
+             UFS) ROOTRELABEL="glabel label ${PARTLABEL} /dev/${PART}${EXT}" ;;
+           UFS+S) ROOTRELABEL="glabel label ${PARTLABEL} /dev/${PART}${EXT}" ;;
+           UFS+J) ROOTRELABEL="glabel label ${PARTLABEL} /dev/${PART}${EXT}.journal" ;;
+               *) ;;
+         esac 
+       fi
+     fi
    done
 
    # Last lets the /mnt partition
    #########################################################
    rc_nohalt "umount -f ${FSMNT}"
+   if [ ! -z "${ROOTRELABEL}" ]
+   then
+     ${ROOTRELABEL}
+   fi
 
    # Unmount our CDMNT
    rc_nohalt "umount -f ${CDMNT}"



More information about the Commits mailing list