[DRE-commits] r3917 - in trunk/redmine/debian: . doc/examples po
Jérémy Lal
kapouer-guest at alioth.debian.org
Mon Aug 10 10:37:21 UTC 2009
Author: kapouer-guest
Date: 2009-08-10 10:37:21 +0000 (Mon, 10 Aug 2009)
New Revision: 3917
Modified:
trunk/redmine/debian/README.Debian
trunk/redmine/debian/README.Source
trunk/redmine/debian/changelog
trunk/redmine/debian/config
trunk/redmine/debian/dirs
trunk/redmine/debian/doc/examples/apache2-alias.conf
trunk/redmine/debian/doc/examples/apache2-host.conf
trunk/redmine/debian/doc/examples/lighttpd-host-alias.conf
trunk/redmine/debian/doc/examples/lighttpd-host.conf
trunk/redmine/debian/doc/examples/lighttpd-socket-alias.conf
trunk/redmine/debian/doc/examples/lighttpd-socket.conf
trunk/redmine/debian/po/fr.po
trunk/redmine/debian/po/templates.pot
trunk/redmine/debian/postinst
trunk/redmine/debian/postrm
trunk/redmine/debian/prerm
trunk/redmine/debian/templates
Log:
* Added support for defining multiple instances of redmine.
This support does not handle previous redmine package version update.
* Update www examples to match new directory layout
* define RAKE_VERBOSE in postinst file
* Update READMEs
Modified: trunk/redmine/debian/README.Debian
===================================================================
--- trunk/redmine/debian/README.Debian 2009-08-09 23:26:47 UTC (rev 3916)
+++ trunk/redmine/debian/README.Debian 2009-08-10 10:37:21 UTC (rev 3917)
@@ -3,8 +3,11 @@
This redmine package is designed to automatically configure database
BUT NOT the web server.
-By default, admin account log/pass is admin/admin
+A debconf facility is provided to be able to configure several redmine
+instances. Use dpkg-reconfigure to define the instances identifiers.
+By default, redmine admin account log/pass is admin/admin
+
For web server configuration, examples are
available in /usr/share/doc/redmine/examples
@@ -16,7 +19,7 @@
Email settings are not automatically configured, for a quick setup, copy
/usr/share/doc/redmine/examples/email.yml
to
-/etc/redmine/email.yml
+/etc/redmine/<instance-identifier>/email.yml
then restart redmine and check if it's working by sending a test email in
Administration panel -> Settings -> Email notifications -> Send a test email
Modified: trunk/redmine/debian/README.Source
===================================================================
--- trunk/redmine/debian/README.Source 2009-08-09 23:26:47 UTC (rev 3916)
+++ trunk/redmine/debian/README.Source 2009-08-10 10:37:21 UTC (rev 3917)
@@ -2,6 +2,13 @@
When it IS released, just use the watch file with "uscan",
NOT what follows.
+Notes from a discussion with upstream author:
+Redmine 0.8.x targets rails 2.1.2
+Redmine 0.9 targets rails 2.3
+Current redmine trunk svn2835 targets rails 2.2.2, changes in trunk for
+rails 2.3 migration is expected soon after this revision.
+Until rails 2.3 enters debian, redmine debian package will keep using rails 2.2.2
+
Please note the diff from the pristine source contains only the debian/ folder.
Updating the package with redmine SVN TRUNK at revision xxxx :
Modified: trunk/redmine/debian/changelog
===================================================================
--- trunk/redmine/debian/changelog 2009-08-09 23:26:47 UTC (rev 3916)
+++ trunk/redmine/debian/changelog 2009-08-10 10:37:21 UTC (rev 3917)
@@ -1,4 +1,4 @@
-redmine (0.9.0~svn2819-1) unstable; urgency=low
+redmine (0.9.0~svn2835-1) unstable; urgency=low
* Initial release (Closes: #478741)
Modified: trunk/redmine/debian/config
===================================================================
--- trunk/redmine/debian/config 2009-08-09 23:26:47 UTC (rev 3916)
+++ trunk/redmine/debian/config 2009-08-10 10:37:21 UTC (rev 3917)
@@ -3,60 +3,130 @@
set -e
#set -x
+redLocales="bg, bs, ca, cs, da, de, en, es, fi, fr, gl, he, hu, it, ja, ko, lt, nl, no, pl, pt, pt-br, ro, ru, sk, sl, sr, sv, th, tr, uk, vi, zh, zh-tw"
+
. /usr/share/debconf/confmodule
db_version 2.0
# This conf script is capable of backing up
db_capb backup
-OUTSTATE=3
+# get current instances list
+savedir="`pwd`"
+
+# update the list of instances to be deconfigured (at package removal) because of missing /etc/redmine/<instancename> folder
+
+# now we should do step 2 (and 3 if 2 is ok) for each instance-name in redmine/instances/current
+# some extra care is needed to manage the dbconfig's debconf entries, because this could happen :
+# - an instance xxx is configured
+# - the /etc/redmine/xxx folder is removed by hand -> NOT SUPPORTED
+# - or the xxx instance is removed from the instancesList
+# The idea is to deconfigure an existing instance as soon as it is removed from the instances list,
+# and to deconfigure all existing instances on package removal
+
+OUTSTATE=2
STATE=1
+
while [ "$STATE" != 0 -a "$STATE" != "$OUTSTATE" ]; do
- case "$STATE" in
- 1)
- if [ -f /usr/share/dbconfig-common/dpkg/config ]; then
- dbc_dbtypes="sqlite3, pgsql, mysql"
- dbc_authmethod_user="password"
- . /usr/share/dbconfig-common/dpkg/config
- dbc_go redmine $@
- db_get redmine/dbconfig-install || true
- if [ "$RET" != "true" ]; then
+ fIndex=$(($STATE / 10))
+ fState=$(($STATE % 10))
+ fNextState=$((($fIndex+1)*10))
+ if [ $STATE -eq 1 ]; then
+ db_get redmine/current-instances || true
+ gOldInstances="${RET}"
+
+ db_set redmine/current-instances $gOldInstances
+ db_input medium redmine/current-instances || true
+ if db_go; then
+ STATE=$fNextState
+ else
+ STATE=0
+ fi
+ db_get redmine/current-instances || true
+ gInstances="${RET}"
+
+ gRemovedInstances=""
+ for lOld in $gOldInstances; do
+ lFound=0
+ for lCur in $gInstances; do
+ if [ $lCur = $lOld ]; then
+ lFound=1
+ break
+ fi
+ done
+ if [ $lFound -eq 0 ]; then
+ if [ -z "$gRemovedInstances" ]; then gRemovedInstances="$lOld";
+ else gRemovedInstances="$gRemovedInstances $lOld";
+ fi
+ fi
+ done
+ db_set redmine/old-instances "$gRemovedInstances"
+ gNb=$(echo "$gInstances" | wc -w)
+ OUTSTATE=$((($gNb+1) * 10))
+ else
+ fIndex=$(($STATE / 10))
+ fState=$(($STATE % 10))
+ fNextState=$((($fIndex+1)*10))
+ fInstance=$(eval "echo \"$gInstances\" | awk '{print \$$fIndex}'")
+ case "$fState" in
+ 0)
+ if [ -f /usr/share/dbconfig-common/dpkg/config ]; then
+ dbc_dbtypes="sqlite3, pgsql, mysql"
+ dbc_authmethod_user="password"
+ dbc_dbuser=redmine
+ dbc_dbname=redmine-$fInstance
+ . /usr/share/dbconfig-common/dpkg/config
+ dbc_go redmine/instances/$fInstance $@
+ if [ $? -ne 0 ] ; then
+ if [ $fIndex -gt 0 ];then
+ STATE=$((($fIndex-1)*10 + 1))
+ else
+ STATE=0
+ fi
+ continue
+ fi
+ db_get redmine/instances/$fInstance/dbconfig-install || true
+ if [ "$RET" != "true" ]; then
+ STATE=$fNextState
+ else
+ STATE=$(($STATE + 1))
+ fi
+ else
STATE=$OUTSTATE
+ fi
+ ;;
+ 1)
+ # supported locales
+
+ # now check if current LANG correspond to one of those locales
+ locstr=${LANG%.*}
+ locMin=${locstr%_*}
+ locMaj=$(echo ${locstr#*_} | tr "[:upper:]" "[:lower:]")
+ locTrans="$locMin-$locMaj"
+ OLD_IFS=$IFS
+ IFS=", "
+ locAv="en"
+ for i in $redLocales; do
+ if [ $locTrans = $i ];then
+ locAv=$i
+ break
+ elif [ $locMin = $i ];then
+ locAv=$i
+ break
+ fi
+ done
+ IFS=$OLD_IFS
+ questionLanguage="redmine/instances/${fInstance}/default-language"
+ db_register "redmine/default-language" $questionLanguage
+ db_subst $questionLanguage availableLocales $redLocales
+ db_subst $questionLanguage defaultLocale $locAv
+ db_set $questionLanguage $locAv
+ db_input medium $questionLanguage || true
+ if db_go; then
+ STATE=$fNextState
else
- STATE=$(($STATE + 1))
+ STATE=$(($STATE - 1))
fi
- else
- STATE=$OUTSTATE
- fi
- ;;
- 2)
- # supported locales
- redLocales="bg, bs, ca, cs, da, de, en, es, fi, fr, gl, he, hu, it, ja, ko, lt, nl, no, pl, pt, pt-br, ro, ru, sk, sl, sr, sv, th, tr, uk, vi, zh, zh-tw"
- # now check if current LANG correspond to one of those locales
- locstr=${LANG%.*}
- locMin=${locstr%_*}
- locMaj=$(echo ${locstr#*_} | tr "[:upper:]" "[:lower:]")
- locTrans="$locMin-$locMaj"
- OLD_IFS=$IFS
- IFS=", "
- locAv="en"
- for i in $redLocales;do
- if [ $locTrans = $i ];then
- locAv=$i
- break
- elif [ $locMin = $i ];then
- locAv=$i
- break
- fi
- done
- IFS=$OLD_IFS
- db_subst redmine/default-language availableLocales $redLocales
- db_subst redmine/default-language defaultLocale $locAv
- db_input medium redmine/default-language || true
- if db_go; then
- STATE=$(($STATE + 1))
- else
- STATE=$(($STATE - 1))
- fi
- ;;
- esac
+ ;;
+ esac
+ fi
done
Modified: trunk/redmine/debian/dirs
===================================================================
--- trunk/redmine/debian/dirs 2009-08-09 23:26:47 UTC (rev 3916)
+++ trunk/redmine/debian/dirs 2009-08-10 10:37:21 UTC (rev 3917)
@@ -2,7 +2,6 @@
var/cache/redmine
var/lib/redmine/sessions
var/lib/redmine/files
-
usr/share/redmine/tmp
usr/share/redmine/public/plugin_assets
etc/redmine
Modified: trunk/redmine/debian/doc/examples/apache2-alias.conf
===================================================================
--- trunk/redmine/debian/doc/examples/apache2-alias.conf 2009-08-09 23:26:47 UTC (rev 3916)
+++ trunk/redmine/debian/doc/examples/apache2-alias.conf 2009-08-10 10:37:21 UTC (rev 3917)
@@ -1,13 +1,13 @@
<VirtualHost localhost>
# DefaultInitEnv may not work, in that case, replace it with SetEnv
DefaultInitEnv RAILS_RELATIVE_URL_ROOT "/redmine"
- DefaultInitEnv RAILS_ETC "/etc/redmine"
- DefaultInitEnv RAILS_LOG "/var/log/redmine"
- DefaultInitEnv RAILS_VAR "/var/lib/redmine"
- DefaultInitEnv RAILS_CACHE "/var/cache/redmine"
+ DefaultInitEnv RAILS_ETC "/etc/redmine/default"
+ DefaultInitEnv RAILS_LOG "/var/log/redmine/default"
+ DefaultInitEnv RAILS_VAR "/var/lib/redmine/default"
+ DefaultInitEnv RAILS_CACHE "/var/cache/redmine/default"
# the fcgid socket path
- SocketPath "/var/run/redmine/sockets"
+ SocketPath "/var/run/redmine/sockets/default"
Alias "/redmine" /usr/share/redmine/public
<Directory "/usr/share/redmine/public">
Options +FollowSymLinks +ExecCGI
Modified: trunk/redmine/debian/doc/examples/apache2-host.conf
===================================================================
--- trunk/redmine/debian/doc/examples/apache2-host.conf 2009-08-09 23:26:47 UTC (rev 3916)
+++ trunk/redmine/debian/doc/examples/apache2-host.conf 2009-08-10 10:37:21 UTC (rev 3917)
@@ -1,12 +1,12 @@
<VirtualHost localhost>
# DefaultInitEnv may not work, in that case, replace it with SetEnv
DefaultInitEnv RAILS_RELATIVE_URL_ROOT "/redmine"
- DefaultInitEnv RAILS_ETC "/etc/redmine"
- DefaultInitEnv RAILS_LOG "/var/log/redmine"
- DefaultInitEnv RAILS_VAR "/var/lib/redmine"
- DefaultInitEnv RAILS_CACHE "/var/cache/redmine"
+ DefaultInitEnv RAILS_ETC "/etc/redmine/default"
+ DefaultInitEnv RAILS_LOG "/var/log/redmine/default"
+ DefaultInitEnv RAILS_VAR "/var/lib/redmine/default"
+ DefaultInitEnv RAILS_CACHE "/var/cache/redmine/default"
# the fcgid socket path
- SocketPath "/var/run/redmine/sockets"
+ SocketPath "/var/run/redmine/sockets/default"
DocumentRoot /usr/share/redmine/public
<Directory "/usr/share/redmine/public">
Options +FollowSymLinks +ExecCGI
Modified: trunk/redmine/debian/doc/examples/lighttpd-host-alias.conf
===================================================================
--- trunk/redmine/debian/doc/examples/lighttpd-host-alias.conf 2009-08-09 23:26:47 UTC (rev 3916)
+++ trunk/redmine/debian/doc/examples/lighttpd-host-alias.conf 2009-08-10 10:37:21 UTC (rev 3917)
@@ -10,14 +10,14 @@
"min-procs" => 1,
# max-procs >= 2 for Upload Progress or other tasks that need a second parallel request
"max-procs" => 2,
- "socket" => "/var/run/redmine/sockets/fcgi.socket",
+ "socket" => "/var/run/redmine/sockets/default/fcgi.socket",
"bin-path" => "/usr/share/redmine/public/dispatch.fcgi",
"bin-environment" => (
"RAILS_RELATIVE_URL_ROOT" => "/redmine",
- "RAILS_ETC" => "/etc/redmine",
- "RAILS_LOG" => "/var/log/redmine",
- "RAILS_VAR" => "/var/lib/redmine",
- "RAILS_CACHE" => "/var/cache/redmine"
+ "RAILS_ETC" => "/etc/redmine/default",
+ "RAILS_LOG" => "/var/log/redmine/default",
+ "RAILS_VAR" => "/var/lib/redmine/default",
+ "RAILS_CACHE" => "/var/cache/redmine/default"
),
"check-local" => "disable",
"kill-signal" => 10 # this is because programs linked against libfcgi need USR1 kill-signal
Modified: trunk/redmine/debian/doc/examples/lighttpd-host.conf
===================================================================
--- trunk/redmine/debian/doc/examples/lighttpd-host.conf 2009-08-09 23:26:47 UTC (rev 3916)
+++ trunk/redmine/debian/doc/examples/lighttpd-host.conf 2009-08-10 10:37:21 UTC (rev 3917)
@@ -9,13 +9,13 @@
"min-procs" => 1,
# max-procs >= 2 for Upload Progress or other tasks that need a second parallel request
"max-procs" => 2,
- "socket" => "/var/run/redmine/sockets/fcgi.socket",
+ "socket" => "/var/run/redmine/sockets/default/fcgi.socket",
"bin-path" => "/usr/share/redmine/public/dispatch.fcgi",
"bin-environment" => (
- "RAILS_ETC" => "/etc/redmine",
- "RAILS_LOG" => "/var/log/redmine",
- "RAILS_VAR" => "/var/lib/redmine",
- "RAILS_CACHE" => "/var/cache/redmine"
+ "RAILS_ETC" => "/etc/redmine/default",
+ "RAILS_LOG" => "/var/log/redmine/default",
+ "RAILS_VAR" => "/var/lib/redmine/default",
+ "RAILS_CACHE" => "/var/cache/redmine/default"
),
"kill-signal" => 10 # this is because programs linked against libfcgi need USR1 kill-signal
)
Modified: trunk/redmine/debian/doc/examples/lighttpd-socket-alias.conf
===================================================================
--- trunk/redmine/debian/doc/examples/lighttpd-socket-alias.conf 2009-08-09 23:26:47 UTC (rev 3916)
+++ trunk/redmine/debian/doc/examples/lighttpd-socket-alias.conf 2009-08-10 10:37:21 UTC (rev 3917)
@@ -10,14 +10,14 @@
"min-procs" => 1,
# max-procs >= 2 for Upload Progress or other tasks that need a second parallel request
"max-procs" => 2,
- "socket" => "/var/run/redmine/sockets/fcgi.socket",
+ "socket" => "/var/run/redmine/sockets/default/fcgi.socket",
"bin-path" => "/usr/share/redmine/public/dispatch.fcgi",
"bin-environment" => (
"RAILS_RELATIVE_URL_ROOT" => "/redmine",
- "RAILS_ETC" => "/etc/redmine",
- "RAILS_LOG" => "/var/log/redmine",
- "RAILS_VAR" => "/var/lib/redmine",
- "RAILS_CACHE" => "/var/cache/redmine"
+ "RAILS_ETC" => "/etc/redmine/default",
+ "RAILS_LOG" => "/var/log/redmine/default",
+ "RAILS_VAR" => "/var/lib/redmine/default",
+ "RAILS_CACHE" => "/var/cache/redmine/default"
),
"check-local" => "disable",
"kill-signal" => 10 # this is because programs linked against libfcgi need USR1 kill-signal
Modified: trunk/redmine/debian/doc/examples/lighttpd-socket.conf
===================================================================
--- trunk/redmine/debian/doc/examples/lighttpd-socket.conf 2009-08-09 23:26:47 UTC (rev 3916)
+++ trunk/redmine/debian/doc/examples/lighttpd-socket.conf 2009-08-10 10:37:21 UTC (rev 3917)
@@ -9,13 +9,13 @@
"min-procs" => 1,
# max-procs >= 2 for Upload Progress or other tasks that need a second parallel request
"max-procs" => 2,
- "socket" => "/var/run/redmine/sockets/fcgi.socket",
+ "socket" => "/var/run/redmine/sockets/default/fcgi.socket",
"bin-path" => "/usr/share/redmine/public/dispatch.fcgi",
"bin-environment" => (
- "RAILS_ETC" => "/etc/redmine",
- "RAILS_LOG" => "/var/log/redmine",
- "RAILS_VAR" => "/var/lib/redmine",
- "RAILS_CACHE" => "/var/cache/redmine"
+ "RAILS_ETC" => "/etc/redmine/default",
+ "RAILS_LOG" => "/var/log/redmine/default",
+ "RAILS_VAR" => "/var/lib/redmine/default",
+ "RAILS_CACHE" => "/var/cache/redmine/default"
),
"kill-signal" => 10 # this is because programs linked against libfcgi need USR1 kill-signal
)
Modified: trunk/redmine/debian/po/fr.po
===================================================================
--- trunk/redmine/debian/po/fr.po 2009-08-09 23:26:47 UTC (rev 3916)
+++ trunk/redmine/debian/po/fr.po 2009-08-10 10:37:21 UTC (rev 3917)
@@ -2,7 +2,7 @@
msgstr ""
"Project-Id-Version: redmine 0.9.0-1\n"
"Report-Msgid-Bugs-To: redmine at packages.debian.org\n"
-"POT-Creation-Date: 2009-07-04 01:37+0200\n"
+"POT-Creation-Date: 2009-08-10 09:18+0200\n"
"PO-Revision-Date: 2009-02-26 15:56+0100\n"
"Last-Translator: Jérémy Lal <jeremy.lal at m4x.org>\n"
"Language-Team: French <debian-l10n-french at lists.debian.org>\n"
@@ -10,8 +10,51 @@
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
+#. Type: string
+#. Description
+#: ../templates:1001
+msgid "Redmine instances to be deconfigured:"
+msgstr "Instances redmine qui seront déconfigurées:"
+
+#. Type: string
+#. Description
+#: ../templates:1001
+msgid "Configuration files for these instances will be removed."
+msgstr "Les fichiers de configuration pour ces instances seront supprimés."
+
+#. Type: string
+#. Description
+#: ../templates:1001
+msgid "Database (de)configuration will be asked accordingly."
+msgstr "Chaque base de données sera (dé)configurée respectivement."
+
+#. Type: string
+#. Description
+#: ../templates:2001
+msgid "Redmine instances to be configured or upgraded:"
+msgstr "Instances redmine qui seront configurées ou mises à jour:"
+
+#. Type: string
+#. Description
+#: ../templates:2001
+msgid "Space-separated list of instances identifiers."
+msgstr "Liste d'identifiants d'instances, séparés par des espaces."
+
+#. Type: string
+#. Description
+#: ../templates:2001
+msgid ""
+"Each instance has its configuration files in /etc/redmine/<instance-identifier>/"
+msgstr "Les fichiers de configuration de chaque instance sont dans /etc/redmine/<identifiant-instance>/"
+
+#. Type: string
+#. Description
+#: ../templates:2001
+msgid "To deconfigure an instance, remove its identifier from this list."
+msgstr "Pour déconfigurer une instance, enlever son identifiant de cette liste."
+
#. Type: select
#. Description
-#: ../templates:1001
+#: ../templates:3001
msgid "Default redmine language:"
msgstr "Langage par défaut de Redmine:"
Modified: trunk/redmine/debian/po/templates.pot
===================================================================
--- trunk/redmine/debian/po/templates.pot 2009-08-09 23:26:47 UTC (rev 3916)
+++ trunk/redmine/debian/po/templates.pot 2009-08-10 10:37:21 UTC (rev 3917)
@@ -3,11 +3,12 @@
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
#
+#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: redmine at packages.debian.org\n"
-"POT-Creation-Date: 2009-07-04 01:37+0200\n"
+"POT-Creation-Date: 2009-08-10 09:23+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
"Language-Team: LANGUAGE <LL at li.org>\n"
@@ -15,8 +16,52 @@
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
+#. Type: string
+#. Description
+#: ../templates:1001
+msgid "Redmine instances to be deconfigured:"
+msgstr ""
+
+#. Type: string
+#. Description
+#: ../templates:1001
+msgid "Configuration files for these instances will be removed."
+msgstr ""
+
+#. Type: string
+#. Description
+#: ../templates:1001
+msgid "Database (de)configuration will be asked accordingly."
+msgstr ""
+
+#. Type: string
+#. Description
+#: ../templates:2001
+msgid "Redmine instances to be configured or upgraded:"
+msgstr ""
+
+#. Type: string
+#. Description
+#: ../templates:2001
+msgid "Space-separated list of instances identifiers."
+msgstr ""
+
+#. Type: string
+#. Description
+#: ../templates:2001
+msgid ""
+"Each instance has its configuration files in /etc/redmine/<instance-"
+"identifier>/"
+msgstr ""
+
+#. Type: string
+#. Description
+#: ../templates:2001
+msgid "To deconfigure an instance, remove its identifier from this list."
+msgstr ""
+
#. Type: select
#. Description
-#: ../templates:1001
+#: ../templates:3001
msgid "Default redmine language:"
msgstr ""
Modified: trunk/redmine/debian/postinst
===================================================================
--- trunk/redmine/debian/postinst 2009-08-09 23:26:47 UTC (rev 3916)
+++ trunk/redmine/debian/postinst 2009-08-10 10:37:21 UTC (rev 3917)
@@ -6,47 +6,50 @@
set -e
#set -x
+RAKE_VERBOSE=false
+
. /usr/share/debconf/confmodule
-. /usr/share/dbconfig-common/dpkg/postinst
-dbc_generate_include=template:/etc/redmine/database.yml
-dbc_generate_include_args="-o template_infile=/usr/share/redmine/templates/database.yml.template"
-dbc_generate_include_owner="root:www-data"
-dbc_generate_include_perms="640"
-dbc_dbfile_owner="root:www-data"
-# this is for sqlite3 to be r/w for www-data
-dbc_dbfile_perms="0660"
-dbc_dbuser=redmine
-dbc_dbname=redmine
+# First, remove and purge old instances
+. /usr/share/dbconfig-common/dpkg/prerm
+db_get redmine/old-instances || true
+gOldInstances="${RET}"
+for lInstance in $gOldInstances; do
+ dbc_go redmine/instances/$lInstance remove
+done
+. /usr/share/dbconfig-common/dpkg/postrm
+for lInstance in $gOldInstances; do
+ dbc_go redmine/instances/$lInstance purge
+ if which ucf >/dev/null 2>&1; then
+ ucf --purge /etc/redmine/$lInstance/database.yml
+ fi
+done
+db_set redmine/old-instances ""
-dbc_go redmine $@
+. /usr/share/dbconfig-common/dpkg/postinst
-withdb=0
-if [ -e /etc/redmine/database.yml ]; then
- hasdb=$(grep -m 1 -o -E 'adapter: (mysql|pgsql|sqlite3|postgresql)' /etc/redmine/database.yml)
- if [ -n "$hasdb" ]; then
- hasdb=$(echo -n ${hasdb#*:})
- withdb=1
- case "$hasdb" in
- mysql|postgresql|pgsql)
- sed -i -r -e 's/pgsql/postgresql/g' -e 's/^[^#]+(dbfile: [^:]*)$/# \1/g' /etc/redmine/database.yml
- ;;
- sqlite3)
- sed -i -r -e 's/^[^#]+((database|host|port|username|password): [^:]*)$/# \1/g' /etc/redmine/database.yml
- ;;
- esac
- fi
-fi
+fRailsLog=/var/log/redmine
+fRailsVar=/var/lib/redmine
+fRailsCache=/var/cache/redmine
case "$1" in
configure)
- # because rake task is going to be executed as root, create the log file before
- touch /var/log/redmine/production.log
- chown -f www-data:www-data /var/log/redmine/production.log
- if [ ! -e /var/run/redmine/sockets ]; then
- mkdir -p /var/run/redmine/sockets
- chown -f www-data:www-data /var/run/redmine/sockets
+ mkdir -p /var/run/redmine/sockets
+ chown -f www-data:www-data /var/run/redmine/sockets
+ mkdir -p /var/run/redmine
+ chown -f www-data:www-data /var/run/redmine
+ if [ ! -e $fRailsLog ]; then
+ mkdir -p $fRailsLog
+ chown -f www-data:www-data $fRailsLog
fi
+ if [ ! -e $fRailsVar ]; then
+ mkdir -p $fRailsVar
+ chown -f www-data:www-data $fRailsVar
+ fi
+ if [ ! -e $fRailsCache ]; then
+ mkdir -p $fRailsCache
+ chown -f www-data:www-data $fRailsCache
+ fi
savedir="`pwd`"
cd /usr/share/redmine
if [ ! -e vendor/rails ]; then
@@ -65,32 +68,11 @@
mkdir public/plugin_assets
chown -f www-data:www-data public/plugin_assets
fi
- if [ $withdb -eq 1 ]; then
- db_get redmine/default-language && DEFAULT_LANGUAGE="$RET"
- # handle rake install
- rake -s db:migrate RAILS_ENV=production RAILS_ETC="/etc/redmine" RAILS_LOG="/var/log/redmine" RAILS_VAR="/var/log/redmine" RAILS_CACHE="/var/cache/redmine" VERBOSE=false
- rake -s redmine:load_default_data RAILS_ENV=production RAILS_ETC="/etc/redmine" RAILS_LOG="/var/log/redmine" RAILS_VAR="/var/log/redmine" RAILS_CACHE="/var/cache/redmine" REDMINE_LANG=$DEFAULT_LANGUAGE
- rake -s config/initializers/session_store.rb RAILS_ENV=production RAILS_ETC="/etc/redmine" RAILS_LOG="/var/log/redmine" RAILS_VAR="/var/log/redmine" RAILS_CACHE="/var/cache/redmine"
- else
- echo 'Manual database configuration. Webserver will not be configured either.'
- fi
cd $savedir
;;
- abort-upgrade|abort-remove|abort-deconfigure)
+ abort-upgrade|abort-remove|abort-deconfigure|configure)
;;
-
- upgrade)
- if [ $withdb -eq 1 ]; then
- savedir="`pwd`"
- cd /usr/share/redmine
- rake -s db:migrate RAILS_ENV=production VERBOSE=false RAILS_ETC="/etc/redmine" RAILS_LOG="/var/log/redmine" RAILS_VAR="/var/log/redmine" RAILS_CACHE="/var/cache/redmine"
- rake -s tmp:cache:clear RAILS_ENV=production RAILS_ETC="/etc/redmine" RAILS_LOG="/var/log/redmine" RAILS_VAR="/var/log/redmine" RAILS_CACHE="/var/cache/redmine"
- rake -s tmp:sessions:clear RAILS_ENV=production RAILS_ETC="/etc/redmine" RAILS_LOG="/var/log/redmine" RAILS_VAR="/var/log/redmine" RAILS_CACHE="/var/cache/redmine"
- cd $savedir
- echo "Please go to 'Admin -> Roles & permissions' to check/set permissions for the new features, if any."
- fi
- ;;
*)
echo "postinst called with unknown argument \`$1'" >&2
@@ -98,6 +80,98 @@
;;
esac
+db_get redmine/current-instances || true
+gInstances="${RET}"
+for lInstance in $gInstances; do
+ fRailsEnv=production
+ fRailsEtc=/etc/redmine/$lInstance
+ fRailsLog=/var/log/redmine/$lInstance
+ fRailsVar=/var/lib/redmine/$lInstance
+ fRailsCache=/var/cache/redmine/$lInstance
+
+ # dbconfig needs this folder to ouput database.yml
+ mkdir -p $fRailsEtc
+ chown -f www-data:www-data $fRailsEtc
+
+ dbc_generate_include=template:/etc/redmine/$lInstance/database.yml
+ dbc_generate_include_args="-o template_infile=/usr/share/redmine/templates/database.yml.template"
+ dbc_generate_include_owner="root:www-data"
+ dbc_generate_include_perms="640"
+ dbc_dbfile_owner="root:www-data"
+ # this is for sqlite3 to be r/w for www-data
+ dbc_dbfile_perms="0660"
+ dbc_dbuser=redmine
+ dbc_dbname=redmine-$lInstance
+
+ dbc_go redmine/instances/$lInstance $@
+
+ withdb=0
+ if [ -e /etc/redmine/$lInstance/database.yml ]; then
+ hasdb=$(grep -m 1 -o -E 'adapter: (mysql|pgsql|sqlite3|postgresql)' /etc/redmine/$lInstance/database.yml)
+ if [ -n "$hasdb" ]; then
+ hasdb=$(echo -n ${hasdb#*:})
+ withdb=1
+ case "$hasdb" in
+ mysql|postgresql|pgsql)
+ sed -i -r -e 's/pgsql/postgresql/g' -e 's/^[^#]+(dbfile: [^:]*)$/# \1/g' /etc/redmine/$lInstance/database.yml
+ ;;
+ sqlite3)
+ sed -i -r -e 's/^[^#]+((database|host|port|username|password): [^:]*)$/# \1/g' /etc/redmine/$lInstance/database.yml
+ ;;
+ esac
+ fi
+ fi
+
+ case "$1" in
+ configure)
+ # create directories
+ mkdir -p $fRailsLog
+ mkdir -p $fRailsVar
+ mkdir -p $fRailsCache
+ chown -f www-data:www-data $fRailsLog
+ chown -f www-data:www-data $fRailsVar
+ chown -f www-data:www-data $fRailsCache
+ mkdir -p /var/run/redmine/sockets/${lInstance}
+ chown -f www-data:www-data /var/run/redmine/sockets/${lInstance}
+ savedir="`pwd`"
+ cd /usr/share/redmine
+ if [ $withdb -eq 1 ]; then
+ db_get redmine/instances/${lInstance}/default-language && DEFAULT_LANGUAGE="$RET"
+ # handle rake install
+ rake -s db:migrate RAILS_ENV=$fRailsEnv RAILS_ETC="$fRailsEtc" RAILS_LOG="$fRailsLog" RAILS_VAR="$fRailsVar" RAILS_CACHE="$fRailsCache" VERBOSE=$RAKE_VERBOSE
+ rake -s redmine:load_default_data RAILS_ENV=$fRailsEnv RAILS_ETC="$fRailsEtc" RAILS_LOG="$fRailsLog" RAILS_VAR="$fRailsVar" RAILS_CACHE="$fRailsCache" REDMINE_LANG=$DEFAULT_LANGUAGE
+ rake -s config/initializers/session_store.rb RAILS_ENV=$fRailsEnv RAILS_ETC="$fRailsEtc" RAILS_LOG="$fRailsLog" RAILS_VAR="$fRailsVar" RAILS_CACHE="$fRailsCache"
+ # because rake task is executed as root here, and this file is used later by web server, make sure owner is www-data
+ chown -f www-data:www-data ${fRailsLog}/production.log
+ else
+ echo "Redmine instance \"${lInstance}\" database must be configured manually."
+ fi
+ cd $savedir
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ upgrade)
+ if [ $withdb -eq 1 ]; then
+ savedir="`pwd`"
+ cd /usr/share/redmine
+ rake -s db:migrate RAILS_ENV=$fRailsEnv RAILS_ETC="$fRailsEtc" RAILS_LOG="$fRailsLog" RAILS_VAR="$fRailsVar" RAILS_CACHE="$fRailsCache" VERBOSE=$RAKE_VERBOSE
+ rake -s tmp:cache:clear RAILS_ENV=$fRailsEnv RAILS_ETC="$fRailsEtc" RAILS_LOG="$fRailsLog" RAILS_VAR="$fRailsVar" RAILS_CACHE="$fRailsCache"
+ rake -s tmp:sessions:clear RAILS_ENV=$fRailsEnv RAILS_ETC="$fRailsEtc" RAILS_LOG="$fRailsLog" RAILS_VAR="$fRailsVar" RAILS_CACHE="$fRailsCache"
+ # because rake task is executed as root, make sure owner is www-data
+ chown -f www-data:www-data ${fRailsLog}/production.log
+ cd $savedir
+ echo "Redmine instance \"${lInstance}\" upgraded. Check in admin panel Roles & permissions for new features, if any."
+ fi
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+ esac
+done
#DEBHELPER#
exit 0
Modified: trunk/redmine/debian/postrm
===================================================================
--- trunk/redmine/debian/postrm 2009-08-09 23:26:47 UTC (rev 3916)
+++ trunk/redmine/debian/postrm 2009-08-10 10:37:21 UTC (rev 3917)
@@ -9,19 +9,44 @@
if [ -f /usr/share/debconf/confmodule ]; then
. /usr/share/debconf/confmodule
fi
-if [ -f /usr/share/dbconfig-common/dpkg/postrm ]; then
- . /usr/share/dbconfig-common/dpkg/postrm
- dbc_go redmine $@
-fi
case "$1" in
- remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+ upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
+
+ remove)
+ if [ -f /usr/share/dbconfig-common/dpkg/postrm ]; then
+ . /usr/share/dbconfig-common/dpkg/postrm
+
+ db_get redmine/old-instances || true
+ gOldInstances="${RET}"
+ for lInstance in $gOldInstances; do
+ dbc_go redmine/instances/$lInstance $@
+ done
+
+ db_get redmine/current-instances || true
+ gInstances="${RET}"
+ for lInstance in $gInstances; do
+ dbc_go redmine/instances/$lInstance $@
+ done
+ fi
+ ;;
purge)
if which ucf >/dev/null 2>&1; then
- ucf --purge /etc/redmine/database.yml
+ db_get redmine/old-instances || true
+ gOldInstances="${RET}"
+ for lInstance in $gOldInstances; do
+ ucf --purge /etc/redmine/$lInstance/database.yml
+ done
+
+ db_get redmine/current-instances || true
+ gInstances="${RET}"
+ for lInstance in $gInstances; do
+ ucf --purge /etc/redmine/$lInstance/database.yml
+ done
fi
+
rm -rf /var/run/redmine
rm -rf /var/log/redmine
rm -rf /usr/share/redmine
Modified: trunk/redmine/debian/prerm
===================================================================
--- trunk/redmine/debian/prerm 2009-08-09 23:26:47 UTC (rev 3916)
+++ trunk/redmine/debian/prerm 2009-08-10 10:37:21 UTC (rev 3917)
@@ -7,19 +7,38 @@
#set -x
. /usr/share/debconf/confmodule
-. /usr/share/dbconfig-common/dpkg/prerm
-dbc_go redmine $@
+. /usr/share/dbconfig-common/dpkg/prerm
-# removes symbolic links installed by
-vendordir="/usr/share/redmine/vendor/"
-rm -f ${vendordir}actionmailer
-rm -f ${vendordir}activemodel
-rm -f ${vendordir}activeresource
-rm -f ${vendordir}rails
-rm -f ${vendordir}actionpack
-rm -f ${vendordir}activerecord
-rm -f ${vendordir}activesupport
-rm -f ${vendordir}railties
+case "$1" in
+ remove)
+ db_get redmine/old-instances || true
+ gOldInstances="${RET}"
+ for lInstance in $gOldInstances; do
+ dbc_go redmine/instances/$lInstance $@
+ done
+
+ db_get redmine/current-instances || true
+ gInstances="${RET}"
+ for lInstance in $gInstances; do
+ dbc_go redmine/instances/$lInstance $@
+ done
+
+
+ # removes symbolic links installed by
+ vendordir="/usr/share/redmine/vendor/"
+ rm -f ${vendordir}actionmailer
+ rm -f ${vendordir}activemodel
+ rm -f ${vendordir}activeresource
+ rm -f ${vendordir}rails
+ rm -f ${vendordir}actionpack
+ rm -f ${vendordir}activerecord
+ rm -f ${vendordir}activesupport
+ rm -f ${vendordir}railties
+ ;;
+
+ purge|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+ ;;
+esac
#DEBHELPER#
Modified: trunk/redmine/debian/templates
===================================================================
--- trunk/redmine/debian/templates 2009-08-09 23:26:47 UTC (rev 3916)
+++ trunk/redmine/debian/templates 2009-08-10 10:37:21 UTC (rev 3917)
@@ -1,3 +1,20 @@
+Template: redmine/old-instances
+Type: string
+_Description: Redmine instances to be deconfigured:
+ Configuration files for these instances will be removed.
+ .
+ Database (de)configuration will be asked accordingly.
+
+Template: redmine/current-instances
+Type: string
+Default: default
+_Description: Redmine instances to be configured or upgraded:
+ Space-separated list of instances identifiers.
+ .
+ Each instance has its configuration files in /etc/redmine/<instance-identifier>/
+ .
+ To deconfigure an instance, remove its identifier from this list.
+
Template: redmine/default-language
Type: select
Choices: ${availableLocales}
More information about the Pkg-ruby-extras-commits
mailing list