diff options
author | Andrew Cady <d@jerkface.net> | 2023-06-06 11:01:31 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2023-06-06 11:01:31 -0400 |
commit | ec094adcdcc6826e6c814efac0205c2be859e08c (patch) | |
tree | 93f1510e1cf1ebb7a7b5b49cbd4e98dc48267c99 /list-all-subvolumes | |
parent | 362dd9f4432417929614f86dcc670146e963a0c5 (diff) |
fix rootfinding logic when readonly (-r) is specified (and therefore root subvolume will not be listed)
Diffstat (limited to 'list-all-subvolumes')
-rwxr-xr-x | list-all-subvolumes | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/list-all-subvolumes b/list-all-subvolumes index ec042c7..fc19b69 100755 --- a/list-all-subvolumes +++ b/list-all-subvolumes | |||
@@ -30,13 +30,22 @@ extract_subvolume_path() | |||
30 | [ "$path" != "$REPLY" ] | 30 | [ "$path" != "$REPLY" ] |
31 | path=${path#<FS_TREE>/} | 31 | path=${path#<FS_TREE>/} |
32 | 32 | ||
33 | abspath=$1/$path | 33 | tryroot=$1/$path |
34 | [ -d "$abspath" ] || exit | 34 | [ -d "$tryroot" ] || exit |
35 | 35 | ||
36 | if [ ! "$root" -a "$abspath" -ef / ] | 36 | while ! [ "$root" ] |
37 | then | 37 | do |
38 | root=$path | 38 | if [ / -ef "$tryroot" ] |
39 | fi | 39 | then |
40 | root=${tryroot#$1/} | ||
41 | break | ||
42 | elif [ "$tryroot" = / ] | ||
43 | then | ||
44 | break | ||
45 | else | ||
46 | tryroot=${tryroot%/*} | ||
47 | fi | ||
48 | done | ||
40 | case "$path" in | 49 | case "$path" in |
41 | "$root" | "$root"/*) path=$root/.${path#$root} ;; | 50 | "$root" | "$root"/*) path=$root/.${path#$root} ;; |
42 | esac | 51 | esac |