share/WinGit/release.sh: provide a few safeguards
[msysgit.git] / share / WinGit / release.sh
blobfb8e67795e05bd45110bfe60d8e1317df4f23617
1 #!/bin/sh
3 force=
4 case "$1" in
5 -f|--force)
6 force=t
7 shift
8 ;;
9 esac
11 test -z "$1" && {
12 echo "Usage: $0 <version>" >&2
13 exit 1
16 version=$1
18 test -z "$force" && {
19 die () {
20 echo "$*" >&2
21 echo "If that is okay, please call '$0 -f $version'" >&2
22 exit 1
25 (cd /git &&
26 git update-index --refresh &&
27 git diff-files --quiet &&
28 git diff-index --cached HEAD --) ||
29 die "Git submodule has dirty files"
30 (cd /git &&
31 test git.exe = $(ls -t git.exe $(git ls-files) | head -n 1)) ||
32 die "Git's git.exe is not up-to-date (run 'cd /git && make' to fix)"
33 for f in /bin/git* /libexec/git-core/git*
35 case "$f" in
36 *.manifest)
37 continue
39 */gitk)
40 basename=gitk-git/gitk
42 */git-citool|*/git-gui)
43 basename=git-gui/git-gui
45 */git-gui--askpass|*/git-gui.tcl)
46 basename=git-gui/$(basename "$f")
49 basename=$(basename "$f")
51 esac
52 cmp "$f" "/git/$basename" ||
53 die "Installed Git disagrees with contents of /git/"
54 done
55 (cd / &&
56 git update-index --refresh &&
57 git diff-files --quiet &&
58 git diff-index --cached HEAD --) ||
59 die "msysGit super project not up-to-date"
60 (cd /git &&
61 test ! -z "$(git tag --contains HEAD)") ||
62 die "Git's HEAD is untagged"
65 TMPDIR=/tmp/WinGit
67 /share/WinGit/copy-files.sh $TMPDIR &&
68 sed "s/msysGit/Git (version $version)/" < /etc/motd > $TMPDIR/etc/motd &&
69 cp /share/resources/gpl-2.0.rtf /share/resources/git.bmp $TMPDIR &&
70 homewinpath=$(cd ~ ; pwd -W) &&
71 sed -e "s/%APPVERSION%/$version/" -e "s@%OUTPUTDIR%@$homewinpath@" \
72 < /share/WinGit/install.iss > $TMPDIR/install.iss &&
73 echo "Lauching Inno Setup compiler ..." &&
74 /share/InnoSetup/ISCC.exe "$TMPDIR/install.iss" /q | grep -Ev "\s*Reading|\s*Compressing" &&
75 git tag Git-$1