rotational check fixed master v2.1
authorebelcrom <ebelcrom@gmail.com>
Fri, 13 Mar 2020 18:19:31 +0000 (19:19 +0100)
committerebelcrom <ebelcrom@gmail.com>
Fri, 13 Mar 2020 18:19:31 +0000 (19:19 +0100)
build.sh
rescuesys.sh

index 3438c67571ef08aae51c0be01e15381d8b08665d..f90a6c44ec297fe1c21b2e50d8e07077ec65fd77 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -74,16 +74,16 @@ create_VM()
 
        echo "Creating VM with VDI in ramfs..."
 
-  if [ $option_ramfs -eq 1 ]; then
-    local vdi_file=ramfs/rescuesys.vdi
-    local iso_file=ramfs/setup.iso
-       # create ramfs
-       sudo mount -t ramfs ramfs -o mode=1777 ramfs
-       cp setup.iso ramfs/
-  else
-    local vdi_file=rescuesys.vdi
-    local iso_file=setup.iso
-  fi
+       if [ $option_ramfs -eq 1 ]; then
+               local vdi_file=ramfs/rescuesys.vdi
+               local iso_file=ramfs/setup.iso
+               # create ramfs
+               sudo mount -t ramfs ramfs -o mode=1777 ramfs
+               cp setup.iso ramfs/
+       else
+               local vdi_file=rescuesys.vdi
+               local iso_file=setup.iso
+       fi
 
        # create and configure VM
        VBoxManage createvm --name rescuesys --register > /dev/null
@@ -126,11 +126,12 @@ create_image()
        echo "Creating image..."
 
        rm -f rescuesys.img
-  if [ $option_ramfs -eq 1 ]; then
-    local vdi_file=ramfs/rescuesys.vdi
-  else
-    local vdi_file=rescuesys.vdi
-  fi
+       if [ $option_ramfs -eq 1 ]; then
+               local vdi_file=ramfs/rescuesys.vdi
+       else
+               local vdi_file=rescuesys.vdi
+       fi
+       VBoxManage modifymedium disk $vdi_file --compact > /dev/null
        VBoxManage clonehd $vdi_file rescuesys.img --format RAW > /dev/null
        adapt_image
 }
index c998eb318602ed1b88f09edeae2741cfaf24ddfd..a854df8a139521dd58a5fd8f8f41587b406821ee 100755 (executable)
@@ -589,7 +589,8 @@ ext_cleanup()
         `" $3 läuft..." 8 56
 
        # SSD?
-       if [ $(cat /sys/block/${3%3}/queue/rotational) ]; then
+       local part=$(echo $3 | sed 's/[0-9]*$//')
+       if [ "$(cat /sys/block/${part}/queue/rotational)" == "0" ]; then
                # mount and use fstrim
                sudo mount -o ro /dev/$3 $INSP_DIR &>/dev/null
                sudo fstrim $INSP_DIR &>/dev/null