about summary refs log tree commit diff
path: root/xdistdir
blob: 4fdee687d92845f562038a19e55b19820f1a49cb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
# xdistdir - figure out 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
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
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: can't find your void-packages tree, giving up" 1>&2
	echo "xdistdir: please export XBPS_DISTDIR=/path/to/void-packages" 1>&2
	exit 111
fi