-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.sh
executable file
·77 lines (68 loc) · 1.46 KB
/
build.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
75
76
77
#!/bin/bash
version=$2
here=`dirname $0`
dest_dl_dir=$here/servers
src_dir=$here/src
build_dir=$here/build
pkg_dir=$here/pkg
select_version() {
if [ -z $version ] ; then
version=2.0rc2
fi
echo "Builing version $version"
}
make_dirs() {
echo "Creating directories ..."
mkdir -p $pkg_dir
mkdir -p $build_dir
mkdir -p $dest_dl_dir
mkdir -p $src_dir/usr/share/selenium-server
mkdir -p $src_dir/var/lib/selenium-server
mkdir -p $src_dir/var/log/selenium-server
mkdir -p $src_dir/var/run/selenium-server
}
download() {
echo "Downloading selenium-server ..."
jar=selenium-server-standalone-$version.jar
selected_file=$dest_dl_dir/$jar
if [ ! -f $selected_file ] ; then
wget -nv http://selenium-release.storage.googleapis.com/${version%.*}/$jar -O $selected_file || exit 1
else
echo " File already downloaded."
fi
}
build() {
echo "Processing ..."
rm -Rf $build_dir
cp -R $src_dir $build_dir
find $build_dir -type f -exec sed -i s/%VERSION%/$version/g {} \;
cp $selected_file $build_dir/usr/share/selenium-server/selenium-server.jar
}
clean() {
echo "Cleanning ..."
rm -Rf $pkg_dir $build_dir $dest_dl_dir
}
package() {
echo 'Packaging ...'
dpkg-deb --build $build_dir > /dev/null
mv $here/build.deb $pkg_dir/selenium-server-$version.deb
}
usage() {
echo "usage:"
echo " `basename $0` pkg [ version ]"
echo " `basename $0` clean"
}
case $1 in
clean)
clean
;;
pkg)
select_version
make_dirs
download
build
package
;;
*)
usage
esac