summaryrefslogtreecommitdiffstats
path: root/dist.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 21:30:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 21:30:40 +0000
commit133a45c109da5310add55824db21af5239951f93 (patch)
treeba6ac4c0a950a0dda56451944315d66409923918 /dist.sh
parentInitial commit. (diff)
downloadrspamd-133a45c109da5310add55824db21af5239951f93.tar.xz
rspamd-133a45c109da5310add55824db21af5239951f93.zip
Adding upstream version 3.8.1.upstream/3.8.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dist.sh')
-rwxr-xr-xdist.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/dist.sh b/dist.sh
new file mode 100755
index 0000000..12e05a2
--- /dev/null
+++ b/dist.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+# Creates a tarball with the concatenation of a git tree and the submodules.
+# Hidden files such as .gitignore are skipped.
+
+# GNU tar
+TAR=${2:-"tar"}
+
+if [ $# -lt 1 ] ; then
+ echo "Usage: dist.sh <filename> [tar_command]"
+ exit 1
+fi
+
+FNAME=$1
+PREFIX=`basename $FNAME | sed -e 's/\.tar.*$//'`
+
+ALL_TAR=$(mktemp) || { echo "mktemp is missing!"; exit 1; }
+TMP_TAR=$(mktemp) || { echo "mktemp is missing!"; exit 1; }
+trap 'rm -f "$TMP_TAR" "$ALL_TAR"' EXIT
+
+# Create tarball for main repo contents.
+git archive --prefix="$PREFIX/" HEAD ":!.*" ":!**/.*" > "$ALL_TAR"
+
+# Append submodule contents, if any.
+export PREFIX TMP_TAR ALL_TAR
+git submodule --quiet foreach --recursive \
+ 'git archive --prefix="$PREFIX/$displaypath/" HEAD ":!.*" ":!**/.*" > "$TMP_TAR";
+ tar Af "$ALL_TAR" "$TMP_TAR"'
+
+xz < "$ALL_TAR" > "$FNAME"