aboutsummaryrefslogtreecommitdiffstats
path: root/build/apt
diff options
context:
space:
mode:
authorpenSec.IT UG (haftungsbeschränkt) <etherpad@pensec.it>2010-04-04 04:19:46 +0200
committerpenSec.IT UG (haftungsbeschränkt) <etherpad@pensec.it>2010-04-04 04:19:46 +0200
commit8465b116407c1d477d852785d5bd499665296b24 (patch)
treeeae46fa61b7c7e11a84ffc4aa890fb35c386e96c /build/apt
parentc3b6fb9386a4e1cfca02e61c2ea4fb14c6afc7fc (diff)
downloadetherpad-8465b116407c1d477d852785d5bd499665296b24.tar.gz
etherpad-8465b116407c1d477d852785d5bd499665296b24.tar.xz
etherpad-8465b116407c1d477d852785d5bd499665296b24.zip
apt Buildsystem
Diffstat (limited to 'build/apt')
-rw-r--r--build/apt/.gitignore5
-rw-r--r--build/apt/DEBIAN/control16
-rwxr-xr-xbuild/apt/DEBIAN/postinst291
-rwxr-xr-xbuild/apt/DEBIAN/prerm36
-rw-r--r--build/apt/DEBIAN/templates63
-rw-r--r--build/apt/README25
-rw-r--r--build/apt/TODO7
-rwxr-xr-xbuild/apt/build/build.sh246
-rw-r--r--build/apt/build/makejar.diff17
-rwxr-xr-xbuild/apt/build/run.sh34
-rwxr-xr-xbuild/apt/build/test.sh62
-rwxr-xr-xbuild/apt/do.sh133
-rw-r--r--build/apt/etc/etherpad/etherpad.properties16
-rw-r--r--build/apt/etc/etherpad/properties/admin-password0
-rw-r--r--build/apt/etc/etherpad/properties/database-host0
-rw-r--r--build/apt/etc/etherpad/properties/database-name0
-rw-r--r--build/apt/etc/etherpad/properties/database-password0
-rw-r--r--build/apt/etc/etherpad/properties/database-port0
-rw-r--r--build/apt/etc/etherpad/properties/database-username0
-rw-r--r--build/apt/etc/etherpad/properties/is-production0
-rw-r--r--build/apt/etc/etherpad/properties/port0
-rwxr-xr-xbuild/apt/etc/init.d/etherpad243
22 files changed, 1194 insertions, 0 deletions
diff --git a/build/apt/.gitignore b/build/apt/.gitignore
new file mode 100644
index 0000000..50139f0
--- /dev/null
+++ b/build/apt/.gitignore
@@ -0,0 +1,5 @@
+*~
+.tmp*
+.build*
+.package*
+.revision*
diff --git a/build/apt/DEBIAN/control b/build/apt/DEBIAN/control
new file mode 100644
index 0000000..0129652
--- /dev/null
+++ b/build/apt/DEBIAN/control
@@ -0,0 +1,16 @@
+Package: etherpad-%BRANCH%
+Priority: optional
+Section: web
+Maintainer: penSec.IT UG (haftungsbeschränkt) <etherpad@pensec.it>
+Architecture: all
+Version: 1.0-%REVISION%
+Depends: debconf (>= 0.2.17), sun-java6-jre, scala, mysql-server, mysql-client, libmysql-java, bash
+Description: Etherpad is...
+ EtherPad is the only web-based word processor that allows people to work
+ together in really real-time.
+ .
+ When multiple people edit the same document simultaneously, any changes are
+ instantly reflected on everyone's screen. The result is a new and productive
+ way to collaborate on text documents, useful for meeting notes, drafting
+ sessions, education, team programming, and more.
+
diff --git a/build/apt/DEBIAN/postinst b/build/apt/DEBIAN/postinst
new file mode 100755
index 0000000..d92c6a7
--- /dev/null
+++ b/build/apt/DEBIAN/postinst
@@ -0,0 +1,291 @@
+#!/bin/bash
+
+################################################################################
+#
+# Copyright (c) 2010 penSec.IT UG (haftungsbeschränkt)
+# http://www.pensec.it
+# mail@pensec.it
+#
+# Diese Software wird ohne ausdrückliche oder implizierte Garantie
+# bereitgestellt. Auf keinen Fall können die Autoren für irgendwelche Schäden,
+# die durch die Benutzung dieser Software entstehen, haftbar gemacht werden.
+#
+# Es ist dem Auftraggeber gestattet diese Software für jeden Zweck, inklusive
+# kommerzieller Anwendungen, zu benutzten und zu verändern aber nicht
+# weiterzuverbreiten, solange folgende Bedingungen erfüllt sind:
+#
+# 1. Die Herkunft dieser Software darf nicht falsch dargestellt werden; Sie
+# dürfen nicht angeben, dass Sie die ursprüngliche Software geschrieben
+# haben. Wenn Sie diese Software in einem Produkt benutzten, würde eine
+# Erwähnung geschätzt werden, sie ist aber nicht erforderlich.
+# 2. Veränderte Quelltextversionen müssen deutlich als solche
+# gekennzeichnet werden und dürfen nicht als die Originalsoftware
+# dargestellt werden.
+# 3. Diese Notiz darf in den Quelltexten nicht verändert oder gelöscht
+# werden.
+#
+################################################################################
+
+
+
+set -e
+. /usr/share/debconf/confmodule
+
+if [ -n "$ETHERPAD_DEBUG" ]; then
+ echo "now debugging $0 $@"
+ set -x
+fi
+
+db_version 2.0
+
+
+
+
+
+#####
+#
+# Fragt einen Konfigurationswert ab und schreibt ihn in die Eigenschaftsdatei
+#
+# @param $1 Name des debconfig Templates
+# @param $2 Name der Datei in welche der Konfigurationswert geschrieben werden
+# soll
+# @param $3 Wird aktuell nicht verwendet, Platzhalter in etherpad.properties
+# welcher mit dem Wert dieser Varialbe ersetzt werden soll
+#
+function configuration_property() {
+ TEMPLATE="${1}"
+ PROPERTY_FILE="/etc/etherpad/properties/${2}"
+ PLACEHOLDER="${3}"
+
+ PROPERTY=`cat "${PROPERTY_FILE}"`
+ db_input high "etherpad-%BRANCH%/${TEMPLATE}" || true
+ db_go
+
+ db_get "etherpad-%BRANCH%/${TEMPLATE}"
+ if [ "" != "$RET" ]; then
+ PROPERTY="$RET"
+ fi
+
+ echo "${PROPERTY}" > "${PROPERTY_FILE}"
+}
+#
+#####
+
+
+
+case "$1" in
+
+ configure)
+
+ # Create system user
+ if ! getent passwd etherpad > /dev/null ; then
+ echo 'Adding system-user for etherpad' 1>&2
+ adduser --system --group --quiet \
+ --home /usr/share/etherpad --no-create-home \
+ --disabled-login --force-badname etherpad
+ fi
+
+
+ # Give user the rights to write into the log & data directory
+ if [ -d "/var/log/etherpad" ]; then
+ EMPTY_STATEMENT="true"
+ else
+ mkdir -p "/var/log/etherpad"
+ fi
+ chown -R etherpad:etherpad "/var/log/etherpad"
+
+ if [ -d "/usr/share/etherpad/etherpad/data" ]; then
+ EMPTY_STATEMENT="true"
+ else
+ mkdir -p "/usr/share/etherpad/etherpad/data"
+ fi
+ chown -R etherpad:etherpad "/usr/share/etherpad/etherpad/data"
+
+
+ # Give user the rights do write everywhere, did not yet figure
+ # out which rights are necessary, exactly
+ chown -R etherpad:etherpad "/usr/share/etherpad"
+ ;;
+
+esac
+
+
+
+#####
+#
+# Get configuration properties
+#
+configuration_property "is_production" "is-production" "IS_PRODUCTION"
+configuration_property "admin_password" "admin-password" "ADMIN_PASSWORD"
+configuration_property "port" "port" "PORT"
+configuration_property "database_host" "database-host" "DATABASE_HOST"
+configuration_property "database_port" "database-port" "DATABASE_PORT"
+configuration_property "database_name" "database-name" "DATABASE_NAME"
+configuration_property "database_username" "database-username" "DATABASE_USERNAME"
+configuration_property "database_password" "database-password" "DATABASE_PASSWORD"
+#
+#####
+
+
+
+
+
+# #####
+# #
+# # Install in production mode
+# #
+# IS_PRODUCTION="false"
+# db_input high "etherpad-%BRANCH%/is_production" || true
+# db_go
+#
+# db_get "etherpad-%BRANCH%/is_production"
+# if [ "" != "$RET" ]; then
+# IS_PRODUCTION="$RET"
+# fi
+#
+# apply_config "IS_PRODUCTION" "${IS_PRODUCTION}"
+# #
+# #####
+
+# #####
+# #
+# # Admin password
+# #
+# ADMIN_PASSWORD="password"
+# db_input high "etherpad-%BRANCH%/admin_password" || true
+# db_go
+#
+# db_get "etherpad-%BRANCH%/admin_password"
+# if [ "" != "$RET" ]; then
+# ADMIN_PASSWORD="$RET"
+# fi
+#
+# apply_config "ADMIN_PASSWORD" "${ADMIN_PASSWORD}"
+# #
+# #####
+
+# #####
+# #
+# # Application listen port
+# #
+# PORT="9000"
+# db_input high "etherpad-%BRANCH%/port" || true
+# db_go
+#
+# db_get "etherpad-%BRANCH%/port"
+# if [ "" != "$RET" ]; then
+# PORT="$RET"
+# fi
+#
+# apply_config "PORT" "${PORT}"
+# #
+# #####
+
+# #####
+# #
+# # MySQL Host
+# #
+# DATABASE_HOST="localhost"
+# db_input high "etherpad-%BRANCH%/database_host" || true
+# db_go
+#
+# db_get "etherpad-%BRANCH%/database_host"
+# if [ "" != "$RET" ]; then
+# DATABASE_HOST="$RET"
+# fi
+#
+# apply_config "DATABASE_HOST" "${DATABASE_HOST}"
+# #
+# #####
+
+# #####
+# #
+# # MySQL Port
+# #
+# DATABASE_PORT="3306"
+# db_input high "etherpad-%BRANCH%/database_port" || true
+# db_go
+#
+# db_get "etherpad-%BRANCH%/database_port"
+# if [ "" != "$RET" ]; then
+# DATABASE_PORT="$RET"
+# fi
+#
+# apply_config "DATABASE_PORT" "${DATABASE_PORT}"
+# #
+# #####
+
+# #####
+# #
+# # MySQL database name
+# #
+# DATABASE_NAME="etherpad"
+# db_input high "etherpad-%BRANCH%/database_name" || true
+# db_go
+#
+# db_get "etherpad-%BRANCH%/database_name"
+# if [ "" != "$RET" ]; then
+# DATABASE_NAME="$RET"
+# fi
+#
+# apply_config "DATABASE_NAME" "${DATABASE_NAME}"
+# #
+# #####
+
+# #####
+# #
+# # MySQL database username
+# #
+# DATABASE_USERNAME="etherpad"
+# db_input high "etherpad-%BRANCH%/database_username" || true
+# db_go
+#
+# db_get "etherpad-%BRANCH%/database_username"
+# if [ "" != "$RET" ]; then
+# DATABASE_USERNAME="$RET"
+# fi
+#
+# apply_config "DATABASE_USERNAME" "${DATABASE_USERNAME}"
+# #
+# #####
+
+# #####
+# #
+# # MySQL database password
+# #
+# DATABASE_PASSWORD="password"
+# db_input high "etherpad-%BRANCH%/database_password" || true
+# db_go
+#
+# db_get "etherpad-%BRANCH%/database_password"
+# if [ "" != "$RET" ]; then
+# DATABASE_PASSWORD="$RET"
+# fi
+#
+# apply_config "DATABASE_PASSWORD" "${DATABASE_PASSWORD}"
+# #
+# #####
+
+
+#####
+#
+# MySQL-Autosetup should be discussed. Simply calling setup-myql-db.sh is
+# insufficient
+#
+# # Auto-setup database
+# db_input medium "etherpad-%BRANCH%/setup_database" || true
+# db_go
+#
+# db_get "etherpad-%BRANCH%/setup_database"
+# if [ "$RET" = "true" ]; then
+# # TODO
+# fi
+#
+#####
+
+
+
+
+
+
+
diff --git a/build/apt/DEBIAN/prerm b/build/apt/DEBIAN/prerm
new file mode 100755
index 0000000..2f54468
--- /dev/null
+++ b/build/apt/DEBIAN/prerm
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+################################################################################
+#
+# Copyright (c) 2010 penSec.IT UG (haftungsbeschränkt)
+# http://www.pensec.it
+# mail@pensec.it
+#
+# Diese Software wird ohne ausdrückliche oder implizierte Garantie
+# bereitgestellt. Auf keinen Fall können die Autoren für irgendwelche Schäden,
+# die durch die Benutzung dieser Software entstehen, haftbar gemacht werden.
+#
+# Es ist dem Auftraggeber gestattet diese Software für jeden Zweck, inklusive
+# kommerzieller Anwendungen, zu benutzten und zu verändern aber nicht
+# weiterzuverbreiten, solange folgende Bedingungen erfüllt sind:
+#
+# 1. Die Herkunft dieser Software darf nicht falsch dargestellt werden; Sie
+# dürfen nicht angeben, dass Sie die ursprüngliche Software geschrieben
+# haben. Wenn Sie diese Software in einem Produkt benutzten, würde eine
+# Erwähnung geschätzt werden, sie ist aber nicht erforderlich.
+# 2. Veränderte Quelltextversionen müssen deutlich als solche
+# gekennzeichnet werden und dürfen nicht als die Originalsoftware
+# dargestellt werden.
+# 3. Diese Notiz darf in den Quelltexten nicht verändert oder gelöscht
+# werden.
+#
+################################################################################
+
+
+
+set -e
+
+# Remove log+data directories, otherwise uninstall will fail
+rm -rf /var/log/etherpad
+rm -rf /usr/share/etherpad/etherpad/data
+
diff --git a/build/apt/DEBIAN/templates b/build/apt/DEBIAN/templates
new file mode 100644
index 0000000..8cf6124
--- /dev/null
+++ b/build/apt/DEBIAN/templates
@@ -0,0 +1,63 @@
+Template: etherpad-%BRANCH%/is_production
+Type: boolean
+Default: false
+Description: Install as production mode?
+ Do you wish to install etherpad in production mode?
+ .
+ Note: be aware that etherpad is under active development and not yet ready
+ for general deployment!
+
+Template: etherpad-%BRANCH%/admin_password
+Type: password
+Default: password
+Description: etherpad administration password
+ Please insert the administration password, default is password.
+
+Template: etherpad-%BRANCH%/port
+Type: string
+Default: 9000
+Description: etherpad tcp port
+ Please insert the port on which etherpad should listen, default is 9000.
+
+Template: etherpad-%BRANCH%/setup_database
+Type: boolean
+Default: false
+Description: Do yo want etherpad to create a database for you?
+ Do you want to use the database wizard to setup a database for etherpad to
+ use?
+ .
+ Note: This wizard only works with local mysql installations. If you want to use
+ a remote mysql database, then answer no and edit
+ /etc/etherpad/etherpad.properties appropriatly.
+
+Template: etherpad-%BRANCH%/database_host
+Type: string
+Default: localhost
+Description: MySQL database hostname
+ Please insert the database hostname, default is localhost.
+
+Template: etherpad-%BRANCH%/database_port
+Type: string
+Default: 3306
+Description: MySQL database port
+ Please insert the database port, default is 3306.
+
+Template: etherpad-%BRANCH%/database_name
+Type: string
+Default: etherpad
+Description: MySQL database name
+ Please insert the database name, default is etherpad.
+
+Template: etherpad-%BRANCH%/database_username
+Type: string
+Default: etherpad
+Description: MySQL database username
+ Please insert the database username, default is etherpad.
+
+Template: etherpad-%BRANCH%/database_password
+Type: password
+Default: password
+Description: MySQL database password
+ Please insert the password for the specified database user, default is
+ password.
+
diff --git a/build/apt/README b/build/apt/README
new file mode 100644
index 0000000..7dba49b
--- /dev/null
+++ b/build/apt/README
@@ -0,0 +1,25 @@
+README
+======
+
+This is a simple script to build debian packages from different etherpad
+repositories. All you have to do is call ./do.sh and select the repository to
+build from.
+
+Depending on the repository you use you have to have installed mercurial or
+git-core in addition to the following packages:
+
+ * debconf (>= 0.2.17)
+ * dpkg
+ * sun-java6-jdk
+ * scala
+ * mysql-client
+ * libmysql-java
+ * bash
+
+
+
+---
+
+If you need commercial support on etherpad don't hesitate to contact
+mail@pensec.it
+
diff --git a/build/apt/TODO b/build/apt/TODO
new file mode 100644
index 0000000..9389c82
--- /dev/null
+++ b/build/apt/TODO
@@ -0,0 +1,7 @@
+TODO
+====
+
+ * Auto-Database setup
+ * etherpad-official replaces etherpad-deprecated and etherpad-devel (and vice-
+ versa)
+
diff --git a/build/apt/build/build.sh b/build/apt/build/build.sh
new file mode 100755
index 0000000..427bdc8
--- /dev/null
+++ b/build/apt/build/build.sh
@@ -0,0 +1,246 @@
+#!/bin/bash
+
+################################################################################
+#
+# Copyright (c) 2010 penSec.IT UG (haftungsbeschränkt)
+# http://www.pensec.it
+# mail@pensec.it
+#
+# Diese Software wird ohne ausdrückliche oder implizierte Garantie
+# bereitgestellt. Auf keinen Fall können die Autoren für irgendwelche Schäden,
+# die durch die Benutzung dieser Software entstehen, haftbar gemacht werden.
+#
+# Es ist dem Auftraggeber gestattet diese Software für jeden Zweck, inklusive
+# kommerzieller Anwendungen, zu benutzten und zu verändern aber nicht
+# weiterzuverbreiten, solange folgende Bedingungen erfüllt sind:
+#
+# 1. Die Herkunft dieser Software darf nicht falsch dargestellt werden; Sie
+# dürfen nicht angeben, dass Sie die ursprüngliche Software geschrieben
+# haben. Wenn Sie diese Software in einem Produkt benutzten, würde eine
+# Erwähnung geschätzt werden, sie ist aber nicht erforderlich.
+# 2. Veränderte Quelltextversionen müssen deutlich als solche
+# gekennzeichnet werden und dürfen nicht als die Originalsoftware
+# dargestellt werden.
+# 3. Diese Notiz darf in den Quelltexten nicht verändert oder gelöscht
+# werden.
+#
+################################################################################
+
+
+
+#####
+# Baut etherpad aus den Quellen und erstellt ein Debian/Ubuntu Paket
+#
+# @param $1 (optional) Wenn rebuild, dann wird das Repository neu ausgecheckt
+# anstatt nur geupdated zu werden
+# @param $REPOSITORY_URL URL von welcher das Repository geladen werden soll
+# @param $REPOSITORY_NAME Name des Paketes welches gebaut werden soll
+# @param $REPOSITORY_TYPE Element der Menge {hg, git}
+#
+if [ "" == "${REPOSITORY_URL}" ]; then
+ echo "Missing environment variable REPOSITORY_URL"
+ exit 1
+fi
+if [ "" == "${REPOSITORY_NAME}" ]; then
+ echo "Missing environment variable REPOSITORY_NAME"
+ exit 1
+fi
+if [ "" == "${REPOSITORY_TYPE}" ]; then
+ echo "Missing environment variable REPOSITORY_TYPE"
+ exit 1
+fi
+
+
+
+#####
+# Folgende Parameter sind an das System auf welchem gebaupt wird anzupassen:
+#
+export JAVA_HOME=/usr/lib/jvm/java-6-sun/
+export SCALA_HOME=/usr/share/java
+export MYSQL_CONNECTOR_JAR=/usr/share/java/mysql-connector-java.jar
+export JAVA="$JAVA_HOME/bin/java"
+export SCALA="$SCALA_HOME/bin/scala"
+export PATH="$JAVA_HOME/bin:$SCALA_HOME/bin:$PATH"
+#
+#####
+
+
+#####
+# Interne Konfiguration, muss nicht angepasst werden
+#
+REPOSITORY="${REPOSITORY_URL}"
+BRANCH="${REPOSITORY_NAME}"
+
+TMP_DIR=".tmp.${REPOSITORY_NAME}"
+BUILD_DIR=".build.${REPOSITORY_NAME}"
+PACKAGE_DIR=".package.${REPOSITORY_NAME}"
+REVISION_FILE=".revision.${REPOSITORY_NAME}"
+
+REBUILD="no"
+if [ "rebuild" == "${1}" ]; then
+ REBUILD="yes"
+fi
+#
+#####
+
+
+
+# Einfaches Update ist nur ausreichend, wenn Repository bereits ausgecheckt
+if [ "yes" != "${REBUILD}" ]; then
+ if [ -d "${TMP_DIR}" ]; then
+ bash -c "cd ${TMP_DIR}; ${REPOSITORY_TYPE} pull"
+# bash -c "cd ${TMP_DIR}; ${REPOSITORY_TYPE} checkout HEAD^1"
+ else
+ echo "Repository does not exist, will fetch"
+ REBUILD="yes"
+ fi
+fi
+
+# Repository komplett neu auschecken statt nur upzudaten
+if [ "yes" == "${REBUILD}" ]; then
+ if [ -d "${TMP_DIR}" ]; then
+ rm -rf "${TMP_DIR}"
+ fi
+
+ # Source aus ,,Offizieller'' Quelle holen
+ $REPOSITORY_TYPE clone "${REPOSITORY}" "${TMP_DIR}"
+fi
+
+
+
+# Checkout halbwegs ueberpruefen
+if [ -d "${TMP_DIR}" ]; then
+ echo "Checkout seesm successful, continuing..."
+else
+ echo "Error while checkout, missing directory ${TMP_DIR}"
+ exit 1
+fi
+
+# Haesslicher Fix um mit dem Google Repository arbeiten zu koennen (trunk
+# und branches in mercurial, wtf?)
+if [ -d "${TMP_DIR}/trunk" ]; then
+ touch "${TMP_DIR}/LICENSE"
+ touch "${TMP_DIR}/README.md"
+ bash -c "cd ${TMP_DIR}; cp -r trunk/* ./"
+fi
+
+
+
+# Jar neu bauen
+echo ""
+echo "Trying to apply patch. If it detects the patch doesn't match just skip"
+echo ""
+cp "build/makejar.diff" "${TMP_DIR}/makejar.diff"
+bash -c "cd ${TMP_DIR}; patch -p1 < makejar.diff"
+bash -c "cd ${TMP_DIR}/infrastructure; ./bin/makejar.sh"
+bash -c "cd ${TMP_DIR}/infrastructure/ace; bin/make normal etherpad"
+cp "${TMP_DIR}/infrastructure/build/appjet.jar" "${TMP_DIR}/etherpad/appjet-eth-dev.jar"
+
+
+
+# Testet die gebaute Version
+#bash -c "./build/test-build.sh"
+
+
+
+# Buildrevision erhoehen und Kontrolldatei bauen
+REVISION="0"
+if [ -f "${REVISION_FILE}" ]; then
+ REVISION=`cat "${REVISION_FILE}"`
+ REVISION=`expr $REVISION + 1`
+fi
+echo $REVISION > "${REVISION_FILE}"
+
+# Debian-Control-File patchen
+cp "DEBIAN/control" "${TMP_DIR}/control.0"
+sed "s/%BRANCH%/${BRANCH}/" "${TMP_DIR}/control.0" > "${TMP_DIR}/control.1"
+sed "s/%REVISION%/${REVISION}/" "${TMP_DIR}/control.1" > "${TMP_DIR}/control.2"
+cp "${TMP_DIR}/control.2" "${TMP_DIR}/control"
+
+# Installations- und Deinstallationsskript patchen
+cp "DEBIAN/prerm" "${TMP_DIR}/prerm"
+cp "DEBIAN/postinst" "${TMP_DIR}/postinst.0"
+sed "s/%BRANCH%/${BRANCH}/" "${TMP_DIR}/postinst.0" > "${TMP_DIR}/postinst.1"
+cp "${TMP_DIR}/postinst.1" "${TMP_DIR}/postinst"
+
+# debconf Templates patchen
+cp "DEBIAN/templates" "${TMP_DIR}/templates.0"
+sed "s/%BRANCH%/${BRANCH}/" "${TMP_DIR}/templates.0" > "${TMP_DIR}/templates.1"
+cp "${TMP_DIR}/templates.1" "${TMP_DIR}/templates"
+
+# Init-Skript patchen
+cp "etc/init.d/etherpad" "${TMP_DIR}/init.0"
+sed "s/%BRANCH%/${BRANCH}/" "${TMP_DIR}/init.0" > "${TMP_DIR}/init.1"
+cp "${TMP_DIR}/init.1" "${TMP_DIR}/init"
+
+# Konfigurationsverzeichnis kopieren
+cp -r "etc" "${TMP_DIR}/etc"
+
+
+
+# Paketumgebung bauen
+if [ -d "${BUILD_DIR}" ]; then
+ sudo rm -r "${BUILD_DIR}"
+fi
+mkdir "${BUILD_DIR}"
+mkdir -p "${BUILD_DIR}/DEBIAN"
+mkdir -p "${BUILD_DIR}/usr/share/etherpad"
+mkdir -p "${BUILD_DIR}/usr/share/doc/etherpad"
+mkdir -p "${BUILD_DIR}/var/log/etherpad"
+
+
+
+# Benoetigte Dateien zusammenfuehren
+cp "${TMP_DIR}/control" "${BUILD_DIR}/DEBIAN/control"
+cp "${TMP_DIR}/postinst" "${BUILD_DIR}/DEBIAN/postinst"
+cp "${TMP_DIR}/prerm" "${BUILD_DIR}/DEBIAN/prerm"
+cp "${TMP_DIR}/templates" "${BUILD_DIR}/DEBIAN/templates"
+cp -r "${TMP_DIR}/etc" "${BUILD_DIR}/"
+cp "${TMP_DIR}/init" "${BUILD_DIR}/etc/init.d/etherpad"
+cp -r "${TMP_DIR}/etherpad" "${BUILD_DIR}/usr/share/etherpad"
+cp "build/run.sh" "${BUILD_DIR}/usr/share/etherpad/etherpad/bin"
+mkdir -p "${BUILD_DIR}/usr/share/etherpad/etherpad/data"
+cp -r "${TMP_DIR}/infrastructure" "${BUILD_DIR}/usr/share/etherpad"
+cp "${TMP_DIR}/COPYING" "${BUILD_DIR}/usr/share/doc/etherpad"
+cp "${TMP_DIR}/LICENSE" "${BUILD_DIR}/usr/share/doc/etherpad"
+cp "${TMP_DIR}/README.md" "${BUILD_DIR}/usr/share/doc/etherpad"
+
+
+
+# Eigentliches Paket bauen
+sudo chown -R root:root "${BUILD_DIR}"
+sudo chmod +x "${BUILD_DIR}/DEBIAN/postinst"
+sudo chmod +x "${BUILD_DIR}/DEBIAN/prerm"
+sudo chmod +x "${BUILD_DIR}/etc/init.d/etherpad"
+sudo chmod -R 777 "${BUILD_DIR}/usr/share/etherpad/etherpad/data"
+
+if [ -d "${PACKAGE_DIR}" ]; then
+ rm -rf "${PACKAGE_DIR}"
+fi
+mkdir "${PACKAGE_DIR}"
+
+dpkg-deb --build "${BUILD_DIR}" "${PACKAGE_DIR}"
+
+
+
+# Paket in lokales Repository aufnehmen
+PACKAGE=`bash -c "cd ${PACKAGE_DIR}; find . -name *.deb"`
+
+if [ "yes" == "${DEPLOY_TO_LOCAL_REPOSITORY}" ]; then
+ if [ -f "${PACKAGE_DIR}/${PACKAGE}" ]; then
+ cp "${PACKAGE_DIR}/${PACKAGE}" "/var/www/packages"
+ bash -c "cd /var/www/packages; reprepro -b . includedeb lenny ${PACKAGE}; rm ${PACKAGE}"
+ else
+ echo "No package in ${PACKAGE_DIR}"
+ fi
+fi
+
+echo "Finished building package ${PACKAGE}"
+
+
+
+
+
+
+
+
diff --git a/build/apt/build/makejar.diff b/build/apt/build/makejar.diff
new file mode 100644
index 0000000..6e0d44e
--- /dev/null
+++ b/build/apt/build/makejar.diff
@@ -0,0 +1,17 @@
+diff -r 81287c8af1ac infrastructure/bin/makejar.sh
+--- a/infrastructure/bin/makejar.sh Fri Dec 18 18:44:23 2009 +1100
++++ b/infrastructure/bin/makejar.sh Sat Dec 19 09:50:05 2009 -0500
+@@ -32,11 +32,11 @@
+
+ TMPSTORE=/tmp/ajbuild-tmpstore-`date +%s`
+
+-JARFILES=`echo $SCALA_HOME/lib/scala-library.jar lib/*.jar lib/manifest`
++JARFILES=`echo $SCALA_HOME/scala-library.jar lib/*.jar lib/manifest`
+ function genjar {
+ echo "unzipping JARs..."
+ pushd $1 >> /dev/null
+- $JAR xf $SCALA_HOME/lib/scala-library.jar
++ $JAR xf $SCALA_HOME/scala-library.jar
+ rm -rf META-INF
+ for a in ../../lib/*.jar; do
+ $JAR xf $a
diff --git a/build/apt/build/run.sh b/build/apt/build/run.sh
new file mode 100755
index 0000000..8e2bbeb
--- /dev/null
+++ b/build/apt/build/run.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+################################################################################
+#
+# Copyright (c) 2010 penSec.IT UG (haftungsbeschränkt)
+# http://www.pensec.it
+# mail@pensec.it
+#
+# Diese Software wird ohne ausdrückliche oder implizierte Garantie
+# bereitgestellt. Auf keinen Fall können die Autoren für irgendwelche Schäden,
+# die durch die Benutzung dieser Software entstehen, haftbar gemacht werden.
+#
+# Es ist dem Auftraggeber gestattet diese Software für jeden Zweck, inklusive
+# kommerzieller Anwendungen, zu benutzten und zu verändern aber nicht
+# weiterzuverbreiten, solange folgende Bedingungen erfüllt sind:
+#
+# 1. Die Herkunft dieser Software darf nicht falsch dargestellt werden; Sie
+# dürfen nicht angeben, dass Sie die ursprüngliche Software geschrieben
+# haben. Wenn Sie diese Software in einem Produkt benutzten, würde eine
+# Erwähnung geschätzt werden, sie ist aber nicht erforderlich.
+# 2. Veränderte Quelltextversionen müssen deutlich als solche
+# gekennzeichnet werden und dürfen nicht als die Originalsoftware
+# dargestellt werden.
+# 3. Diese Notiz darf in den Quelltexten nicht verändert oder gelöscht
+# werden.
+#
+################################################################################
+
+
+
+
+
+bash -c "`dirname $0`/run-local.sh" > "/var/log/etherpad/log" 2> "/var/log/etherpad/error"
+
diff --git a/build/apt/build/test.sh b/build/apt/build/test.sh
new file mode 100755
index 0000000..85c435d
--- /dev/null
+++ b/build/apt/build/test.sh
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+################################################################################
+#
+# Copyright (c) 2010 penSec.IT UG (haftungsbeschränkt)
+# http://www.pensec.it
+# mail@pensec.it
+#
+# Diese Software wird ohne ausdrückliche oder implizierte Garantie
+# bereitgestellt. Auf keinen Fall können die Autoren für irgendwelche Schäden,
+# die durch die Benutzung dieser Software entstehen, haftbar gemacht werden.
+#
+# Es ist dem Auftraggeber gestattet diese Software für jeden Zweck, inklusive
+# kommerzieller Anwendungen, zu benutzten und zu verändern aber nicht
+# weiterzuverbreiten, solange folgende Bedingungen erfüllt sind:
+#
+# 1. Die Herkunft dieser Software darf nicht falsch dargestellt werden; Sie
+# dürfen nicht angeben, dass Sie die ursprüngliche Software geschrieben
+# haben. Wenn Sie diese Software in einem Produkt benutzten, würde eine
+# Erwähnung geschätzt werden, sie ist aber nicht erforderlich.
+# 2. Veränderte Quelltextversionen müssen deutlich als solche
+# gekennzeichnet werden und dürfen nicht als die Originalsoftware
+# dargestellt werden.
+# 3. Diese Notiz darf in den Quelltexten nicht verändert oder gelöscht
+# werden.
+#
+################################################################################
+
+
+
+
+
+#####
+# Muss von rebuild.sh aufgerufen werden
+#####
+
+
+
+# Datenbank leeren damit etherpad testweiste gestartet werden kann
+echo "I'm going to lunch MySQL now, you maybe have to enter your root@localhost password"
+sudo /etc/init.d/mysql start
+
+DATABASE_NAME="etherpad"
+DATABASE_USER="etherpad"
+DROP_DATABASE="DROP DATABASE ${DATABASE_NAME}"
+CREATE_DATABASE="CREATE DATABASE ${DATABASE_NAME}"
+DROP_USER="DROP USER '${DATABASE_USER}'@'localhost'"
+CREATE_USER="GRANT ALL PRIVILEGES ON ${DATABASE_NAME}.* TO '${DATABASE_USER}'@'localhost' identified by 'password';"
+echo "${DROP_DATABASE}; ${CREATE_DATABASE}; ${DROP_USER}; ${CREATE_USER}" | mysql -u root -p | grep etherpad
+
+
+
+# Etherpad starten und warten bis HTTP-Server laeuft
+echo "I'm going to lunch etherpad in a clean environment, try if it works on http://localhost:9000/"
+echo "Kill with ^C to build debian package (waiting 10 seconds)"
+sleep 10
+bash -c "cd ${TMP_DIR}/etherpad; ./bin/run-local.sh"
+
+
+
+
+
diff --git a/build/apt/do.sh b/build/apt/do.sh
new file mode 100755
index 0000000..345cde0
--- /dev/null
+++ b/build/apt/do.sh
@@ -0,0 +1,133 @@
+#!/bin/bash
+
+################################################################################
+#
+# Copyright (c) 2010 penSec.IT UG (haftungsbeschränkt)
+# http://www.pensec.it
+# mail@pensec.it
+#
+# Diese Software wird ohne ausdrückliche oder implizierte Garantie
+# bereitgestellt. Auf keinen Fall können die Autoren für irgendwelche Schäden,
+# die durch die Benutzung dieser Software entstehen, haftbar gemacht werden.
+#
+# Es ist dem Auftraggeber gestattet diese Software für jeden Zweck, inklusive
+# kommerzieller Anwendungen, zu benutzten und zu verändern aber nicht
+# weiterzuverbreiten, solange folgende Bedingungen erfüllt sind:
+#
+# 1. Die Herkunft dieser Software darf nicht falsch dargestellt werden; Sie
+# dürfen nicht angeben, dass Sie die ursprüngliche Software geschrieben
+# haben. Wenn Sie diese Software in einem Produkt benutzten, würde eine
+# Erwähnung geschätzt werden, sie ist aber nicht erforderlich.
+# 2. Veränderte Quelltextversionen müssen deutlich als solche
+# gekennzeichnet werden und dürfen nicht als die Originalsoftware
+# dargestellt werden.
+# 3. Diese Notiz darf in den Quelltexten nicht verändert oder gelöscht
+# werden.
+#
+################################################################################
+
+
+
+#####
+#
+# To build a Debian/Ubuntu package simply run this script. It will prompt you
+# for the repository to build from.
+#
+# Dependencies: debconf (>= 0.2.17), dpkg, sun-java6-jdk, scala, mysql-client,
+# libmysql-java, bash, mercurial | git-core
+#
+#####
+
+
+
+#####
+#
+# There has to be a better way of doing this ;-)
+#
+REPOSITORY_0_URL="https://etherpad.googlecode.com/hg/trunk"
+REPOSITORY_0_NAME="deprecated"
+REPOSITORY_0_TYPE="hg"
+REPOSITORY_1_URL="git://github.com/ether/pad.git"
+REPOSITORY_1_NAME="official"
+REPOSITORY_1_TYPE="git"
+REPOSITORY_2_URL="git://github.com/redhog/pad.git"
+REPOSITORY_2_NAME="devel"
+REPOSITORY_2_TYPE="git"
+REPOSITORY_3_URL="git://github.com/johnyma22/pad.git"
+REPOSITORY_3_NAME="johny"
+REPOSITORY_3_TYPE="git"
+REPOSITORY_4_URL="git://github.com/Pita/pad.git"
+REPOSITORY_4_NAME="pita"
+REPOSITORY_4_TYPE="git"
+REPOSITORY_5_URL="./../../"
+REPOSITORY_5_NAME="local"
+REPOSITORY_5_TYPE="git"
+
+
+# Tell the user his choises
+echo "Please choose the repository to build a debian package from:"
+echo ""
+
+for i in {0..5}
+do
+ URL="REPOSITORY_${i}_URL"
+ NAME="REPOSITORY_${i}_NAME"
+ TYPE="REPOSITORY_${i}_TYPE"
+
+ echo " ${i}) ${!NAME} ${!URL}"
+done
+echo ""
+read -p "Repository id: " REPOSITORY
+
+
+
+# Test if user's too stupid to input correct number
+URL="REPOSITORY_${REPOSITORY}_URL"
+NAME="REPOSITORY_${REPOSITORY}_NAME"
+TYPE="REPOSITORY_${REPOSITORY}_TYPE"
+
+if [ "" == "${!URL}" ]; then
+ echo "Invalid repository id \"${REPOSITORY}\""
+ exit 1
+fi
+
+
+# Communicate repository details to build script
+export REPOSITORY_URL="${!URL}"
+export REPOSITORY_NAME="${!NAME}"
+export REPOSITORY_TYPE="${!TYPE}"
+#
+#####
+
+
+
+#####
+#
+# Is a complete rebuild necessary or is a simple update sufficient
+#
+echo ""
+read -p "Purge before rebuild (yes/no) [n]: " REBUILD
+
+if [ "y" == "${REBUILD}" ]; then
+ echo "You answered \"${REBUILD}\", will purge before rebuilding"
+ REBUILD="rebuild"
+else
+ echo "You answered \"${REBUILD}\", will try ${!TYPE} pull before rebuilding"
+fi
+#
+#####
+
+
+
+#####
+#
+# Tell user what we're going to to and then do it
+#
+echo ""
+echo "Will build package etherpad-${!NAME} form ${!TYPE}:${!URL}, please be patient..."
+echo ""
+
+bash -c "./build/build.sh ${REBUILD}"
+#
+#####
+
diff --git a/build/apt/etc/etherpad/etherpad.properties b/build/apt/etc/etherpad/etherpad.properties
new file mode 100644
index 0000000..69114c7
--- /dev/null
+++ b/build/apt/etc/etherpad/etherpad.properties
@@ -0,0 +1,16 @@
+ajstdlibHome = ../infrastructure/framework-src/modules
+appjetHome = ./data/appjet
+devMode = true
+etherpad.adminPass = %ADMIN_PASSWORD%
+etherpad.fakeProduction = false
+etherpad.isProduction = %IS_PRODUCTION%
+etherpad.SQL_JDBC_DRIVER = com.mysql.jdbc.Driver
+etherpad.SQL_JDBC_URL = jdbc:mysql://%DATABASE_HOST%:%DATABASE_PORT%/%DATABASE_NAME%
+etherpad.SQL_PASSWORD = %DATABASE_PASSWORD%
+etherpad.SQL_USERNAME = %DATABASE_USERNAME%
+listen = %PORT%
+logDir = /var/log/etherpad
+modulePath = ./src
+transportPrefix = /comet
+transportUseWildcardSubdomains = true
+useVirtualFileRoot = ./src
diff --git a/build/apt/etc/etherpad/properties/admin-password b/build/apt/etc/etherpad/properties/admin-password
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/build/apt/etc/etherpad/properties/admin-password
diff --git a/build/apt/etc/etherpad/properties/database-host b/build/apt/etc/etherpad/properties/database-host
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/build/apt/etc/etherpad/properties/database-host
diff --git a/build/apt/etc/etherpad/properties/database-name b/build/apt/etc/etherpad/properties/database-name
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/build/apt/etc/etherpad/properties/database-name
diff --git a/build/apt/etc/etherpad/properties/database-password b/build/apt/etc/etherpad/properties/database-password
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/build/apt/etc/etherpad/properties/database-password
diff --git a/build/apt/etc/etherpad/properties/database-port b/build/apt/etc/etherpad/properties/database-port
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/build/apt/etc/etherpad/properties/database-port
diff --git a/build/apt/etc/etherpad/properties/database-username b/build/apt/etc/etherpad/properties/database-username
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/build/apt/etc/etherpad/properties/database-username
diff --git a/build/apt/etc/etherpad/properties/is-production b/build/apt/etc/etherpad/properties/is-production
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/build/apt/etc/etherpad/properties/is-production
diff --git a/build/apt/etc/etherpad/properties/port b/build/apt/etc/etherpad/properties/port
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/build/apt/etc/etherpad/properties/port
diff --git a/build/apt/etc/init.d/etherpad b/build/apt/etc/init.d/etherpad
new file mode 100755
index 0000000..225b7e7
--- /dev/null
+++ b/build/apt/etc/init.d/etherpad
@@ -0,0 +1,243 @@
+#! /bin/bash
+
+### BEGIN INIT INFO
+# Provides: etherpad-%BRANCH%
+# Required-Start: $local_fs $remote_fs
+# Required-Stop: $local_fs $remote_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: S 0 1 6
+# Short-Description: etherpad initscript
+# Description: EtherPad is the only web-based word processor that allows
+# people to work together in really real-time.
+# .
+# When multiple people edit the same document simultaneously,
+# any changes are instantly reflected on everyone's screen.
+# The result is a new and productive way to collaborate on
+# text documents, useful for meeting notes, drafting
+# sessions, education, team programming, and more.
+### END INIT INFO
+
+# Author: penSec.IT UG (haftungsbeschränkt) <mail@pensec.it>
+
+################################################################################
+#
+# Copyright (c) 2010 penSec.IT UG (haftungsbeschränkt)
+# http://www.pensec.it
+# mail@pensec.it
+#
+# Diese Software wird ohne ausdrückliche oder implizierte Garantie
+# bereitgestellt. Auf keinen Fall können die Autoren für irgendwelche Schäden,
+# die durch die Benutzung dieser Software entstehen, haftbar gemacht werden.
+#
+# Es ist dem Auftraggeber gestattet diese Software für jeden Zweck, inklusive
+# kommerzieller Anwendungen, zu benutzten und zu verändern aber nicht
+# weiterzuverbreiten, solange folgende Bedingungen erfüllt sind:
+#
+# 1. Die Herkunft dieser Software darf nicht falsch dargestellt werden; Sie
+# dürfen nicht angeben, dass Sie die ursprüngliche Software geschrieben
+# haben. Wenn Sie diese Software in einem Produkt benutzten, würde eine
+# Erwähnung geschätzt werden, sie ist aber nicht erforderlich.
+# 2. Veränderte Quelltextversionen müssen deutlich als solche
+# gekennzeichnet werden und dürfen nicht als die Originalsoftware
+# dargestellt werden.
+# 3. Diese Notiz darf in den Quelltexten nicht verändert oder gelöscht
+# werden.
+#
+################################################################################
+
+# Do NOT "set -e"
+
+
+
+#####
+#
+# Patches the configuration file by replacing ,,%$1%'' with the contents of
+# $2
+#
+# @param $1 Configuration File which contains the value to set to
+# @param $2 Configuration key to apply (can be done only once)
+# @param $3 Konfigurationsdatei
+#
+# @deprecated Wird nicht mehr verwendet
+#
+function apply_config() {
+ CONFIG_FILE="${3}"
+ TMP_FILE="/tmp/etherpad.properties"
+
+ CONFIG_KEY="$2"
+ CONFIG_VALUE=`cat $1`
+
+ sed "s/%$CONFIG_KEY%/$CONFIG_VALUE/" $CONFIG_FILE > $TMP_FILE
+ cp $TMP_FILE $CONFIG_FILE
+ rm $TMP_FILE
+}
+#
+#####
+
+
+
+
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/usr/sbin:/usr/bin:/sbin:/bin
+DESC="etherpad daemon"
+NAME="etherpad"
+DAEMON_BASE="/usr/share/etherpad/etherpad"
+DAEMON=$DAEMON_BASE/bin/run.sh
+DAEMON_ARGS=""
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+
+# Exit if the package is not installed
+[ -x "$DAEMON" ] || exit 0
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+# Load the VERBOSE setting and other rcS variables
+[ -f /etc/default/rcS ] && . /etc/default/rcS
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
+. /lib/lsb/init-functions
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+ CONFIGURATION_BASE="/etc/etherpad"
+ CONFIGURATION_SRC="${CONFIGURATION_BASE}/etherpad.properties"
+ CONFIGURATION_DEST="${DAEMON_BASE}/etc/etherpad.localdev-default.properties"
+
+
+ # Reset configuration
+ cp "${CONFIGURATION_BASE}/etherpad.properties" "${CONFIGURATION_DEST}"
+
+
+ # Apply configuration properties
+ apply_config "${CONFIGURATION_BASE}/properties/is-production" "IS_PRODUCTION" "${CONFIGURATION_DEST}"
+ apply_config "${CONFIGURATION_BASE}/properties/admin-password" "ADMIN_PASSWORD" "${CONFIGURATION_DEST}"
+ apply_config "${CONFIGURATION_BASE}/properties/port" "PORT" "${CONFIGURATION_DEST}"
+ apply_config "${CONFIGURATION_BASE}/properties/database-host" "DATABASE_HOST" "${CONFIGURATION_DEST}"
+ apply_config "${CONFIGURATION_BASE}/properties/database-port" "DATABASE_PORT" "${CONFIGURATION_DEST}"
+ apply_config "${CONFIGURATION_BASE}/properties/database-name" "DATABASE_NAME" "${CONFIGURATION_DEST}"
+ apply_config "${CONFIGURATION_BASE}/properties/database-username" "DATABASE_USERNAME" "${CONFIGURATION_DEST}"
+ apply_config "${CONFIGURATION_BASE}/properties/database-password" "DATABASE_PASSWORD" "${CONFIGURATION_DEST}"
+
+
+ # Give the etherpad user the configuration file
+ chown etherpad:etherpad "${CONFIGURATION_DEST}"
+
+
+
+ # Return
+ # 0 if daemon has been started
+ # 1 if daemon was already running
+ # 2 if daemon could not be started
+ start-stop-daemon --background --chdir $DAEMON_BASE --chuid etherpad:etherpad --start --quiet --make-pidfile --pidfile $PIDFILE --exec $DAEMON --test \
+ || return 1
+ start-stop-daemon --background --chdir $DAEMON_BASE --chuid etherpad:etherpad --start --quiet --make-pidfile --pidfile $PIDFILE --exec $DAEMON -- \
+ $DAEMON_ARGS \
+ || return 2
+ # Add code here, if necessary, that waits for the process to be ready
+ # to handle requests from services started subsequently which depend
+ # on this one. As a last resort, sleep for some time.
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+ # Return
+ # 0 if daemon has been stopped
+ # 1 if daemon was already stopped
+ # 2 if daemon could not be stopped
+ # other if a failure occurred
+ start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
+ RETVAL="$?"
+ [ "$RETVAL" = 2 ] && return 2
+ # Wait for children to finish too if this is a daemon that forks
+ # and if the daemon is only ever run from this initscript.
+ # If the above conditions are not satisfied then add some other code
+ # that waits for the process to drop all resources that could be
+ # needed by services started subsequently. A last resort is to
+ # sleep for some time.
+ start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
+ [ "$?" = 2 ] && return 2
+ # Many daemons don't delete their pidfiles when they exit.
+ rm -f $PIDFILE
+ return "$RETVAL"
+}
+
+#
+# Function that sends a SIGHUP to the daemon/service
+#
+do_reload() {
+ #
+ # If the daemon can reload its configuration without
+ # restarting (for example, when it is sent a SIGHUP),
+ # then implement that here.
+ #
+ start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
+ return 0
+}
+
+case "$1" in
+ start)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+ do_start
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ stop)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ #reload|force-reload)
+ #
+ # If do_reload() is not implemented then leave this commented out
+ # and leave 'force-reload' as an alias for 'restart'.
+ #
+ #log_daemon_msg "Reloading $DESC" "$NAME"
+ #do_reload
+ #log_end_msg $?
+ #;;
+ restart|force-reload)
+ #
+ # If the "reload" option is implemented then remove the
+ # 'force-reload' alias
+ #
+ log_daemon_msg "Restarting $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1)
+ do_start
+ case "$?" in
+ 0) log_end_msg 0 ;;
+ 1) log_end_msg 1 ;; # Old process is still running
+ *) log_end_msg 1 ;; # Failed to start
+ esac
+ ;;
+ *)
+ # Failed to stop
+ log_end_msg 1
+ ;;
+ esac
+ ;;
+ *)
+ #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
+ echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
+ exit 3
+ ;;
+esac
+
+:
+