-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgendeb.sh
executable file
·60 lines (48 loc) · 1.32 KB
/
gendeb.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
#!/bin/sh
usage() {
echo "Usage: $1 <version> <release>"
}
pack_name="contactme"
version="$1"
release="$2"
vendor="Rafael Dantas Justo"
maintainer="Rafael Dantas Justo <[email protected]>"
url="http://github.com/rafaeljusto/contactme"
license="MIT"
description="Microservice for sending e-mails via HTTP interface"
if [ -z "$version" ]; then
echo "Version not defined!"
usage $0
exit 1
fi
if [ -z "$release" ]; then
echo "Release not defined!"
usage $0
exit 1
fi
install_path=/usr/local/bin
config_path=/etc/contactme
tmp_dir=/tmp/contactme
workspace=`echo $GOPATH | cut -d: -f1`
workspace=$workspace/src/github.com/rafaeljusto/contactme
# recompiling everything
current_dir=`pwd`
cd $workspace
go build
cd $current_dir
if [ -f $pack_name*.deb ]; then
# remove old deb
rm $pack_name*.deb
fi
if [ -d $tmp_dir ]; then
rm -rf $tmp_dir
fi
mkdir -p $tmp_dir$install_path $tmp_dir$config_path
mv $workspace/contactme $tmp_dir$install_path/
cp $workspace/contactme.yaml $tmp_dir$config_path/
fpm -s dir -t deb \
--exclude=.git -n $pack_name -v "$version" --iteration "$release" --vendor "$vendor" \
--maintainer "$maintainer" --url $url --license "$license" --description "$description" \
--deb-upstart $workspace/contactme.upstart \
--deb-user root --deb-group root \
--prefix / -C $tmp_dir usr/local/bin etc/contactme