about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2014-09-15 02:06:31 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2014-09-15 02:06:31 +0200
commit62b3fdae6eece0c0fceec406c391f48b53e455a3 (patch)
tree43570c1da628a391e6b982b539736da0bae456b7
parentd3c6697735d9677ed14bc9e5d775982e193ae9d0 (diff)
downloadxtools-62b3fdae6eece0c0fceec406c391f48b53e455a3.tar.gz
xtools-62b3fdae6eece0c0fceec406c391f48b53e455a3.tar.xz
xtools-62b3fdae6eece0c0fceec406c391f48b53e455a3.zip
add xdistdir
-rw-r--r--README1
-rwxr-xr-xxdistdir19
2 files changed, 20 insertions, 0 deletions
diff --git a/README b/README
index 7143f75..9759e67 100644
--- a/README
+++ b/README
@@ -6,6 +6,7 @@ https://github.com/voidlinux/xbps
   xbulk [-n] [-k] [-xbps_src_flags] PKG... - simple XBPS bulk builder
   xbump PKGNAME [git commit options] - git commit a version bump
   xdiff [-u] [DIR] - merge XBPS .new-* files
+  xdistdir - figure out XBPS_DISTDIR
   xgensum [-i] TEMPLATE - update SHA256 sums in templates
   xgrep PATTERN PKGS... - search files limited to XBPS package contents
   xlg PKG - open short commit log for XBPS template
diff --git a/xdistdir b/xdistdir
new file mode 100755
index 0000000..ba1b14d
--- /dev/null
+++ b/xdistdir
@@ -0,0 +1,19 @@
+#!/bin/sh
+# xdistdir - figure out XBPS_DISTDIR
+
+if [ -n "$XBPS_DISTDIR" ]; then
+	echo "$XBPS_DISTDIR"
+elif [ -x "$(command -v xbps-src)" ]; then
+	"$(readlink -f "$(command -v xbps-src)")" show-var XBPS_DISTDIR | tail -1
+elif [ -d ~/void-packages ]; then
+	echo ~/void-packages
+elif [ -d ~/xbps-packages ]; then
+	echo ~/xbps-packages
+elif [ -d ~/src/void-packages ]; then
+	echo ~/src/void-packages
+elif [ -d ~/src/xbps-packages ]; then
+	echo ~/src/xbps-packages
+else
+	echo "xdistdir: no idea, giving up" 1>&2
+	exit 111
+fi