about summary refs log tree commit diff
path: root/xgensum
diff options
context:
space:
mode:
authorToyam Cox <Vaelatern@voidlinux.org>2019-08-25 00:33:27 -0400
committerLeah Neukirchen <leah@vuxu.org>2019-08-26 13:24:14 +0200
commitd6413190ff29a1753172b1634c88ea446ef89ad0 (patch)
tree9e2a3aed75f98970d1e5e6d46c6218477a174f76 /xgensum
parent18a6d45c6e396a452487c9df6d8957635b1a0d07 (diff)
downloadxtools-d6413190ff29a1753172b1634c88ea446ef89ad0.tar.gz
xtools-d6413190ff29a1753172b1634c88ea446ef89ad0.tar.xz
xtools-d6413190ff29a1753172b1634c88ea446ef89ad0.zip
xgensum: respect the -H flag
Closes: #147 [via git-merge-pr]
Diffstat (limited to 'xgensum')
-rwxr-xr-xxgensum16
1 files changed, 11 insertions, 5 deletions
diff --git a/xgensum b/xgensum
index 055239e..b9658dd 100755
--- a/xgensum
+++ b/xgensum
@@ -1,5 +1,5 @@
 #!/bin/bash
-# xgensum [-f] [-i] TEMPLATE - update SHA256 sums in templates
+# xgensum [-f] [-c] [-i] [-H hostdir] TEMPLATE - update SHA256 sums in templates
 
 case "$1" in
 	-f) FLAG_f=$1; shift
@@ -13,6 +13,12 @@ case "$1" in
 	-i*) FLAG_i=$1; shift
 esac
 
+case "$1" in
+	-H*) FLAG_h=$2; shift; shift
+esac
+
+: ${FLAG_h:=hostdir}
+
 XBPS_DISTDIR=$(xdistdir) || exit 1
 
 if [ -f "$1" ]; then
@@ -22,7 +28,7 @@ elif [ -f "$1/template" ]; then
 elif [ -f "$XBPS_DISTDIR/srcpkgs/$1/template" ]; then
 	template="$XBPS_DISTDIR/srcpkgs/$1/template"
 else
-	echo 'Usage: xgensum [-f] [-c] [-i] TEMPLATE' 1>&2
+	echo 'Usage: xgensum [-f] [-c] [-i] [-H hostdir] TEMPLATE' 1>&2
 	exit 1
 fi
 
@@ -33,7 +39,7 @@ if [ -f "${XBPS_DISTDIR}/common/environment/build-style/${build_style}.sh"  ]; t
 	. "${XBPS_DISTDIR}/common/environment/build-style/${build_style}.sh"
 fi
 
-XBPS_SRCDISTDIR=$("$XBPS_DISTDIR/xbps-src" show-var XBPS_SRCDISTDIR | tail -1)
+XBPS_SRCDISTDIR=$("$XBPS_DISTDIR/xbps-src" -H $FLAG_h show-var XBPS_SRCDISTDIR | tail -1)
 srcdir="$XBPS_SRCDISTDIR/$pkgname-$version"
 
 if [ "$FLAG_f" = -f ]; then
@@ -43,10 +49,10 @@ if [ "$FLAG_f" = -f ]; then
 		distfile="$srcdir/$curfile"
 		rm -vf "$distfile"
 	done
-	"$XBPS_DISTDIR/xbps-src" -I clean $pkgname
+	"$XBPS_DISTDIR/xbps-src" -H $FLAG_h -I clean $pkgname
 fi
 
-"$XBPS_DISTDIR/xbps-src" -I fetch $pkgname
+"$XBPS_DISTDIR/xbps-src" -H $FLAG_h -I fetch $pkgname
 
 sums=""
 for f in $distfiles; do