summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiao Pan <xyz@flylightning.xyz>2025-07-25 15:14:34 +0800
committerXiao Pan <xyz@flylightning.xyz>2025-07-25 15:14:34 +0800
commit54fad638ff48f093a0063e72b53163df5ca53349 (patch)
treea592434965fa71eebf2be6f65f0c070e675fdd28
parenteefd237b94187071dedbd4928da985f2916684d7 (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-xsh/upd12
1 files 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