-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_release_package.sh
executable file
·74 lines (59 loc) · 1.97 KB
/
build_release_package.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
73
74
#!/usr/bin/env bash
set -o errexit; set -o nounset;
declare -r releasedir='releases'
declare -r docdir='doc'
declare -r mks='mktsimple'
temp="$(grep "${mks}_version =" share/mktsimple/one_to_one_cpp.mk)"
release_version="${temp##* }"
echo
echo "Build release package version v${release_version}"
echo
pr="Is this correct: y/e "
response=''
while [[ ("${response}" != 'y') && ("${response}" != 'yes') ]]; do
read -r -p "${pr}" || exit 2
response="${REPLY,,}"
if [[ ("${response}" == 'e') || ("${response}" == 'exit') ]]; then
echo "Abort"
exit 2
fi
done
for x in in_place_cpp.mk out_place_c.mk out_place_cpp.mk out_place.mk; do
temp="$(grep "${mks}_version =" share/mktsimple/${x})"
release_version_x="${temp##* }"
if [[ "${release_version}" != "${release_version_x}" ]]; then
echo "ERROR: Version info ${release_version_x} of ${x} does not match!" >&2
exit 1
fi
done
commitstatus=$(git status --porcelain)
if [[ $commitstatus ]]; then
echo "Repository has uncommited changes:"
echo "$commitstatus"
pr="To produce the release anyway press y/e "
response=''
while [[ ("${response}" != 'y') && ("${response}" != 'yes') ]]; do
read -r -p "${pr}" || exit 2
response="${REPLY,,}"
if [[ ("${response}" == 'e') || ("${response}" == 'exit') ]]; then
echo "Abort"
exit 2
fi
done
fi
commithash=$(git rev-parse HEAD)
echo "RELEASE.INFO commithash=$commithash"
mkdir -p "${docdir}/${mks}"
echo -e "${mks}_version=${release_version}\n=$commithash" > "${docdir}/${mks}/RELEASE.INFO"
cp README.md "${docdir}/${mks}"
fname="${mks}_installer_v${release_version}.sh"
mkdir -p "$releasedir"
tar cvJf "$releasedir/tmp.tar.xz" --exclude=.gitignore bin share include "${docdir}"
cat tools/selfextract.sh releases/tmp.tar.xz > "$releasedir/$fname"
chmod +x "$releasedir/$fname"
rm "$releasedir/tmp.tar.xz"
echo
echo "*************************************************"
echo "Success build release package '$releasedir/$fname'"
echo "*************************************************"
exit 0