-
Notifications
You must be signed in to change notification settings - Fork 88
/
make_matx_release.sh
executable file
·74 lines (65 loc) · 1.68 KB
/
make_matx_release.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
shopt -s extglob
PDIR=proprietary
script=$(basename "$0")
todel=""
prop=""
dset=0
if [ $# -gt 2 ]; then
echo "Too many arguments!"
exit 1
fi
function help() {
echo "Create a release of MatX"
echo "$script -d dir"
echo "If dir is specified only proprietary files from there will be included."
echo "Not specifying dir means all proprietary files are included"
echo "Specifying NONE means no proprietary files will be included"
}
while test $# -gt 0; do
case "$1" in
-h|--help)
help
exit 0
;;
-d)
dset=1
shift
if test $# -gt 0; then
prop=$1
if [ "$prop" = "NONE" ]; then
echo "No proprietary files will be included in this release"
pfiles=$(find $PDIR)
else
echo "Stripping build to only include $prop files"
pfiles=$(ls -d $PDIR/!(*"$1"))
fi
for d in $pfiles; do
todel="$todel --exclude='$d'"
done
else
prop="all"
echo "No directory specified. Including all proprietary files!"
fi
;;
*)
break
;;
esac
done
if [ $dset -ne 1 ]; then
echo "Error: Must pass -d flag"
help
exit 1
fi
# Drop untracked files
pfiles=$(git ls-files --others --exclude-standard)
for d in $pfiles; do
todel="$todel --exclude='$d'"
done
commit=$(git log --format="%h" -n 1)
filename="matx_${prop}_${commit}.tgz"
cmd="tar --exclude $script $todel --exclude build -zcf $filename --exclude-vcs-ignores --exclude-vcs *"
echo "Creating $prop release with name $filename"
echo "$cmd"
eval "$cmd"