aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2021-04-05 13:24:41 +0000
committermerakor <cem@ckyln.com>2021-04-05 13:24:41 +0000
commitadf8586a8ae301d651108eabc2dc790655258c3b (patch)
treed32d755546ecf17bfdd390a03a569bbfe1a3b169 /tools
parent8c9802d5a70273d87dfa0c3530db7539082cc346 (diff)
downloadcpt-adf8586a8ae301d651108eabc2dc790655258c3b.tar.gz
Use fossil backend for creating distribution tarballs
FossilOrigin-Name: 3414a848d04d4222850ff96caf2bcdab0a1876855ed821af9257f70e583f60c9
Diffstat (limited to 'tools')
-rwxr-xr-xtools/mkdist.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/mkdist.sh b/tools/mkdist.sh
new file mode 100755
index 0000000..c21e964
--- /dev/null
+++ b/tools/mkdist.sh
@@ -0,0 +1,30 @@
+#!/bin/sh -e
+
+out() { printf '%s\n' "$@" >&2 ;}
+die() { printf '\033[1;31mERR: \033[m%s\n' "$@" >&2; exit 1;}
+
+case "$1" in ''|-*)
+ die "Run this script by calling 'make dist' from the" \
+ "root repository directory"
+esac
+
+fossil stat >/dev/null 2>&1 || {
+ printf '\033[1;31mERR: \033[m%s\n' \
+ "Distribution tarballs can only be generated using the Fossil repository." \
+ "Exiting..." >&2
+ exit 1
+}
+
+basedir=cpt-$1
+mkdir -p "$basedir"
+
+fossil ls | while read -r file; do
+ case "$file" in
+ */*) mkdir -p "$basedir/${file%/*}"
+ esac
+ cp "$file" "$basedir/$file"
+done
+
+tar cf "$basedir.tar" "$basedir"
+xz -z "$basedir.tar"
+rm -rf -- "$basedir"