Skip to content

Instantly share code, notes, and snippets.

@rgevaert
Last active January 7, 2016 08:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rgevaert/5ea816c4ad0ef2979f32 to your computer and use it in GitHub Desktop.
Save rgevaert/5ea816c4ad0ef2979f32 to your computer and use it in GitHub Desktop.
#!/bin/bash
version=$1
maintainer="Rudy Gevaert <rudy.gevaert@gmail.com>"
description="Kibana is webinterface for Elasticsearch. To recreate this package use https://gist.github.com/rgevaert/5ea816c4ad0ef2979f32"
if [ "$version" == "" ]
then
echo Usage: $0 version-number
exit
fi
file="kibana-${version}-linux-x64.tar.gz"
url="https://download.elastic.co/kibana/kibana/${file}"
temp=`mktemp -d`
cd $temp
cat > after-install <<EOF
#!/bin/sh
systemctl daemon-reload
EOF
chmod a+x after-install
mkdir install
cd install
mkdir -p opt etc/systemd/system
echo Building in `pwd`
cat > etc/systemd/system/kibana.service <<EOF
[Unit]
Description=Kibana 4
[Service]
Type=simple
User=root
ExecStart=/opt/kibana/bin/kibana
[Install]
WantedBy=multi-user.target
EOF
wget $url
tar -xzf $file
mv kibana-${version}-linux-x64 opt/kibana
rm $file
cd
echo Creating Debian package in `pwd`
fpm -s dir \
-t deb \
-n kibana \
-v $version \
--iteration '1' \
--license MIT \
--description="${description}" \
-a 'all' \
--after-install $temp/after-install \
--description 'Kibana is a web interface for Logstash.' \
--url 'http://kibana.org' \
--vendor 'Kibana.Org' \
--maintainer "$maintainer" \
-d 'ruby' \
--deb-user 'root' \
--deb-group 'root' \
-C $temp/install \
.
rm -fr $temp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment