aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xbosun15
1 files changed, 8 insertions, 7 deletions
diff --git a/bosun b/bosun
index d8d0168..5d651a3 100755
--- a/bosun
+++ b/bosun
@@ -61,13 +61,14 @@ list() {
}
list_active() {
- # Note: we de not escape any special characters in $STOW_DIR since it is
- # assumed we are in full control of its contents.
- # XXX: -r for xargs is a GNU extension
- find "$STOW_DIR/.." -type l -print0 2>/dev/null \
- | xargs -r0 readlink -f \
- | sed -n ":^$STOW_DIR: s:^$STOW_DIR/\([^/]\+\)/.*:\1:p" \
- | sort -u
+ real=$(realpath "$STOW_DIR")
+ cd "$STOW_DIR/.." || exit 1
+
+ # XXX: GNU extensions: -print0 for find, -r -0 for xargs
+ # XXX: GNU only: realpath
+ find -type l -print0 2>/dev/null \
+ | xargs -r0 realpath -e --relative-base "$real" 2>/dev/null \
+ | sed '/^\//d' | cut -d/ -f1 | sort -u
}
list_all() {