Explorar el Código

Meta: Run 'du' with '--apparent-size', except on macOS

Fixes #7172.
Siddharth Kapoor hace 4 años
padre
commit
dbd9d13857
Se han modificado 3 ficheros con 12 adiciones y 0 borrados
  1. 4 0
      Meta/build-image-extlinux.sh
  2. 4 0
      Meta/build-image-grub.sh
  3. 4 0
      Meta/build-image-qemu.sh

+ 4 - 0
Meta/build-image-extlinux.sh

@@ -25,7 +25,11 @@ if [ -z $syslinux_dir ]; then
 fi
 
 disk_usage() {
+if [ "$(uname -s)" = "Darwin" ]; then
     du -sm "$1" | cut -f1
+else
+    du -sm --apparent-size "$1" | cut -f1
+fi
 }
 
 DISK_SIZE=$(($(disk_usage "$SERENITY_SOURCE_DIR/Base") + $(disk_usage Root) + 300))

+ 4 - 0
Meta/build-image-grub.sh

@@ -24,7 +24,11 @@ fi
 echo "using grub-install at ${grub}"
 
 disk_usage() {
+if [ "$(uname -s)" = "Darwin" ]; then
     du -sm "$1" | cut -f1
+else
+    du -sm --apparent-size "$1" | cut -f1
+fi
 }
 
 DISK_SIZE=$(($(disk_usage "$SERENITY_SOURCE_DIR/Base") + $(disk_usage Root) + 300))

+ 4 - 0
Meta/build-image-qemu.sh

@@ -20,7 +20,11 @@ fi
 
 disk_usage() {
     # shellcheck disable=SC2003
+if [ "$(uname -s)" = "Darwin" ]; then
     expr "$(du -sk "$1" | cut -f1)" / 1024
+else
+    expr "$(du -sk --apparent-size "$1" | cut -f1)" / 1024
+fi
 }
 
 DISK_SIZE=$(($(disk_usage "$SERENITY_SOURCE_DIR/Base") + $(disk_usage Root) + 100))