forked from ntbrock/kafka-deb-packaging
-
Notifications
You must be signed in to change notification settings - Fork 2
/
dist_kafka.sh
executable file
·70 lines (65 loc) · 1.97 KB
/
dist_kafka.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
#!/bin/bash
# 2015-Mar-18 Updated to latest Kafka stable: 0.8.2.1
# 2015-Mar-20 Added the init.d script and changed to use binary download of scala 2.10, Kafka 0.8.2.1
set -e
set -u
#app_user=kafka
name=kafka
version=0.8.2.1
scala_version=2.10
package_version="-10"
description="Apache Kafka is a distributed publish-subscribe messaging system."
url="https://kafka.apache.org/"
arch="all"
section="misc"
license="Apache Software License 2.0"
bin_package="kafka_${scala_version}-${version}.tgz"
bin_download_url="http://mirror.sdunix.com/apache/kafka/${version}/${bin_package}"
origdir="$(pwd)"
#_ MAIN _#
rm -rf ${name}*.deb
if [[ ! -f "${bin_package}" ]]; then
wget -c ${bin_download_url}
fi
mkdir -p tmp && pushd tmp
rm -rf kafka
mkdir -p kafka
cd kafka
mkdir -p build/usr/lib/kafka
mkdir -p build/usr/lib/kafka/logs
mkdir -p build/etc/default
mkdir -p build/etc/init
mkdir -p build/etc/init.d
mkdir -p build/etc/kafka
mkdir -p build/var/log/kafka
mkdir -p build/var/run/kafka
cp ${origdir}/kafka-broker.default build/etc/default/kafka-broker
cp ${origdir}/kafka-broker.upstart.conf build/etc/init/kafka-broker.conf
cp ${origdir}/kafka-broker.init.d build/etc/init.d/kafka
cp ${origdir}/zookeeper.init.d build/etc/init.d/zookeeper
# Updated to use the Binary package
rm -rf kafka_${scala_version}-${version}
tar zxf ${origdir}/${bin_package}
cd kafka_${scala_version}-${version}
# mv config/log4j.properties config/server.properties ../build/etc/kafka
cp config/server.properties ../build/etc/kafka
cp config/zookeeper.properties ../build/etc/kafka/zookeeper.properties
mv * ../build/usr/lib/kafka
cd ../build
fpm -t deb \
-n ${name} \
-v ${version}${package_version} \
--description "${description}" \
--url="{$url}" \
-a ${arch} \
--category ${section} \
--vendor "" \
--license "${license}" \
-m "${USER}@localhost" \
--prefix=/ \
--after-install ${origdir}/postinst \
--after-remove ${origdir}/postrm \
-s dir \
-- .
mv kafka*.deb ${origdir}
popd