Skip to content

Instantly share code, notes, and snippets.

@iakovgan
Forked from stuart-warren/tomcat-mkdeb.sh
Created September 30, 2020 16:23
Show Gist options
  • Save iakovgan/95b5135c5d970f2b69a2cbd0cccb00f6 to your computer and use it in GitHub Desktop.
Save iakovgan/95b5135c5d970f2b69a2cbd0cccb00f6 to your computer and use it in GitHub Desktop.
Create deb of Tomcat installing into its own dir (to allow multiple versions) Uses fpm
#!/bin/bash -xe
#
# sudo gem install fpm
# sudo apt-get install curl
# # Put this script in a folder called tomcat-packaging
# ./mkdeb.sh 7.0.40
# ./mkdeb.sh 6.0.37
#
VERSION=$1
VERSION_=${VERSION//./}
MAJOR=${VERSION:0:1}
rm -rf ./usr/local/*
mkdir -p ./usr/local/share/
pushd ./usr/local/share/
curl "http://mirror.catn.com/pub/apache/tomcat/tomcat-${MAJOR}/v${VERSION}/bin/apache-tomcat-${VERSION}.tar.gz" | tar -xz
popd
cd ..
rm -f *.deb
fpm -n tomcat${VERSION_} \
-v ${VERSION}-0custom1 \
-d default-jre \
-a all \
--vendor apache \
--license 'Apache Version 2.0' \
-C tomcat-packaging/ \
-m "DSI <dsi@custom.com>" \
-t deb \
-s dir \
--config-files usr/local/share/apache-tomcat-${VERSION}/conf/web.xml \
--config-files usr/local/share/apache-tomcat-${VERSION}/conf/context.xml \
--config-files usr/local/share/apache-tomcat-${VERSION}/conf/catalina.policy \
--config-files usr/local/share/apache-tomcat-${VERSION}/conf/catalina.properties \
--config-files usr/local/share/apache-tomcat-${VERSION}/conf/tomcat-users.xml \
--config-files usr/local/share/apache-tomcat-${VERSION}/conf/logging.properties \
--config-files usr/local/share/apache-tomcat-${VERSION}/conf/server.xml \
--description "Apache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages technologies." \
--url 'http://tomcat.apache.org/' \
usr
# Add these?
# --pre-install ./tomcat.preinstall \
# --post-install ./tomcat.postinstall \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment