diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2015-03-04 11:47:14 +0100 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2015-03-04 11:47:14 +0100 |
commit | 58e094786e4bdece2957d9f5c29a7445d08ae225 (patch) | |
tree | 5d3629c1b7b767f7530a73e4718be67467148110 | |
parent | 605fa687c3a78af2995deb65ee51568e3ffa5507 (diff) | |
download | xtools-58e094786e4bdece2957d9f5c29a7445d08ae225.tar.gz xtools-58e094786e4bdece2957d9f5c29a7445d08ae225.tar.xz xtools-58e094786e4bdece2957d9f5c29a7445d08ae225.zip |
xdistdir: detect git checkouts.
-rwxr-xr-x | xdistdir | 7 |
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 |