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

svn at pcbsd.org svn at pcbsd.org
Thu Oct 29 06:29:56 PST 2009


Author: kris
Date: 2009-10-29 07:29:55 -0700 (Thu, 29 Oct 2009)
New Revision: 4809

Modified:
   pcbsd/trunk/pc-sysinstall/backend/functions-extractimage.sh
   pcbsd/trunk/pc-sysinstall/backend/functions-installcomponents.sh
   pcbsd/trunk/pc-sysinstall/backend/functions-mountdisk.sh
   pcbsd/trunk/pc-sysinstall/backend/functions-mountoptical.sh
   pcbsd/trunk/pc-sysinstall/backend/functions-mountusb.sh
   pcbsd/trunk/pc-sysinstall/backend/functions-runcommands.sh
   pcbsd/trunk/pc-sysinstall/backend/functions-unmount.sh
Log:

Cleanup our other function scripts



Modified: pcbsd/trunk/pc-sysinstall/backend/functions-extractimage.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-extractimage.sh	2009-10-29 13:31:47 UTC (rev 4808)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-extractimage.sh	2009-10-29 14:29:55 UTC (rev 4809)
@@ -16,7 +16,7 @@
   fi
 
   case ${PACKAGETYPE} in
-   lzma) echo "Starting image extraction..." >>${LOGOUT} 
+   lzma) echo_log "Starting image extraction..."
          ${LZMA_CMD} ${CDMNT}/${INSFILE} 2>/dev/null | tar -xpvf - -C ${FSMNT} ${TAROPTS} >&1 2>&1
          if [ "$?" != "0" ]
          then

Modified: pcbsd/trunk/pc-sysinstall/backend/functions-installcomponents.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-installcomponents.sh	2009-10-29 13:31:47 UTC (rev 4808)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-installcomponents.sh	2009-10-29 14:29:55 UTC (rev 4809)
@@ -31,16 +31,14 @@
 
     if [ "${RESULT}" != "0" ]
     then
-      echo "WARNING: Failed to copy ${CFILE}" >>${LOGOUT}
-      echo "WARNING: Failed to copy ${CFILE}"
+      echo_log "WARNING: Failed to copy ${CFILE}"
       FAILED="1"
     else
       # Now lets check the MD5 to confirm the file is valid
       CHECKMD5=`md5 -q ${FSMNT}/${COMPTMPDIR}/${CFILE}`
       if [ "${CHECKMD5}" != "${CFILEMD5}" ]
       then
-        echo "WARNING: ${CFILE} failed md5 checksum" >>${LOGOUT}
-        echo "WARNING: ${CFILE} failed md5 checksum"
+        echo_log "WARNING: ${CFILE} failed md5 checksum"
         FAILED="1"
       else
         if [ -z "${CFILES}" ]
@@ -85,8 +83,7 @@
    # Copy over the install script for this component
    cp ${COMPDIR}/${COMPONENT}/install.sh ${FSMNT}/${COMPTMPDIR}/
 
-   echo "INSTALL COMPONENT: ${i}"
-   echo "INSTALL COMPONENT: ${i}" >>${LOGOUT}
+   echo_log "INSTALL COMPONENT: ${i}"
    chroot ${FSMNT} /.componentwrapper.sh >>${LOGOUT} 2>>${LOGOUT}
    rm ${FSMNT}/.componentwrapper.sh
 
@@ -107,8 +104,7 @@
       do
         if [ ! -e "${COMPDIR}/${i}/install.sh" -o ! -e "${COMPDIR}/${i}/distfiles" ]
         then
-	  echo "WARNING: Component ${i} doesn't seem to exist"
-	  echo "WARNING: Component ${i} doesn't seem to exist" >>${LOGOUT}
+	  echo_log "WARNING: Component ${i} doesn't seem to exist"
         else
 
           # Make the tmpdir on the disk

Modified: pcbsd/trunk/pc-sysinstall/backend/functions-mountdisk.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-mountdisk.sh	2009-10-29 13:31:47 UTC (rev 4808)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-mountdisk.sh	2009-10-29 14:29:55 UTC (rev 4809)
@@ -38,25 +38,17 @@
     else
       ZNAME="${MNTPOINT}"
     fi
-    echo "zfs create ${PART}${ZNAME}"
-    zfs create ${PART}${ZNAME} >>${LOGOUT} 2>>${LOGOUT}
-    echo "zfs set mountpoint=${FSMNT}${MNTPOINT} ${PART}${ZNAME}"
+    echo_log "zfs create ${PART}${ZNAME}"
+    rc_halt "zfs create ${PART}${ZNAME}"
+    echo_log "zfs set mountpoint=${FSMNT}${MNTPOINT} ${PART}${ZNAME}"
     sleep 2
-    zfs set mountpoint=${FSMNT}${MNTPOINT} ${PART}${ZNAME} >>${LOGOUT} 2>>${LOGOUT}
-    if [ "$?" != "0" ]
-    then
-      exit_err "ERROR: Failed to set mountpoint ${PART}${ZNAME} -> ${FSMNT}/${MNTPOINT}"
-   fi
+    rc_halt "zfs set mountpoint=${FSMNT}${MNTPOINT} ${PART}${ZNAME}"
 
   else
   # If we are not on ZFS, lets do the mount now
-    echo "mount ${MNTFLAGS} /dev/${PART} -> ${FSMNT}${MNTPOINT}"
+    echo_log "mount ${MNTFLAGS} /dev/${PART} -> ${FSMNT}${MNTPOINT}"
     sleep 2
-    mount ${MNTFLAGS} /dev/${PART} ${FSMNT}${MNTPOINT} >>${LOGOUT} 2>>${LOGOUT}
-    if [ "$?" != "0" ]
-    then
-      exit_err "ERROR: Failed to mount /dev/${PART} -> ${FSMNT}${MNTPOINT}"
-    fi
+    rc_halt "mount ${MNTFLAGS} /dev/${PART} ${FSMNT}${MNTPOINT}"
   fi
 
 };
@@ -140,13 +132,13 @@
         SWAP) # Lets enable this swap now
               if [ "$PARTENC" = "ON" ]
               then
-                echo "Enabling encrypted swap on /dev/${PART}"
-                dd if=/dev/random of=/dev/${PART} bs=1m >>${LOGOUT} 2>>${LOGOUT}
-                geli onetime -d -e 3des ${PART} >>${LOGOUT} 2>>${LOGOUT}
-                swapon /dev/${PART}.eli >>${LOGOUT} 2>>${LOGOUT}
+                echo_log "Enabling encrypted swap on /dev/${PART}"
+                rc_nohalt "dd if=/dev/random of=/dev/${PART} bs=1m"
+                rc_halt "geli onetime -d -e 3des ${PART}"
+                rc_halt "swapon /dev/${PART}.eli"
               else
-                echo "swapon ${PART}"
-                swapon /dev/${PART}
+                echo_log "swapon ${PART}"
+                rc_halt "swapon /dev/${PART}"
               fi
               ;;
           *) exit_err "ERROR: Got unknown file-system type $PARTFS" ;;

Modified: pcbsd/trunk/pc-sysinstall/backend/functions-mountoptical.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-mountoptical.sh	2009-10-29 13:31:47 UTC (rev 4808)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-mountoptical.sh	2009-10-29 14:29:55 UTC (rev 4809)
@@ -12,8 +12,8 @@
    if [ "${VAL}" = "yes" ]
    then
      # We are running interactive, and didn't find a DVD, prompt user again
-     echo "OPT DISK ERROR: Unable to find installation disk!"
-     echo "Please insert the installation disk and press enter."
+     echo_log "OPT DISK ERROR: Unable to find installation disk!"
+     echo_log "Please insert the installation disk and press enter."
      read tmp
    else
     exit_err "ERROR: Unable to locate installation DVD"
@@ -33,7 +33,7 @@
    if [ -e "${CDMNT}/${INSFILE}" ]
    then
      echo "MOUNTED" >${TMPDIR}/cdmnt
-     echo "FOUND DVD: MOUNTED" >>${LOGOUT}
+     echo_log "FOUND DVD: MOUNTED"
      FOUND="1"
      return
    fi
@@ -59,7 +59,7 @@
      if [ -e "${CDMNT}/${INSFILE}" ]
      then
        echo "${i}" >${TMPDIR}/cdmnt
-       echo "FOUND DVD: ${i}" >>${LOGOUT}
+       echo_log "FOUND DVD: ${i}"
        FOUND="1"
        break
      fi

Modified: pcbsd/trunk/pc-sysinstall/backend/functions-mountusb.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-mountusb.sh	2009-10-29 13:31:47 UTC (rev 4808)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-mountusb.sh	2009-10-29 14:29:55 UTC (rev 4809)
@@ -11,8 +11,8 @@
    if [ "${VAL}" = "yes" ]
    then
      # We are running interactive, and didn't find a USB, prompt user again
-     echo "OPT DISK ERROR: Unable to find installation disk!"
-     echo "Please insert the installation disk and press enter."
+     echo_log "OPT DISK ERROR: Unable to find installation disk!"
+     echo_log "Please insert the installation disk and press enter."
      read tmp
    else
     exit_err "ERROR: Unable to locate installation USB"
@@ -32,7 +32,7 @@
    if [ -e "${CDMNT}/${INSFILE}" ]
    then
      echo "MOUNTED" >${TMPDIR}/cdmnt
-     echo "FOUND USB: MOUNTED" >>${LOGOUT}
+     echo_log "FOUND USB: MOUNTED"
      FOUND="1"
      return
    fi
@@ -58,7 +58,7 @@
      if [ -e "${CDMNT}/${INSFILE}" ]
      then
        echo "${i}" >${TMPDIR}/cdmnt
-       echo "FOUND USB: ${i}" >>${LOGOUT}
+       echo_log "FOUND USB: ${i}"
        FOUND="1"
        break
      fi
@@ -72,7 +72,7 @@
      if [ -e "${CDMNT}/${INSFILE}" ]
      then
        echo "${i}" >${TMPDIR}/cdmnt
-       echo "FOUND USB: ${i}" >>${LOGOUT}
+       echo_log "FOUND USB: ${i}"
        FOUND="1"
        break
      fi

Modified: pcbsd/trunk/pc-sysinstall/backend/functions-runcommands.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-runcommands.sh	2009-10-29 13:31:47 UTC (rev 4808)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-runcommands.sh	2009-10-29 14:29:55 UTC (rev 4809)
@@ -7,7 +7,7 @@
 run_chroot_cmd()
 {
   CMD="$@"
-  echo "Running chroot command: ${CMD}" >>${LOGOUT}
+  echo_log "Running chroot command: ${CMD}"
   echo "$CMD" >${FSMNT}/.runcmd.sh
   chmod 755 ${FSMNT}/.runcmd.sh
   chroot ${FSMNT} sh /.runcmd.sh
@@ -22,7 +22,7 @@
   cp ${SCRIPT} ${FSMNT}/.$SBASE
   chmod 755 ${FSMNT}/.${SBASE}
 
-  echo "Running chroot script: ${SCRIPT}" >>${LOGOUT}
+  echo_log "Running chroot script: ${SCRIPT}"
   chroot ${FSMNT} /.${SBASE}
 
   rm ${FSMNT}/.${SBASE}
@@ -34,7 +34,7 @@
   CMD="$@"
   # Make sure to export FSMNT, in case cmd needs it
   export FSMNT
-  echo "Running external command: ${CMD}" >>${LOGOUT}
+  echo_log "Running external command: ${CMD}"
   echo "${CMD}"> ${TMPDIR}/.runcmd.sh
   chmod 755 ${TMPDIR}/.runcmd.sh
   sh ${TMPDIR}/.runcmd.sh

Modified: pcbsd/trunk/pc-sysinstall/backend/functions-unmount.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-unmount.sh	2009-10-29 13:31:47 UTC (rev 4808)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-unmount.sh	2009-10-29 14:29:55 UTC (rev 4809)
@@ -13,7 +13,7 @@
     MIRRORNAME="`cat ${DISK} | cut -d ':' -f 3`"
    
     # Start the mirroring service
-    gmirror insert ${MIRRORNAME} /dev/${MIRRORDISK}
+    rc_halt "gmirror insert ${MIRRORNAME} /dev/${MIRRORDISK}"
 
   done
 
@@ -35,33 +35,25 @@
      then
        if [ "${PARTENC}" = "ON" ]
        then
-         swapoff /dev/${PART}.eli
+         rc_nohalt "swapoff /dev/${PART}.eli"
        else
-         swapoff /dev/${PART}
+         rc_nohalt "swapoff /dev/${PART}"
        fi
      fi
 
      # Check if we've found "/" again, don't need to mount it twice
      if [ "$PARTMNT" != "/" -a "${PARTMNT}" != "none" -a "${PARTFS}" != "ZFS" ]
      then
-       umount ${FSMNT}${PARTMNT} >/dev/null 2>/dev/null
-       if [ "$?" != "0" ]
-       then
-         exit_err "ERROR: Failed to unmount ${FSMNT}${PARTMNT}"
-       fi
+       rc_halt "umount ${FSMNT}${PARTMNT}"
      fi
    done
 
    # Last lets the /mnt partition
    #########################################################
-   umount ${FSMNT}
-   if [ "$?" != "0" ]
-   then
-     exit_err "ERROR: Failed to unmount ${FSMNT}"
-   fi
+   rc_halt "umount ${FSMNT}"
 
    # Unmount our CDMNT
-   umount ${CDMNT} >/dev/null 2>/dev/null
+   rc_nohalt "umount ${CDMNT}"
 
    # Check if we need to run any gmirror syncing
    ls ${MIRRORCFGDIR}/* >/dev/null 2>/dev/null
@@ -91,25 +83,25 @@
        then
          if [ "${PARTENC}" = "ON" ]
          then
-           swapoff /dev/${PART}.eli >/dev/null 2>/dev/null
+           rc_nohalt "swapoff /dev/${PART}.eli"
          else
-           swapoff /dev/${PART} >/dev/null 2>/dev/null
+           rc_nohalt "swapoff /dev/${PART}"
          fi
        fi
 
        # Check if we've found "/" again, don't need to mount it twice
        if [ "$PARTMNT" != "/" -a "${PARTMNT}" != "none" -a "${PARTFS}" != "ZFS" ]
        then
-         umount ${FSMNT}${PARTMNT} >/dev/null 2>/dev/null
+         rc_nohalt "umount ${FSMNT}${PARTMNT}"
        fi
      done
 
      # Last lets the /mnt partition
      #########################################################
-     umount ${FSMNT} >/dev/null 2>/dev/null
+     rc_nohalt "umount ${FSMNT}"
 
    fi
 
    # Unmount our CDMNT
-   umount ${CDMNT} >/dev/null 2>/dev/null
+   rc_nohalt "umount ${CDMNT}"
 };



More information about the Commits mailing list