From 8465b116407c1d477d852785d5bd499665296b24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?penSec=2EIT=20UG=20=28haftungsbeschr=C3=A4nkt=29?= Date: Sun, 4 Apr 2010 04:19:46 +0200 Subject: apt Buildsystem --- build/apt/DEBIAN/postinst | 291 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 291 insertions(+) create mode 100755 build/apt/DEBIAN/postinst (limited to 'build/apt/DEBIAN/postinst') 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 +# +##### + + + + + + + -- cgit v1.2.3-1-g7c22 From 59bd14e6deb341909d48cf2c6dc75483bdbd1c4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?penSec=2EIT=20UG=20=28haftungsbeschr=C3=A4nkt=29?= Date: Sun, 4 Apr 2010 16:08:18 +0200 Subject: Relicensed under The Apache License, Version 2.0 --- build/apt/DEBIAN/postinst | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) (limited to 'build/apt/DEBIAN/postinst') diff --git a/build/apt/DEBIAN/postinst b/build/apt/DEBIAN/postinst index d92c6a7..589f73d 100755 --- a/build/apt/DEBIAN/postinst +++ b/build/apt/DEBIAN/postinst @@ -6,23 +6,17 @@ # 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. +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at # -# 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. +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. # ################################################################################ @@ -283,9 +277,3 @@ configuration_property "database_password" "database-password" "DATABASE_PASSWOR # ##### - - - - - - -- cgit v1.2.3-1-g7c22 From 88d7621d96efb657c8a1f347d7c260bcd4d83a88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?penSec=2EIT=20UG=20=28haftungsbeschr=C3=A4nkt=29?= Date: Sun, 4 Apr 2010 16:55:10 +0200 Subject: Complete translation to english language --- build/apt/DEBIAN/postinst | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'build/apt/DEBIAN/postinst') diff --git a/build/apt/DEBIAN/postinst b/build/apt/DEBIAN/postinst index 589f73d..6f595e0 100755 --- a/build/apt/DEBIAN/postinst +++ b/build/apt/DEBIAN/postinst @@ -38,20 +38,21 @@ db_version 2.0 ##### # -# Fragt einen Konfigurationswert ab und schreibt ihn in die Eigenschaftsdatei +# Propts the user for a configuration value and writes it into a property file # -# @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 +# @param $1 Name of the debconfig template to prompt +# @param $2 File to write the answer to +# @param $3 deprecated # function configuration_property() { TEMPLATE="${1}" PROPERTY_FILE="/etc/etherpad/properties/${2}" PLACEHOLDER="${3}" - PROPERTY=`cat "${PROPERTY_FILE}"` + PROPERTY="" + if [ -f "${PROPERTY_FILE}" ]; then + PROPERTY=`cat "${PROPERTY_FILE}"` + fi db_input high "etherpad-%BRANCH%/${TEMPLATE}" || true db_go -- cgit v1.2.3-1-g7c22 From 4f2ddecc37b8d42bd6dc95b7aaa48d7cd9cbdfee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?penSec=2EIT=20UG=20=28haftungsbeschr=C3=A4nkt=29?= Date: Sun, 4 Apr 2010 16:57:30 +0200 Subject: Removed unused code --- build/apt/DEBIAN/postinst | 137 ---------------------------------------------- 1 file changed, 137 deletions(-) (limited to 'build/apt/DEBIAN/postinst') diff --git a/build/apt/DEBIAN/postinst b/build/apt/DEBIAN/postinst index 6f595e0..f872508 100755 --- a/build/apt/DEBIAN/postinst +++ b/build/apt/DEBIAN/postinst @@ -125,143 +125,6 @@ configuration_property "database_password" "database-password" "DATABASE_PASSWOR -# ##### -# # -# # 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 -- cgit v1.2.3-1-g7c22