[PC-BSD Commits] r17383 - pcbsd/current/src-sh/pc-updatemanager/scripts

svn at pcbsd.org svn at pcbsd.org
Fri Jun 22 06:07:14 PDT 2012


Author: kris
Date: 2012-06-22 13:07:12 +0000 (Fri, 22 Jun 2012)
New Revision: 17383

Modified:
   pcbsd/current/src-sh/pc-updatemanager/scripts/mu-stage1
   pcbsd/current/src-sh/pc-updatemanager/scripts/mu-stage2
Log:

Add some logging to the system upgrade process, so we can pick apart 
any errors post-upgrade



Modified: pcbsd/current/src-sh/pc-updatemanager/scripts/mu-stage1
===================================================================
--- pcbsd/current/src-sh/pc-updatemanager/scripts/mu-stage1	2012-06-22 12:09:06 UTC (rev 17382)
+++ pcbsd/current/src-sh/pc-updatemanager/scripts/mu-stage1	2012-06-22 13:07:12 UTC (rev 17383)
@@ -8,6 +8,8 @@
 DOWNLOADDIR="/usr/local/tmp"
 STAGEDIR="${DOWNLOADDIR}/update-stagedir"
 UPVER=`cat ${STAGEDIR}/sys-ver`
+LOGFILE="/root/pcbsd-system-upgrade.log"
+echo "Starting system upgrade to $UPVER - `date`" >${LOGFILE}
 
 clear
 
@@ -55,6 +57,7 @@
 
 # Start extracting the boot
 echo -e "Extracting kernel and boot environment...\c"
+echo "Extracting kernel and boot environment..." >>${LOGFILE}
 cd /
 
 # Backup the old kernel
@@ -63,7 +66,7 @@
 echo -e ".\c"
 
 mkdir /.boot-tmp
-tar xvpf ${STAGEDIR}/PCBSD.txz -C /.boot-tmp ./boot >/dev/null 2>/dev/null
+tar xvpf ${STAGEDIR}/PCBSD.txz -C /.boot-tmp ./boot >/dev/null 2>>${LOGFILE}
 if [ $? -eq 0 ] ; then
   echo -e ".\c"
 else
@@ -75,7 +78,8 @@
 rm /.boot-tmp/boot/loader.conf
 rm /.boot-tmp/boot/device.hints
 
-tar cvf - -C /.boot-tmp/boot . 2>/dev/null | tar xvf - -C /boot >/dev/null 2>/dev/null
+echo "Copying kernel and boot environment..." >>${LOGFILE}
+tar cvf - -C /.boot-tmp/boot . 2>/dev/null | tar xvf - -C /boot >/dev/null 2>>${LOGFILE}
 if [ $? -eq 0 ] ; then
   echo "DONE"
 else
@@ -88,6 +92,7 @@
 
 # Start extracting the updated world now
 echo -e "Extracting updated world environment...\c"
+echo "Extracting updated world environment..." >>${LOGFILE}
 cd /
 
 # Need to set noschg on some directories / files
@@ -100,7 +105,7 @@
 # Exclude ./boot in extract, already done
 echo "./boot" >> ${STAGEDIR}/xtra-data/upgrade-excludes
 
-tar xvpf ${STAGEDIR}/PCBSD.txz -X ${STAGEDIR}/xtra-data/upgrade-excludes >/dev/null 2>/dev/null
+tar xvpf ${STAGEDIR}/PCBSD.txz -X ${STAGEDIR}/xtra-data/upgrade-excludes >/dev/null 2>>${LOGFILE}
 if [ $? -eq 0 ] ; then
   echo "DONE"
 else
@@ -135,6 +140,7 @@
 cd /
 if [ -e "${STAGEDIR}/upgrade-merges" ] ; then
   echo -e "Merging changes...\c"
+  echo "Merging changes..." >>${LOGFILE}
 
   # Extract the new files into a tmpdir
   mkdir /tmp/merge-files.$$
@@ -164,6 +170,7 @@
       if [ $? -eq 0 ] ; then continue ; fi 
       
       # Add the new key to the merge file
+      echo "Adding: $mLine -> ${mFile}" >>${LOGFILE}
       echo $mLine >> ${mFile}
       echo -e ".\c"
     done < /tmp/merge-files.$$/$mFile

Modified: pcbsd/current/src-sh/pc-updatemanager/scripts/mu-stage2
===================================================================
--- pcbsd/current/src-sh/pc-updatemanager/scripts/mu-stage2	2012-06-22 12:09:06 UTC (rev 17382)
+++ pcbsd/current/src-sh/pc-updatemanager/scripts/mu-stage2	2012-06-22 13:07:12 UTC (rev 17383)
@@ -7,6 +7,7 @@
 DOWNLOADDIR="/usr/local/tmp"
 STAGEDIR="${DOWNLOADDIR}/update-stagedir"
 UPVER=`cat ${STAGEDIR}/sys-ver`
+LOGFILE="/root/pcbsd-system-upgrade.log"
 
 clear
 
@@ -17,6 +18,7 @@
 
 # Install new pkgs
 echo "Installing system packages..."
+echo "Installing system packages..." >>${LOGFILE}
 cd "${STAGEDIR}/packages"
 for i in `ls *.txz`
 do
@@ -27,8 +29,13 @@
   printf "%-${length}s\r" "${i}"
   length=${#i}
 
-  pkg_add -f "$i" >/dev/null 2>/dev/null
+  pkg_add -f "$i" >/tmp/pkg-out 2>/tmp/pkg-out
+  if [ $? -ne 0 ] ; then
+     echo "Failed adding: ${i}" >>${LOGFILE}
+     cat /tmp/pkg-out >>${LOGFILE}
+  fi
 done
+rm /tmp/pkg-out
 
 # Load any nvidia drivers last
 for i in `ls *nvidia*.txz`



More information about the Commits mailing list