From: Ian Kelling Date: Thu, 3 Oct 2024 04:03:37 +0000 (-0400) Subject: fix bugs i introduced in refactoring X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=6f6383958a76eab439e158094f2049fd02655b20;p=distro-setup fix bugs i introduced in refactoring --- diff --git a/filesystem/usr/local/bin/mount-latest-subvol b/filesystem/usr/local/bin/mount-latest-subvol index 201d4dc..019d16a 100755 --- a/filesystem/usr/local/bin/mount-latest-subvol +++ b/filesystem/usr/local/bin/mount-latest-subvol @@ -151,10 +151,10 @@ get-btrfs-root-mountpoint() { fi } -# Input vars: $vol $root_dir (from get-btrfs-root-mountpoint) +# Input vars: $vol, PWD=$root_dir (from get-btrfs-root-mountpoint) expire-leaf-vols() { local leaf_vols count leaf_limit_time leaf_new_limit_time leaf - leaf_vols=($root_dir/$vol.leaf.*) + leaf_vols=($vol.leaf.*) count=${#leaf_vols[@]} leaf_limit_time=$(( EPOCHSECONDS - 60*60*24*60 )) # 60 days leaf_new_limit_time=$(( EPOCHSECONDS - 60*60*24 * 5 )) # 5 days @@ -162,7 +162,7 @@ expire-leaf-vols() { # This goes backwards from oldest. leaf_new_limit_time is to avoid # deleting very recent leafs. for leaf in ${leaf_vols[@]}; do - leaf_time=$(date -d ${leaf##"$vol".leaf.} +%s) + leaf_time=$(date -d ${leaf#$vol.leaf.} +%s) if (( leaf_limit_time > leaf_time || ( leaf_new_limit_time > leaf_time && count > 30 ) )); then b btrfs sub del $leaf fi @@ -455,7 +455,6 @@ plan-umounts() { to_umount=($dir) fi done - umount-dirs-add ${binds[@]} $d else mnt $d ${binds[@]} fi