diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2012-05-14 15:29:47 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2012-05-14 16:38:17 +0100 |
commit | 2c7cd399c880d8ea9a93b685285947c370a20635 (patch) | |
tree | 2d86036a4714090bbb14c443bd028ed83a827f6e /scripts | |
parent | 68d045c68b51d1675b3aeb72c301b00a6af10021 (diff) | |
download | morph-2c7cd399c880d8ea9a93b685285947c370a20635.tar.gz |
scripts/list-tree: work with busybox find
busybox's find doesn't support -printf, so build that string in shell
to keep compatibility with old scripts, convert the type to the expected
short form
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/list-tree | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/scripts/list-tree b/scripts/list-tree index 2b3a6aa9..a1e2e8cb 100755 --- a/scripts/list-tree +++ b/scripts/list-tree @@ -20,6 +20,26 @@ set -eu +shorttype(){ + case "$*" in + "directory") + echo d + ;; + "regular file"|"regular empty file") + echo f + ;; + "symbolic link") + echo l + ;; + *) + echo "$*" >&2 + echo U + ;; + esac +} + export LC_ALL=C cd "$1" -find -printf '%y %p\n' | sort +find | while read file; do + printf "%s %s\n" "$(shorttype $(stat -c %F $file))" "$file"; +done | sort |