tools/livecd-iso-to-disk.sh |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

New commits:
commit 1612a5bf3f7683246df07a81081afe180636156a
Author: Brian C. Lane <[email protected]>
Date:   Fri May 31 10:22:50 2013 -0700

    Replace bash string parsing with awk (#962039)
    
    du in F19 adds a - at the end now, confusing the parsing. Replaced it
    and a couple other instances with awk so that it is more clear what is
    happening.

diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index eb7c3cc..23612ea 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -941,8 +941,8 @@ if [[ live == $srctype ]]; then
    targets="$TGTMNT/$SYSLINUXPATH"
    [[ -n $efi ]] && targets+=" $TGTMNT$EFI_BOOT"
    [[ -n $xo ]] && targets+=" $TGTMNT/boot/olpc.fth"
-   duTable=($(du -c -B 1M $targets 2> /dev/null || :))
-   tbd=$((tbd + ${duTable[*]: -2:1}))
+   target_size=$(du -s -c -B 1M $targets 2> /dev/null | awk '/total$/ {print 
$1;}') || :
+   tbd=$((tbd + target_size))
 fi
 
 if [[ -n $skipcompress ]] && [[ -s $SRCMNT/LiveOS/squashfs.img ]]; then
@@ -973,12 +973,11 @@ if [[ live == $srctype ]]; then
     sources+=" $SRCMNT/isolinux $SRCMNT/syslinux"
     [[ -n $efi ]] && sources+=" $SRCMNT$EFI_BOOT"
     [[ -n $xo ]] && sources+=" $SRCMNT/boot/olpc.fth"
-    duTable=($(du -c -B 1M "$thisScriptpath" $sources 2> /dev/null || :))
-    livesize=$((livesize + ${duTable[*]: -2:1}))
+    source_size=$(du -s -c -B 1M "$thisScriptpath" $sources 2> /dev/null | awk 
'/total$/ {print $1;}') || :
+    livesize=$((livesize + source_size))
 fi
 
-freespace=($(df -B 1M --total $TGTDEV))
-freespace=${freespace[*]: -2:1}
+freespace=$(df -B 1M --total $TGTDEV | awk '/^total/ {print $4;}')
 
 if [[ live == $srctype ]]; then
     tba=$((overlaysizemb + homesizemb + livesize + swapsizemb))


--
livecd mailing list
[email protected]
https://admin.fedoraproject.org/mailman/listinfo/livecd

Reply via email to