-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathmktar.sh
executable file
·31 lines (27 loc) · 1 KB
/
mktar.sh
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
#!/usr/bin/env bash
# Create a git archive that includes an expanded copy of submodules.
#set -x
. Common/version.txt
ver=${version%%[a-z]*}
# Create a temporary directory and make sure it will be cleaned up.
tmpdir=/tmp/mkt$$
tardir=$tmpdir/suite3270-$ver
trap "rm -rf $tmpdir" EXIT
trap exit INT
mkdir -p $tardir
# Create a git archive and dump it into the temporary directory.
# Exclude some pages from the Webpage folder (its hard links to nonexistent files cause issues while flattening) and anything
# starting with .git.
git archive --format=tar HEAD | (cd $tardir && tar -xf -)
# Add submodules.
for mod in $(git submodule | awk '{print $2}')
do tar -cf - "--exclude=.git*" $mod | (cd $tardir && tar -xf -)
done
# Create an archive of the result.
# Dereference soft and hard links, so this file can be expanded on platforms like MSYS2.
objdir=obj/release
tarball=$objdir/suite3270-$version-src.tgz
mkdir -p $objdir
rm -f $tarball
(cd $tmpdir && tar --dereference --hard-dereference -czf - *) >$tarball
ls -l $tarball