forked from elastic/logstash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·105 lines (92 loc) · 3.16 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
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
#!/bin/bash
VERSION="$(awk -F\" '/LOGSTASH_VERSION/ {print $2}' $(dirname $0)/../lib/logstash/version.rb)"
if [ "$#" -ne 2 ] ; then
echo "Usage: $0 <os> <release>"
echo
echo "Example: $0 ubuntu 12.10"
exit 1
fi
os=$1
release=$2
echo "Building package for $os $release"
destdir=build/$(echo "$os" | tr ' ' '_')
prefix=/opt/logstash
if [ "$destdir/$prefix" != "/" -a -d "$destdir/$prefix" ] ; then
rm -rf "$destdir/$prefix"
fi
mkdir -p $destdir/$prefix
# install logstash.jar
jar="$(dirname $0)/../build/logstash-$VERSION-flatjar.jar"
if [ ! -f "$jar" ] ; then
echo "Unable to find $jar"
exit 1
fi
cp $jar $destdir/$prefix/logstash.jar
case $os@$release in
centos@*)
mkdir -p $destdir/etc/logrotate.d
mkdir -p $destdir/etc/sysconfig
mkdir -p $destdir/etc/init.d
mkdir -p $destdir/etc/logstash/conf.d
mkdir -p $destdir/opt/logstash/tmp
mkdir -p $destdir/var/lib/logstash
mkdir -p $destdir/var/run/logstash
mkdir -p $destdir/var/log/logstash
cp $os/sysconfig $destdir/etc/sysconfig/logstash
install -m644 logrotate.conf $destdir/etc/logrotate.d/
install -m755 logstash.sysv.redhat $destdir/etc/init.d/logstash
;;
ubuntu@*)
mkdir -p $destdir/etc/logstash/conf.d
mkdir -p $destdir/etc/logrotate.d
mkdir -p $destdir/etc/init
mkdir -p $destdir/var/log/logstash
mkdir -p $destdir/etc/default
touch $destdir/etc/default/logstash
install -m644 logrotate.conf $destdir/etc/logrotate.d/logstash
install -m644 logstash.default $destdir/etc/default/logstash
install -m644 logstash-web.default $destdir/etc/default/logstash-web
install -m755 logstash.upstart.ubuntu $destdir/etc/init/logstash.conf
install -m755 logstash-web.upstart.ubuntu $destdir/etc/init/logstash-web.conf
;;
debian@*)
mkdir -p $destdir/etc/logstash/conf.d
mkdir -p $destdir/etc/logrotate.d
mkdir -p $destdir/etc/init.d
mkdir -p $destdir/var/lib/logstash
mkdir -p $destdir/var/log/logstash
mkdir -p $destdir/etc/default
touch $destdir/etc/default/logstash
install -m644 logrotate.conf $destdir/etc/logrotate.d/logstash
install -m644 logstash.default $destdir/etc/default/logstash
install -m644 logstash-web.default $destdir/etc/default/logstash-web
install -m755 logstash.sysv.debian $destdir/etc/init.d/logstash
install -m755 logstash-web.sysv.debian $destdir/etc/init.d/logstash-web
;;
*)
echo "Unknown OS: $os $release"
exit 1
;;
esac
description="logstash is a system for managing and processing events and logs"
case $os in
centos|fedora|redhat)
fpm -s dir -t rpm -n logstash -v "$VERSION" \
-a noarch --iteration 1_$os \
-d "jre >= 1.6.0" \
--before-install centos/before-install.sh \
--before-remove centos/before-remove.sh \
--after-install centos/after-install.sh \
-f -C $destdir .
;;
ubuntu|debian)
fpm -s dir -t deb -n logstash -v "$VERSION" \
-a all --iteration 1-$os \
-d "java6-runtime" \
--deb-user root --deb-group root \
--before-install $os/before-install.sh \
--before-remove $os/before-remove.sh \
--after-install $os/after-install.sh \
-f -C $destdir .
;;
esac