diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2017-09-21 17:59:36 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2017-09-21 17:59:36 -0300 |
commit | f869a4f6d28bc467cfb3b6c8ff664e4414b38e7c (patch) | |
tree | 5b80b69df2fd0349ac4ac2fa840fa85697cc284e | |
parent | 7ab120aab5c6f25e6d38c1b8bd0dcdc011e7876d (diff) | |
download | stowpkg-f869a4f6d28bc467cfb3b6c8ff664e4414b38e7c.tar.gz stowpkg-f869a4f6d28bc467cfb3b6c8ff664e4414b38e7c.tar.bz2 |
Adds stowpkg_list
-rwxr-xr-x | stowpkg | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -67,7 +67,7 @@ __stowpkg_initialize () { export BASE="$BASE" export PORTS="$PORTS" export SOURCES="$SOURCES" - export BASE="$BINARIES" + export BINARIES="$BINARIES" } stowpkg_usage () { @@ -215,6 +215,22 @@ stowpkg_build () { fi } +stowpkg_list () { + local pattern="$1" + + if [ ! -z "$pattern" ]; then + local name="-name \'*$pattern*\'" + fi + + find $BASE -type l | while read file; do + dest="`stat $file | head -n 1 | cut -d '>' -f 2 | sed -e 's/ //'`" + + if echo $dest | grep -q "^stow/" || echo $dest | grep -q "/stow/"; then + echo $dest | sed -e 's|.*stow/\(.*\)/.*|\1|' + fi + done | sort | uniq +} + # Dispatch if grep -q "^stowpkg_$ACTION () {$" $0; then __stowpkg_initialize |