r3581 - jhalfs/branches/ablfs/common

pierre at linuxfromscratch.org pierre at linuxfromscratch.org
Tue Feb 28 10:12:17 PST 2012


Author: pierre
Date: 2012-02-28 11:12:12 -0700 (Tue, 28 Feb 2012)
New Revision: 3581

Modified:
   jhalfs/branches/ablfs/common/create-sbu_du-report.sh
Log:
merge create-sbu-report.sh from trunk

Modified: jhalfs/branches/ablfs/common/create-sbu_du-report.sh
===================================================================
--- jhalfs/branches/ablfs/common/create-sbu_du-report.sh	2012-02-28 13:20:40 UTC (rev 3580)
+++ jhalfs/branches/ablfs/common/create-sbu_du-report.sh	2012-02-28 18:12:12 UTC (rev 3581)
@@ -51,7 +51,8 @@
 BUILDLOGS="`grep -l "^Totalseconds:" ${LOGSDIR}/*`"
 
 # Match the first timed log to extract the SBU unit value from it
-BASELOG=`grep -l "^Totalseconds:" $LOGSDIR/* | head -n1`
+FIRSTLOG=`grep -l "^Totalseconds:" $LOGSDIR/* | head -n1`
+BASELOG=`grep -l "^Totalseconds:" $LOGSDIR/???-binutils* | head -n1`
 echo -e "\nUsing ${BASELOG#*[[:digit:]]-} to obtain the SBU unit value."
 SBU_UNIT=`sed -n 's/^Totalseconds:\s\([[:digit:]]*\)$/\1/p' $BASELOG`
 echo -e "\nThe SBU unit value is equal to $SBU_UNIT seconds.\n"
@@ -91,7 +92,7 @@
 
 # Append installed files disk usage to the previous entry,
 # except for the first parsed log
-  if [ "$log" != "$BASELOG" ] ; then
+  if [ "$log" != "$FIRSTLOG" ] ; then
     INSTALL=`perl -e 'print ('$DU1' - '$DU1PREV')';`
     INSTALLMB=`perl -e 'printf "%.3f" , ('$DU1MB' - '$DU1MBPREV')';`
     echo -e "Installed files disk usage:\t\t\t\t$INSTALL KB or $INSTALLMB MB\n" >> $REPORT
@@ -115,6 +116,18 @@
 
 done
 
+# For printing the last 'Installed files disk usage', we need to 'du' the
+# root dir, excluding the jhalfs directory (and lost+found). We assume
+# that the rootdir is $LOGSDIR/../..
+DU1=`du -skx --exclude=jhalfs --exclude=lost+found $LOGSDIR/../.. | cut -f1`
+DU1MB=`perl -e 'printf "%.3f" , ('$DU1' / '1024')';`
+INSTALL=`perl -e 'print ('$DU1' - '$DU1PREV')';`
+INSTALLMB=`perl -e 'printf "%.3f" , ('$DU1MB' - '$DU1MBPREV')';`
+echo -e "Installed files disk usage:\t\t\t\t$INSTALL KB or $INSTALLMB MB\n" >> $REPORT
+# Append install values for grand total
+INSTALL2=`perl -e 'printf "%.3f" , ('$INSTALL2' + '$INSTALL')';`
+INSTALLMB2=`perl -e 'printf "%.3f" , ('$INSTALLMB2' + '$INSTALLMB')';`
+
 # Dump grand totals
 echo -e "\n$LINE\n\nTotal time required to build the systen:\t\t$SBU2  SBU" >> $REPORT
 # Total disk usage: including /tools but not /sources.




More information about the alfs-log mailing list