diff options
author | Xiao Pan <xyz@flylightning.xyz> | 2025-07-25 15:14:34 +0800 |
---|---|---|
committer | Xiao Pan <xyz@flylightning.xyz> | 2025-07-25 15:14:34 +0800 |
commit | 54fad638ff48f093a0063e72b53163df5ca53349 (patch) | |
tree | a592434965fa71eebf2be6f65f0c070e675fdd28 | |
parent | eefd237b94187071dedbd4928da985f2916684d7 (diff) |
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.
-rwxr-xr-x | sh/upd | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -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 |