about summary refs log tree commit diff
path: root/xgensum
diff options
context:
space:
mode:
Diffstat (limited to 'xgensum')
-rwxr-xr-xxgensum21
1 files changed, 17 insertions, 4 deletions
diff --git a/xgensum b/xgensum
index c22a43b..38b1136 100755
--- a/xgensum
+++ b/xgensum
@@ -1,5 +1,9 @@
 #!/bin/bash
-# xgensum [-i] TEMPLATE - update SHA256 sums in templates
+# xgensum [-f] [-i] TEMPLATE - update SHA256 sums in templates
+
+case "$1" in
+	-f) f=$1; shift
+esac
 
 case "$1" in
 	-i*) i=$1; shift
@@ -8,17 +12,26 @@ esac
 if [ -f $1 ]; then
 	. "$1"
 elif [ -f $1/template ]; then
-	exec "$0" $i "$1/template"
+	exec "$0" $f $i "$1/template"
 elif [ -f template ]; then
-	exec "$0" $i template
+	exec "$0" $f $i template
 else
-	echo Usage: gensum TEMPLATE
+	echo 'Usage: xgensum [-f] [-i] TEMPLATE'
 fi
 
 XBPS_DISTDIR=$(xdistdir)
 XBPS_SRCDISTDIR=$($XBPS_DISTDIR/xbps-src show-var XBPS_SRCDISTDIR | tail -1)
 srcdir="$XBPS_SRCDISTDIR/$pkgname-$version"
 
+if [ "$f" = -f ]; then
+	for f in $distfiles; do
+		curfile=$(basename "${f#*>}")
+		distfile="$srcdir/$curfile"
+		rm -vf "$distfile"
+	done
+	$XBPS_DISTDIR/xbps-src -I clean $pkgname
+fi
+
 $XBPS_DISTDIR/xbps-src -I fetch $pkgname
 
 sums=""