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

svn at pcbsd.org svn at pcbsd.org
Thu Oct 29 05:31:47 PST 2009


Author: kris
Date: 2009-10-29 06:31:47 -0700 (Thu, 29 Oct 2009)
New Revision: 4808

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

Started cleanup of our functions-scripts to use new funcs for echo / logging
and commands



Modified: pcbsd/trunk/pc-sysinstall/backend/functions-disk.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-disk.sh	2009-10-29 09:02:43 UTC (rev 4807)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-disk.sh	2009-10-29 13:31:47 UTC (rev 4808)
@@ -12,13 +12,11 @@
     gmirror list | grep "Name: ${DISK}" >/dev/null 2>/dev/null
     if [ "$?" = "0" ]
     then
-      echo "gmirror remove $gprov $DISK"
-      echo "gmirror remove $gprov $DISK" >>${LOGOUT} 2>>${LOGOUT}
-      gmirror remove $gprov $DISK >>${LOGOUT} 2>>${LOGOUT}
-      echo "dd if=/dev/zero of=/dev/${DISK} count=4096" >>${LOGOUT} 2>>${LOGOUT}
-      dd if=/dev/zero of=/dev/${DISK} count=4096 >>${LOGOUT} 2>>${LOGOUT}
-      fdisk -I /dev/${DISK} >>${LOGOUT} 2>>${LOGOUT}
-      dd if=/dev/zero of=/dev/${DISK} count=4096 >>${LOGOUT} 2>>${LOGOUT}
+      echo_log "gmirror remove $gprov $DISK"
+      rc_nohalt "gmirror remove $gprov $DISK"
+      rc_nohalt "dd if=/dev/zero of=/dev/${DISK} count=4096"
+      rc_nohalt "fdisk -I /dev/${DISK}"
+      rc_nohalt "dd if=/dev/zero of=/dev/${DISK} count=4096"
     fi
   done
 };
@@ -193,18 +191,18 @@
   fi
 
   #Erase any existing bootloader
-  echo "Wiping ${DISK} with dd" >>${LOGOUT}
-  dd if=/dev/zero of=/dev/${DISK} count=2048 >>${LOGOUT} 2>>${LOGOUT}
+  echo_log "Wiping ${DISK} with dd"
+  run_halt "dd if=/dev/zero of=/dev/${DISK} count=2048"
 
   sleep 2
 
-  echo "Running fdisk on ${DISK}" >>${LOGOUT} 
-  fdisk -I /dev/${DISK} >>${LOGOUT} 2>>${LOGOUT}
+  echo_log "Running fdisk on ${DISK}"
+  rc_halt "fdisk -I /dev/${DISK}"
 
   if [ "${BMANAGER}" = "bsd" ]
   then
-    echo "Stamping boot sector on ${DISK}" >>${LOGOUT}
-    gpart bootcode -b /boot/boot0 ${DISK} >>${LOGOUT} 2>>${LOGOUT}
+    echo_log "Stamping boot sector on ${DISK}"
+    rc_halt "gpart bootcode -b /boot/boot0 ${DISK}"
   fi
 
   slice="${DISK}s1"
@@ -271,20 +269,20 @@
   sleep 4
 
   # Install new partition setup
-  echo "Running fdisk on ${DISK}" >>${LOGOUT}
-  fdisk -f ${TMPDIR}/fdiskconfig /dev/${DISK} >>${LOGOUT} 2>>${LOGOUT}
+  echo_log "Running fdisk on ${DISK}"
+  rc_halt "fdisk -f ${TMPDIR}/fdiskconfig /dev/${DISK}"
   sleep 2
 
   # Clean up old partition
-  echo "Wiping $slice with dd" >>${LOGOUT}
-  dd if=/dev/zero of=/dev/${slice} count=1024 >>${LOGOUT} 2>>${LOGOUT}
+  echo_log "Wiping $slice with dd"
+  rc_halt "dd if=/dev/zero of=/dev/${slice} count=1024"
 
   sleep 1
 
   if [ "${BMANAGER}" = "bsd" ]
   then
-    echo "Stamping boot sector on ${DISK}" >>${LOGOUT}
-    gpart bootcode -b /boot/boot0 ${DISK} >>${LOGOUT} 2>>${LOGOUT}
+    echo_log "Stamping boot sector on ${DISK}"
+    rc_halt "gpart bootcode -b /boot/boot0 ${DISK}"
   fi
 
   # Lets save our slice, so we know what to look for in the config file later on
@@ -352,20 +350,20 @@
   echo "p       ${slicenum}     165     ${startblock}   ${sizeblock}" > ${TMPDIR}/fdiskconfig
 
   # Install new partition setup
-  echo "Running fdisk on ${DISK}" >>${LOGOUT}
-  fdisk -f ${TMPDIR}/fdiskconfig /dev/${DISK} >>${LOGOUT} 2>>${LOGOUT}
+  echo_log "Running fdisk on ${DISK}"
+  rc_halt "fdisk -f ${TMPDIR}/fdiskconfig /dev/${DISK}"
   sleep 2
 
   # Clean up old partition
-  echo "Wiping $slice with dd" >>${LOGOUT}
-  dd if=/dev/zero of=/dev/${slice} count=1024 >>${LOGOUT} 2>>${LOGOUT}
+  echo_log "Wiping $slice with dd"
+  rc_halt "dd if=/dev/zero of=/dev/${slice} count=1024"
 
   sleep 1
 
   if [ "${BMANAGER}" = "bsd" ]
   then
-    echo "Stamping boot sector on ${DISK}" >>${LOGOUT}
-    gpart bootcode -b /boot/boot0 ${DISK} >>${LOGOUT} 2>>${LOGOUT}
+    echo_log "Stamping boot sector on ${DISK}"
+    rc_halt "gpart bootcode -b /boot/boot0 ${DISK}"
   fi
 
   # Lets save our slice, so we know what to look for in the config file later on



More information about the Commits mailing list