]> git.plutz.net Git - blast/commitdiff
make sure umount does not run too early
authorPaul Hänsch <paul@plutz.net>
Sun, 14 Jun 2020 17:35:35 +0000 (19:35 +0200)
committerPaul Hänsch <paul@plutz.net>
Sun, 14 Jun 2020 17:35:35 +0000 (19:35 +0200)
Makefile

index 31f844eef8ada7307a9c9b3c1d38ede53efd3fe5..6c97122f826ea692a5dcae51f2510df16b5f4228 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -168,7 +168,7 @@ else ifdef raspi
   _copy: _install _img_mount
   _config: _copy _img_mount
   _bootloader_raspi: _img_mount
-  _umount: _img_mount _config _bootloader_raspi
+  _umount: _copy _config _bootloader_raspi
 
 else
   _target:
@@ -256,6 +256,8 @@ _install: ${SYSROOT} _aptkeys _norecommends
        chroot "$${SYSROOT}" rm /usr/sbin/udevadm
 
 _copy: ${SYSROOT} ${CFGROOT}
+       sync
+       find "$${SYSROOT}" -lname '' -exec ln -sf /dev/null '{}' \;
        cp -au "$${SYSROOT}/." "$${CFGROOT}/"
 
 _config: ${CFGROOT}
@@ -431,16 +433,17 @@ _img_mount: ${CFGROOT}
        mountpoint "$${CFGROOT}" \
        || mount -o loop,offset="$$((${BOOT_MB} + 2))"M,sizelimit=${ROOT_MB}M \
                 -t ${fstype} "$${VOLUME}" "$${CFGROOT}"
+       sync
        chmod 755 "$${CFGROOT}"
        mkdir -p -m 755 "$${CFGROOT}/boot"
        mountpoint "$${CFGROOT}/boot" \
        || mount -o loop,offset=2M,sizelimit=${BOOT_MB}M \
                 -t vfat "$${VOLUME}" "$${CFGROOT}/boot"
 
-_umount_boot: ${CFGROOT}
+_umount_boot: ${CFGROOT} _config
        -umount "$${CFGROOT}/boot"
 
-_umount_root: _umount_boot
+_umount_root: _umount_boot _config
        umount "$${CFGROOT}" && rmdir "$${CFGROOT}"
 
 _umount: _umount_boot _umount_root