]> gitweb.fluxo.info Git - stowpkg.git/commitdiff
Adds stowpkg_list
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 21 Sep 2017 20:59:36 +0000 (17:59 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 21 Sep 2017 20:59:36 +0000 (17:59 -0300)
stowpkg

diff --git a/stowpkg b/stowpkg
index 739784ccfe741d22bf0c4457352355aae950d095..1b0538edb36cab032b882f7e39ca990467b1c7f4 100755 (executable)
--- 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