blob: a53fbf436e37146b00c544932a270118045f3626 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#!/bin/bash
# Build the SBo submission tarball SBo/<pkg>.tar.gz for one package.
# Same archive the post-commit hook produces, but on demand by name.
set -eu
usage() {
cat <<EOF
usage: ${0##*/} <package-name>
Build the SBo submission tarball <package-name>.tar.gz, the same archive the
post-commit hook produces, on demand by name. The package must exist in this
repo (<package-name>/<package-name>.SlackBuild). Any sbodl source symlinks in
the package directory are removed first so they never leak into the tarball.
Output goes to the current directory by default; set OUTPUT to override:
OUTPUT=/tmp ${0##*/} feroxbuster # writes /tmp/feroxbuster.tar.gz
EOF
}
case "${1:-}" in
-h|--help) usage; exit 0 ;;
esac
[ $# -eq 1 ] || { usage >&2; exit 2; }
pkg=$1
REPO_ROOT=$(git -C "$(dirname "$0")" rev-parse --show-toplevel)
# Where the tarball lands. Defaults to the current directory; override with
# the OUTPUT env var (e.g. OUTPUT=/tmp mksboarchive feroxbuster).
OUTPUT=${OUTPUT:-$PWD}
# Must be a real package dir one level deep with a matching .SlackBuild.
if [ ! -f "$REPO_ROOT/$pkg/$pkg.SlackBuild" ]; then
echo "error: '$pkg' is not a package in this repo." >&2
exit 1
fi
# Drop any sbodl source symlinks before archiving so they never end up in an
# SBo submission tarball (the pre-commit hook does the same for staged files).
find "$REPO_ROOT/$pkg" -type l -delete
mkdir -p "$OUTPUT"
tar -czf "$OUTPUT/$pkg.tar.gz" -C "$REPO_ROOT" "$pkg"
echo "Archive created: $OUTPUT/$pkg.tar.gz"
|