aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-09-21 17:59:36 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-09-21 17:59:36 -0300
commitf869a4f6d28bc467cfb3b6c8ff664e4414b38e7c (patch)
tree5b80b69df2fd0349ac4ac2fa840fa85697cc284e
parent7ab120aab5c6f25e6d38c1b8bd0dcdc011e7876d (diff)
downloadstowpkg-f869a4f6d28bc467cfb3b6c8ff664e4414b38e7c.tar.gz
stowpkg-f869a4f6d28bc467cfb3b6c8ff664e4414b38e7c.tar.bz2
Adds stowpkg_list
-rwxr-xr-xstowpkg18
1 files changed, 17 insertions, 1 deletions
diff --git a/stowpkg b/stowpkg
index 739784c..1b0538e 100755
--- a/stowpkg
+++ b/stowpkg
@@ -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