From 6f6383958a76eab439e158094f2049fd02655b20 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Thu, 3 Oct 2024 00:03:37 -0400 Subject: [PATCH] fix bugs i introduced in refactoring --- filesystem/usr/local/bin/mount-latest-subvol | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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 -- 2.30.2