changeset 671:fda459e9515a

Autodetect the amount of space in a mini-native directory for genext2fs.
author Rob Landley <rob@landley.net>
date Sun, 29 Mar 2009 17:29:38 -0500
parents bf289e4e93de
children 0f998d17a7d5
files system-image.sh
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/system-image.sh	Sun Mar 29 16:06:29 2009 -0500
+++ b/system-image.sh	Sun Mar 29 17:29:38 2009 -0500
@@ -97,9 +97,11 @@
   echo "/dev d 755 0 0 - - - - -" > "$DEVLIST" &&
   echo "/dev/console c 640 0 0 5 1 0 0 -" >> "$DEVLIST" &&
 
-  # Produce 64 meg filesystem, which should always be big enough.
+  # Produce a filesystem with the currently used space plus 20% for filesystem
+  # overhead, which should always be big enough.
 
-  genext2fs -z -D "$DEVLIST" -d "$NATIVE_ROOT" -b 65536 -i 1024 \
+  genext2fs -z -D "$DEVLIST" -d "$NATIVE_ROOT" \
+    -b $[1024*(($(du -m -s "$NATIVE_ROOT" | awk '{print $1}')*12)/10)] -i 1024 \
     "$SYSIMAGE/$IMAGE" &&
   rm "$DEVLIST" || dienow