-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy
executable file
·124 lines (106 loc) · 3.41 KB
/
deploy
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/bash
if [ "$#" -lt "1" -o "$#" -gt "2" ]; then
echo "Usage: $0 version [all|update|commit|archive]"
exit 1
fi
target="all"
if [ "$#" == "2" ]; then
target="$2"
fi
# this check is for me, since I'm always use vifm.exe from the repository
if [ "$OS" == "Windows_NT" ]; then
if [ "x$target" == "xall" -o "x$target" == "xarchive" ]; then
vifm_running="$(ps -W | grep vifm.exe)"
if [ "x$vifm_running" != "x" ]; then
echo "ERROR: vifm is running"
exit 2
fi
fi
fi
if [ "x$target" == "xall" -o "x$target" == "xupdate" ]; then
echo "Updating version number..."
# update version in ChangeLog
sed -i "1s/current/$1/" ChangeLog
# update version in configure script
sed -i "/AM_INIT_AUTOMAKE/s/, .*)/, $1)/" configure.in
if [ "x$OS" != "xWindows_NT" ]; then
# regenerate autotools files
autoreconf
# some voodoo magic to preserve old version of aclocal.m4 file
make
git checkout aclocal.m4
make
# this one is to get rid of trailing whitespace
git checkout src/Makefile.in
make
fi
# update version in src/Makefile.win
makefile=src/Makefile.win
sed -i "/define VERSION/s/VERSION \".*\"/VERSION \"$1\"/" "${makefile}"
vimdoc=data/vim/doc/vifm.txt
# update version in data/vim/doc/vifm.txt
sed -i "/For Vifm version/s/version \\S\\+/version $1/" "${vimdoc}"
# update last change date in data/vim/doc/vifm.txt
sed -i "/Last change/s/: .*/: $(date '+%Y %b %d')/" "${vimdoc}"
# update date in README
sed -i "/^Updated:/s/ .*/$(date '+ %d %B, %Y')/" README
# update version in README
sed -i "/^Version:/s/ .*/ $1/" README
fi
if [ "x$target" == "xall" -o "x$target" == "xcommit" ]; then
echo "Making version commit..."
# try to mark commit with tag to figure out what to do:
# commit or ammend changes
git tag "v$1"
if [ "$?" != "0" ]; then
amendflag=--amend
else
amendflag=
fi
git commit -av $amendflag -m "Version v$1"
if [ "$?" != "0" ]; then
echo 'Committing error.'
exit 1
fi
# force mark commit with tag
git tag --force "v$1"
fi
if [ "x$target" == "xall" -o "x$target" == "xarchive" ]; then
echo "Building archive..."
# make archive
if [ "$OS" != "Windows_NT" ]; then
archive_name="vifm-$1.tar.bz2"
git archive "v$1" --prefix "vifm-$1/" --format tar | bzip2 > "$archive_name"
else
# remove config.h
if [ -f config.h ]; then
rm config.h
fi
# build vifm
RELEASE=1 make -B -C src -f Makefile.win
if [ "$?" != "0" ]; then
echo "ERROR: Building project failed."
exit 3
fi
dir="vifm-w32-$1-binary"
rm -rf "$dir"
mkdir "$dir"
cp -R data "$dir"
for i in "$dir/colors"/*; do
dos2unix "$i"
done
dos2unix "$dir/data/vifm-help.txt"
dos2unix "$dir/data/vifmrc"
rm -f "$dir/data/vim/doc/tags"
pkgfiles='AUTHORS BUGS ChangeLog COPYING FAQ INSTALL NEWS README THANKS TODO'
for i in $pkgfiles; do
dest="$dir/$i.txt"
cp "$i" "$dest"
dos2unix "$dest"
done
cp src/vifm-pause src/*.dll src/*.exe "$dir"
strip -S --strip-unneeded $dir/*.dll $dir/*.exe
rm -f "$dir.zip"
zip -9 -r "$dir.zip" "$dir"
fi
fi