about summary refs log tree commit diff
path: root/xdistdir
diff options
context:
space:
mode:
Diffstat (limited to 'xdistdir')
-rwxr-xr-xxdistdir7
1 files changed, 5 insertions, 2 deletions
diff --git a/xdistdir b/xdistdir
index ba1b14d..01e4c02 100755
--- a/xdistdir
+++ b/xdistdir
@@ -1,8 +1,11 @@
 #!/bin/sh
 # xdistdir - figure out XBPS_DISTDIR
 
-if [ -n "$XBPS_DISTDIR" ]; then
-	echo "$XBPS_DISTDIR"
+git_xbps_src="./$(git rev-parse --show-cdup 2>/dev/null)/xbps-src"
+if [ -x "$git_xbps_src" ]; then
+	"$(readlink -f "$git_xbps_src")" show-var XBPS_DISTDIR | tail -1
+elif [ -n "$XBPS_DISTDIR" ]; then
+	printf '%s\n' "$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