X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=mount-latest-subvol;h=e4c4d6b0a652b992f6feb7483cecd394bbf1040c;hb=d46190aff6f5dc65bd39524e3937dc5765895b42;hp=6bf68d703b7f90b3a2379ceeeca1335991afcfc6;hpb=a5ab31675fd4b19fb5dcd32987c3323f0686fed0;p=distro-setup diff --git a/mount-latest-subvol b/mount-latest-subvol index 6bf68d7..e4c4d6b 100644 --- a/mount-latest-subvol +++ b/mount-latest-subvol @@ -91,9 +91,14 @@ $first_root_crypt /o btrfs noatime,subvol=o 0 0 EOF ;; esac +if [[ $HOSTNAME == frodo ]]; then + tu /etc/fstab </dev/null; then continue @@ -141,11 +146,23 @@ for vol in q a o; do if e umount -R $dir; then unmounted+=($dir) else - umount_ret=false - ret=1 echo "$0: failed to umount $dir" - e lsof $dir - break + # lsof will fail if it finds no pids + if ! e lsof $dir; then + umount_ret=false + ret=1 + continue + fi + pids=$(lsof -t $dir) ||: + kill $pids + sleep .5 + if e umount -R $dir; then + unmounted+=($dir) + else + umount_ret=false + ret=1 + continue + fi fi fi done