Packaging for Ubuntu Karmic

This commit is contained in:
Adrian Perez 2010-03-24 21:04:21 +00:00 committed by Jose Maria Casanova Crespo
parent a798653c57
commit bbaddd063a
12 changed files with 289 additions and 0 deletions

5
debian/.gitignore vendored Normal file
View file

@ -0,0 +1,5 @@
jta-*.zip
maven-repo/
*-stamp
*.log
tmp/

6
debian/51navalplan.policy vendored Normal file
View file

@ -0,0 +1,6 @@
grant codeBase "file:/var/lib/tomcat6/webapps/navalplanner-webapp/-" {
permission java.security.AllPermission;
};
grant codeBase "file:/var/lib/tomcat6/webapps/navalplanner-webapp.war" {
permission java.security.AllPermission;
};

5
debian/changelog vendored Normal file
View file

@ -0,0 +1,5 @@
navalplan (20100324) karmic; urgency=low
* Initial release.
-- Adrian Perez <aperez@igalia.com> Wed, 24 Mar 2010 16:35:00 +0000

1
debian/compat vendored Normal file
View file

@ -0,0 +1 @@
5

13
debian/control vendored Normal file
View file

@ -0,0 +1,13 @@
Source: navalplan
Priority: optional
Maintainer: Adrian Perez <aperez@igalia.com>
Build-Depends: debhelper (>= 5), maven2, python-docutils, gettext (>= 0.17),
texlive-latex-recommended, pgf, openjdk-6-jdk
Package: navalplan
Architecture: all
Section: web
Depends: cutycapt, postgresql-client, xvfb, dbconfig-common, ucf,
tomcat6, openjdk-6-jre-headless | openjdk-6-jre, ${misc:Depends}
Description: Web based planner thought for naval-related companies.

9
debian/maven-settings.xml vendored Normal file
View file

@ -0,0 +1,9 @@
<settings
xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!-- Change this to something inside the build directory -->
<localRepository>${env.CURDIR}/debian/maven-repo</localRepository>
</settings>

9
debian/navalplan.config vendored Normal file
View file

@ -0,0 +1,9 @@
#! /bin/bash
set -e
. /usr/share/debconf/confmodule
if [ -r /usr/share/dbconfig-common/dpkg/config.pgsql ] ; then
. /usr/share/dbconfig-common/dpkg/config.pgsql
dbc_go navalplan $@
fi

2
debian/navalplan.install vendored Normal file
View file

@ -0,0 +1,2 @@
debian/tmp/var/lib/tomcat6/webapps/navalplanner-webapp.war
debian/tmp/etc/tomcat6/policy.d/51navalplan.policy

80
debian/navalplan.postinst vendored Normal file
View file

@ -0,0 +1,80 @@
#! /bin/bash
set -e
. /usr/share/debconf/confmodule
. /usr/share/dbconfig-common/dpkg/postinst.pgsql
dbc_go navalplan $@
if [[ $1 = configure && -r /etc/dbconfig-common/navalplan.conf ]]
then
. /etc/dbconfig-common/navalplan.conf
if [ -z "${dbc_dbhost}" ] ; then
database_host='localhost'
else
database_host=${dbc_dbhost}
fi
echo "Adding navalplan Tomcat configuration bits"
# Remove first (just in case!)
sed -i -e '/begin:navalplan/,/end:navalplan/d' /etc/tomcat6/policy.d/03catalina.policy
sed -i -e '/begin:navalplan/,/end:navalplan/d' /etc/tomcat6/context.xml
# Modify /etc/tomcat6/context.xml
#
saved_ifs=${IFS}
IFS=$'\n'
while read -r line ; do
if [[ ${line} = *\</Context\>* ]] ; then
cat <<-EOF
<!-- begin:navalplan -->
<Resource name="jdbc/navalplanner-ds" auth="Container"
type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="${dbc_dbuser}" password="${dbc_dbpass}"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://${database_host}/${dbc_dbname}"/>
<!-- end:navalplan -->
EOF
fi
echo "${line}"
done < /etc/tomcat6/context.xml \
> /etc/tomcat6/context.xml.new
IFS=${saved_ifs}
mv /etc/tomcat6/context.xml.new \
/etc/tomcat6/context.xml
# Modify /etc/tomcat6/policy.d/03catalina.policy
#
saved_ifs=${IFS}
IFS=$'\n'
while read -r line ; do
echo "${line}"
if [[ ${line} = *tomcat-juli.jar* ]] ; then
echo ' // begin:navalplan'
echo ' permission java.io.FilePermission "${catalina.base}${file.separator}webapps${file.separator}navalplanner-webapp${file.separator}WEB-INF${file.separator}classes${file.separator}logging.properties", "read";'
echo ' // end:navalplan'
fi
done < /etc/tomcat6/policy.d/03catalina.policy \
> /etc/tomcat6/policy.d/03catalina.policy.new
IFS=${saved_ifs}
mv /etc/tomcat6/policy.d/03catalina.policy.new \
/etc/tomcat6/policy.d/03catalina.policy
fi
#if [ -x /etc/init.d/tomcat5.5 ] ; then
# if [ -x "$(which invoke-rc.d 2> /dev/null)" ] ; then
# invoke-rc.d tomcat5.5 restart
# else
# /etc/init.d/tomcat5.5 restart
# fi
#fi
#DEBHELPER#

26
debian/navalplan.postrm vendored Normal file
View file

@ -0,0 +1,26 @@
#! /bin/bash
set -e
. /usr/share/debconf/confmodule
if [ -r /usr/share/dbconfig-common/dpkg/postinst.pgsql ] ; then
. /usr/share/dbconfig-common/dpkg/postinst.pgsql
dbc_go navalplan $@
fi
if [[ $1 = purge ]] ; then
echo "Removing navalplan Tomcat configuration bits..."
sed -i -e '/begin:navalplan/,/end:navalplan/d' /etc/tomcat6/policy.d/03catalina.policy
sed -i -e '/begin:navalplan/,/end:navalplan/d' /etc/tomcat6/context.xml
fi
#if [ -x /etc/init.d/tomcat5.5 ] ; then
# if [ -x "$(which invoke-rc.d 2> /dev/null)" ] ; then
# invoke-rc.d tomcat5.5 restart
# else
# /etc/init.d/tomcat5.5 restart
# fi
#fi
#DEBHELPER#

11
debian/navalplan.prerm vendored Normal file
View file

@ -0,0 +1,11 @@
#! /bin/bash
set -e
. /usr/share/debconf/confmodule
if [ -r /usr/share/dbconfig-common/dpkg/postinst.pgsql ] ; then
. /usr/share/dbconfig-common/dpkg/postinst.pgsql
dbc_go navalplan $@
fi
#DEBHELPER#

122
debian/rules vendored Executable file
View file

@ -0,0 +1,122 @@
#! /usr/bin/make -f
#export DH_VRBOSE=1
export DH_OPTIONS
export CURDIR
MAKEFLAGS += s
JAVA_HOME := /usr/lib/jvm/java-6-openjdk
MAVEN_REPO := $(CURDIR)/debian/maven-repo
MAVEN_OPTS := -Pprod,postgresql -Dmaven.test.skip=true -B \
-s $(CURDIR)/debian/maven-settings.xml
JTA_JAR ?= $(CURDIR)/debian/jta-1_0_1B-classes.zip
define NFO
@echo "$1"
endef
ifneq ($V,0)
define CMD
@echo "$1"
@$1
endef
else
define CMD
@$1
endef
endif
configure: configure-stamp
configure-stamp:
$(call NFO,Configuring...)
$(call CMD,dh_testdir)
# Configure package here
$(call CMD,touch $@)
build: build-arch
build-arch: build-arch-stamp
build-arch-stamp: configure-stamp maven-import-jta
$(call NFO,Building sources...)
# Build arch-dependant stuff
$(call CMD,mkdir -p $(MAVEN_REPO))
$(call CMD,mvn $(MAVEN_OPTS) install)
$(call CMD,touch $@)
clean:
$(call NFO,Cleaning up...)
$(call CMD,dh_testdir)
$(call CMD,dh_testroot)
# Cleanup commands
$(call CMD,$(RM) build-arch-stamp build-indep-stamp configure-stamp)
$(call CMD,mkdir -p $(MAVEN_REPO))
# This is likely to fail, e.g. if JTA jar file was not imported
-$(call CMD,mvn $(MAVEN_OPTS) clean)
$(call CMD,$(RM) -r $(CURDIR)/maven-repo)
$(call CMD,dh_clean)
install:
$(call NFO,Installing objects...)
$(call CMD,dh_testdir)
$(call CMD,dh_testroot)
$(call CMD,dh_clean -k)
$(call CMD,dh_installdirs)
# Commands to install arch-dependant stuff
$(call CMD,mkdir -p $(CURDIR)/debian/tmp/var/lib/tomcat6/webapps/)
$(call CMD,cp $(CURDIR)/navalplanner-webapp/target/navalplanner-webapp.war \
$(CURDIR)/debian/tmp/var/lib/tomcat6/webapps)
# Install Policy file
$(call CMD,mkdir -p $(CURDIR)/debian/tmp/etc/tomcat6/policy.d)
$(call CMD,cp $(CURDIR)/debian/51navalplan.policy \
$(CURDIR)/debian/tmp/etc/tomcat6/policy.d/)
$(call CMD,dh_install)
binary-indep: build install
binary-arch: build install
$(call NFO,Making binary package...)
$(call CMD,dh_testdir)
$(call CMD,dh_testroot)
$(call CMD,dh_installchangelogs)
$(call CMD,dh_installdocs)
$(call CMD,dh_installexamples)
# $(call CMD,dh_installmenu)
$(call CMD,dh_installdebconf)
# $(call CMD,dh_installlogrotate)
# $(call CMD,dh_installemacsen)
# $(call CMD,dh_installpam)
# $(call CMD,dh_installmime)
# $(call CMD,dh_python)
# $(call CMD,dh_installinit)
# $(call CMD,dh_installcron)
# $(call CMD,dh_installinfo)
$(call CMD,dh_installman)
$(call CMD,dh_link)
$(call CMD,dh_strip)
$(call CMD,dh_compress)
$(call CMD,dh_fixperms)
# $(call CMD,dh_perl)
$(call CMD,dh_makeshlibs)
$(call CMD,dh_installdeb)
$(call CMD,dh_shlibdeps)
$(call CMD,dh_gencontrol)
$(call CMD,dh_md5sums)
$(call CMD,dh_builddeb)
binary: binary-indep binary-arch
maven-import-jta: maven-import-jta-stamp
maven-import-jta-stamp: $(JTA_JAR)
$(call NFO,Importing $(notdir $<)...)
$(call CMD,mvn $(MAVEN_OPTS) install:install-file \
-DgroupId=javax.transaction -DartifactId=jta \
-Dversion=1.0.1B -Dpackaging=jar -Dfile="$<")
$(call CMD,touch $@)
.PHONY: build clean binary-indep binary-arch binary install install-indep
.PHONY: install-arch configure maven-import-jta