Skip to content

Commit

Permalink
pkg: add example script to create tarball with submodules instantiated
Browse files Browse the repository at this point in the history
In preparation for packaging of tls_wolfssl, add an example script to
create source tarball with submodule code.
  • Loading branch information
space88man authored and miconda committed Oct 6, 2023
1 parent a3fd3b1 commit aed35dd
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions pkg/scripts/git-archive-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
# packaging script to include submodules
# modified from: https://gist.github.com/arteymix/03702e3eb05c2c161a86b49d4626d21f
# Usage: pkg/scripts/git-archive-all.sh kamailio-5.8.0 ../output/kamailio-5.8.0_src

usage() {
echo Usage: pkg/scripts/git-archive-all.sh kamailio-5.8.0 ../output/kamailio-5.8.0_src
}

if [ -z $1 ]; then
echo "You must specify a prefix name."
usage
exit 1
fi

if [ -z $2 ]; then
echo "You must specify a super-archive name."
usage
exit 1
fi

git archive --prefix "$1/" -o "$2.tar" HEAD
git submodule foreach --recursive "git archive --prefix=$1/\$sm_path/ --output=\$sha1.tar HEAD && tar --concatenate --file=$(pwd)/$2.tar \$sha1.tar && rm \$sha1.tar"

gzip "$2.tar"

0 comments on commit aed35dd

Please sign in to comment.