From d6413190ff29a1753172b1634c88ea446ef89ad0 Mon Sep 17 00:00:00 2001 From: Toyam Cox Date: Sun, 25 Aug 2019 00:33:27 -0400 Subject: xgensum: respect the -H flag Closes: #147 [via git-merge-pr] --- xgensum | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'xgensum') 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 -- cgit 1.4.1