Commit Diff


commit - 03bbf9746e218bbdabb066cab0d46f9f2a1db411
commit + 9362f1cc9a0d12cc6d3db69691dd449606409504
blob - f1f5576a2241656cb1d22c1b097f68517ab7676e
blob + f9047a0cf38c2bd1fc0de6213d623c6f3a5f8bbf
--- Makefile
+++ Makefile
@@ -8,8 +8,9 @@ all:
 install:
 	mkdir -p ${DESTDIR}${PREFIX}/bin ${DESTDIR}${MANPREFIX}/man1
 	sed 's/@VERSION@/${VERSION}/' got-archive > ${DESTDIR}${PREFIX}/bin/got-archive
-	chmod 755 ${DESTDIR}${PREFIX}/bin/
-	cp -f got-archive.1 ${DESTDIR}${MANPREFIX}/man1/
+	sed 's/@VERSION@/${VERSION}/' got-archive-all > ${DESTDIR}${PREFIX}/bin/got-archive-all
+	chmod 755 ${DESTDIR}${PREFIX}/bin/got-archive ${DESTDIR}${PREFIX}/bin/got-archive-all
+	cp -f got-archive.1 got-archive-all.1 ${DESTDIR}${MANPREFIX}/man1/
 
 uninstall:
 	rm -f ${DESTDIR}${PREFIX}/bin/got-archive
blob - c950a53c3e2acfd1120f7fe07d73eaf61c08a976
blob + 562e7d042f4ea2940fa994c38d2bca173b307eef
--- got-archive
+++ got-archive
@@ -56,7 +56,7 @@ done
 [ $# -ne 1 ] && usage
 
 repo=$1
-name=$(basename "$repo" | sed 's/\.git$//')
+name=$(basename "$repo" .git)
 if [ "$strip" = 1 ]; then
 	ver=$(echo "$branch" | sed 's/^v//g')
 else
blob - /dev/null
blob + 402a7ba1b83797447f45932299ebb64f0a102817 (mode 755)
--- /dev/null
+++ got-archive-all
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+die() {
+	ec=$1
+	shift
+	echo "$@" >&2
+	exit "$ec"
+}
+
+usage() {
+	die 1 "Usage: got-archive-all [-sV] [-o outdir] [-t tmpdir] prefix"
+}
+
+args=$(getopt o:st:V $*)
+[ $? -ne 0 ] && usage
+
+set -- $args
+
+flags=
+while [ $# -ne 0 ]; do
+	case "$1" in
+	-o)
+		flags="$flags -o $2"
+		shift
+		shift
+		;;
+	-s)
+		flags="$flags -s"
+		shift
+		;;
+	-t)
+		flags="$flags -t $2"
+		shift
+		shift
+		;;
+	-V)
+		echo "got-archive-all-@VERSION@"
+		exit 1
+		;;
+	--)
+		shift
+		break
+		;;
+	esac
+done
+
+[ $# -ne 1 ] && usage
+
+prefix=$1
+
+printf 'flags=%s\n' "$flags"
+
+for repo in "$prefix"/*.git; do
+	[ -d "$repo/refs/tags" ] || continue
+
+	for tag in "$repo"/refs/tags/*; do
+		tag=$(basename "$tag")
+
+		got-archive $flags -b "$tag" "$repo"
+	done
+done
blob - /dev/null
blob + e20a780fc790c6d9bff0126efee49cc9c79c610e (mode 644)
--- /dev/null
+++ got-archive-all.1
@@ -0,0 +1,61 @@
+.\"
+.\" Copyright (c) 2023 Benjamin Stürz
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd $Mdocdate$
+.Dt GOT-ARCHIVE-ALL 1
+.Os
+.Sh NAME
+.Nm got-archive-all
+.Nd run got-archive(1) on all repositories
+.Sh SYNOPSIS
+.Nm got-archive-all
+.Op Fl sV
+.Op Fl o Ar outdir
+.Op Fl t Ar tmpdir
+.Ar directory
+.Sh DESCRIPTION
+.Nm
+runs
+.Xr got-archive 1
+on all repositories in
+.Ar directory .
+.Pp
+The options are as follows:
+.Bl -tag -width -Ds
+.It Fl o Ar outdir
+An existing directory in which the tarball will be created.
+By default, this will be the current working directory.
+.It Fl s
+Strip a preceding "v" from the
+.Ar branch/tag .
+.It Fl t Ar tmpdir
+A temporary directory used for the checkout.
+By default, this will be
+.Ar /tmp/got-archive .
+.It Fl V
+Print the version of got-archive(1) and exit.
+.Sh EXIT STATUS
+.Ex -std got-archive-all
+.Sh EXAMPLES
+Create tarballs for all repositories in
+.Pa /var/git
+and put them into
+.Pa /mnt .
+.Pp 
+.Dl $ got-archive-all -s -o /mnt /var/git
+.Sh SEE ALSO
+.Xr got-archive 1
+.Sh AUTHORS
+.An Benjamin Stürz Aq Mt benni@stuerz.xyz