forked from tomdz/kafka-deb-packaging
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_kafka.sh
executable file
·60 lines (54 loc) · 1.4 KB
/
build_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
#!/bin/bash
KAFKA_VERSION=$1
SCALA_VERSION=$2
ARCH_TYPE=$3
set -e
set -u
name=kafka
version=$KAFKA_VERSION
scala_version=$SCALA_VERSION
arch=$ARCH_TYPE
description="Apache Kafka is a distributed publish-subscribe messaging system."
url="https://kafka.apache.org/"
section="misc"
license="Apache Software License 2.0"
package_version="-1"
src_package="kafka_${scala_version}-${version}.tgz"
download_url="http://mirror.cc.columbia.edu/pub/software/apache/kafka/${version}/${src_package}"
origdir="$(pwd)"
#_ MAIN _#
rm -rf ${name}*.deb
if [ ! -f "${src_package}" ]; then
wget ${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/etc/default
mkdir -p build/etc/init
mkdir -p build/etc/kafka
mkdir -p build/var/log/kafka
cp ${origdir}/kafka-broker.default build/etc/default/kafka-broker
cp ${origdir}/kafka-broker.upstart.conf build/etc/init/kafka-broker.conf
tar zxf ${origdir}/${src_package}
cd kafka_${scala_version}-${version}
mv config/log4j.properties config/server.properties ../build/etc/kafka
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 "buildhost@localhost" \
--prefix=/ \
-s dir \
-- .
mv kafka*.deb ${origdir}
popd