From 54fad638ff48f093a0063e72b53163df5ca53349 Mon Sep 17 00:00:00 2001 From: Xiao Pan Date: Fri, 25 Jul 2025 15:14:34 +0800 Subject: upd use umount and cryptsetup close instead of udiskie-umount Also use df -P consider portability. Not using udiskie-umount because when sync take too long, it will timeout and exit the command with warnings before sync is compelete and run next command, which is not what I want, more see vc notes. --- sh/upd | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sh/upd b/sh/upd index cc9dd46..39c6ac6 100755 --- a/sh/upd +++ b/sh/upd @@ -87,7 +87,15 @@ backup () { rsync -avP --delete "$HOME/backup/ib/" "/run/media/xyz/bd0/ib" # backup pp rsync -avP --delete "$HOME/backup/pp/" "/run/media/xyz/bd0/pp" - udiskie-umount --detach --force /run/media/xyz/bd0 + + # busybox df if filesystem name too long, it will put the filesystem + # name in a separate line which nornally is in the second line and + # there's total three lines. So I use df -P option which seems busybox + # will also not put filesystem name in a separate line and behave same + # as gnu df. + bd0_fs_name="$(df -P /run/media/xyz/bd0 | awk 'END{print $1}')" + umount /run/media/xyz/bd0 + sudo cryptsetup close "$bd0_fs_name" alarm 0 'Unplug external HDD' # duplicity backup to ib @@ -337,7 +345,7 @@ monthly_misc () { # need to be after `wait`, because checksum need to be at ventoy dir cd || exit - disk="$(df /run/media/xyz/Ventoy/ | awk 'END{sub(/[[:digit:]]+$/,"",$1);print $1}')" + disk="$(df -P /run/media/xyz/Ventoy/ | awk 'END{sub(/[[:digit:]]+$/,"",$1);print $1}')" sudo ventoy -l "$disk" | awk '/Ventoy:/{a=$2} /Ventoy Version in Disk:/{b=$NF;exit} END{exit((a==b)?1:0)}' && echo y | sudo ventoy -u "$disk" umount /run/media/xyz/Ventoy /run/media/xyz/FAT32DIR -- cgit v1.2.3-70-g09d2