installer: further automate release script
[msysgit.git] / share / WinGit / release.sh
blob75701c627f20bcb3e1674ef3ada25d7d1f831279
1 #!/bin/sh
3 force=
4 do_compile=t
5 while test $# -gt 0
6 do
7 case "$1" in
8 -f|--force)
9 force=t
10 shift
12 -n|--no-compile)
13 do_compile=
14 shift
17 break
18 esac
19 done
21 test -z "$1" && {
22 echo "Usage: $0 [-f] [-n] <version>" >&2
23 exit 1
26 version=$1
28 create_msysgit_tag () {
29 i=0 &&
30 while ! git tag -a -m "Git for Windows $1" \
31 $(git describe HEAD | cut -d- -f1).msysgit.$i
33 i=$[$i+1]
34 done
37 # compile everything needed for standard setup
38 test "$do_compile" && {
39 start /share/WinGit/ReleaseNotes.rtf &&
40 echo "Press enter to continue (Ctrl-C to stop)" &&
41 read && {
42 # create a commit if ReleaseNotes changed
43 test "$(git diff /share/WinGit/ReleaseNotes.rtf)" && {
44 git add /share/WinGit/ReleaseNotes.rtf &&
45 git commit -m "Git for Windows $version"
47 (cd /git &&
48 create_msysgit_tag $version &&
49 make install) &&
50 (cd /src/git-cheetah/explorer/ && make)
51 } || exit 1
54 test -z "$force" && {
55 die () {
56 echo "$*" >&2
57 echo "If that is okay, please call '$0 -f $version'" >&2
58 exit 1
61 (cd /git &&
62 git update-index --refresh &&
63 git diff-files --quiet &&
64 git diff-index --cached HEAD --) ||
65 die "Git submodule has dirty files"
66 (cd /git &&
67 test git.exe = $(ls -t git.exe $(git ls-files) | head -n 1)) ||
68 die "Git's git.exe is not up-to-date (run 'cd /git && make' to fix)"
69 for f in /bin/git* /libexec/git-core/git*
71 case "$f" in
72 *.manifest)
73 continue
75 */gitk)
76 basename=gitk-git/gitk
78 */git-citool|*/git-gui)
79 basename=git-gui/git-gui
81 */git-gui--askpass|*/git-gui.tcl)
82 basename=git-gui/$(basename "$f")
85 basename=$(basename "$f")
87 esac
88 cmp "$f" "/git/$basename" ||
89 die "Installed Git disagrees with contents of /git/"
90 done
91 (cd / &&
92 git update-index --refresh &&
93 git diff-files --quiet &&
94 git diff-index --cached HEAD --) ||
95 die "msysGit super project not up-to-date"
96 (cd /git &&
97 test ! -z "$(git tag --contains HEAD)") ||
98 die "Git's HEAD is untagged"
101 TMPDIR=/tmp/WinGit
102 unset DONT_REMOVE_BUILTINS
104 /share/WinGit/copy-files.sh $TMPDIR &&
105 sed -e '/share\/msysGit/d' -e "s/msysGit/Git (version $version)/" \
106 < /etc/motd > $TMPDIR/etc/motd &&
107 cp /share/resources/gpl-2.0.rtf /share/resources/git.bmp /share/resources/gitsmall.bmp $TMPDIR &&
108 homewinpath=$(cd ~ ; pwd -W) &&
109 sed -e "s/%APPVERSION%/$version/" -e "s@%OUTPUTDIR%@$homewinpath@" \
110 < /share/WinGit/install.iss > $TMPDIR/install.iss &&
111 echo "Lauching Inno Setup compiler ..." &&
112 /share/InnoSetup/ISCC.exe "$TMPDIR/install.iss" -q | grep -Ev "\s*Reading|\s*Compressing" &&
113 (cd / && git tag -a -m "Git for Windows $1" Git-$1)