[DRE-commits] r4195 - in trunk/redmine/debian: . po
Jérémy Lal
kapouer-guest at alioth.debian.org
Tue Sep 22 22:56:51 UTC 2009
Author: kapouer-guest
Date: 2009-09-22 22:56:51 +0000 (Tue, 22 Sep 2009)
New Revision: 4195
Modified:
trunk/redmine/debian/config
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/rules
Log:
A lot of corrections to get it working :
* dbconfig was not called at purge time
* all calls to dbconfig now test if some db was configured before,
this avoids errors.
* fix owner of plugins_assets and tmp (webrick needs tmp),
remove chowns from debian/rules.
* avoid ucf troubles since the dbconfig's generated database.yml is not
the good one.
* fix a lot of stupid errors and bad tests in dash.
Modified: trunk/redmine/debian/config
===================================================================
--- trunk/redmine/debian/config 2009-09-22 22:56:46 UTC (rev 4194)
+++ trunk/redmine/debian/config 2009-09-22 22:56:51 UTC (rev 4195)
@@ -10,23 +10,10 @@
# This conf script is capable of backing up
db_capb backup
-# 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
+while [ "$STATE" != "0" -a "$STATE" != "$OUTSTATE" ]; do
fIndex=$(($STATE / 10))
fState=$(($STATE % 10))
fNextState=$((($fIndex+1)*10))
@@ -99,7 +86,6 @@
fi
db_get redmine/current-instances || true
gInstances="${RET}"
-
gRemovedInstances=""
for lOld in $gOldInstances; do
lFound=0
@@ -131,14 +117,16 @@
dbc_dbuser=redmine
# use same dbname if one has been registered in debconf before
# this is also needed for migration from version <= 0.9.0~svn2819
- db_get redmine/instances/$fInstance/db/dbname || true
- if [ -n "$RET" ]; then
+ fCode=0
+ db_get redmine/instances/$fInstance/db/dbname || fCode=$?
+ if [ $fCode -eq 0 -a -n "$RET" ]; then
dbc_dbname="$RET"
else
dbc_dbname=redmine-$fInstance
fi
- db_get redmine/instances/$fInstance/db/basepath || true
- if [ -n "$RET" ]; then
+ fCode=0
+ db_get redmine/instances/$fInstance/db/basepath || fCode=$?
+ if [ $fCode -eq 0 -a -n "$RET" ]; then
dbc_basepath="$RET"
fi
. /usr/share/dbconfig-common/dpkg/config
Modified: trunk/redmine/debian/po/fr.po
===================================================================
--- trunk/redmine/debian/po/fr.po 2009-09-22 22:56:46 UTC (rev 4194)
+++ trunk/redmine/debian/po/fr.po 2009-09-22 22:56:51 UTC (rev 4195)
@@ -14,7 +14,7 @@
#. Description
#: ../templates:1001
msgid "Redmine package now supports mutiple instances"
-msgstr ""
+msgstr "Le paquet Redmine gère maintenant plusieurs instances"
#. Type: note
#. Description
@@ -23,7 +23,9 @@
"You are migrating from an unsupported version. The current instance will be "
"now called the \"default\" instance. Please check your web server "
"configuration files, see README.Debian."
-msgstr ""
+msgstr "Vous faites une migration depuis une version non supportée. L'instance "
+"actuelle va maintenant s'appeler \"default\". Veuillez vérifier la configuration "
+"de votre serveur web, voir README.Debian."
#. Type: string
#. Description
@@ -41,7 +43,7 @@
#. Description
#: ../templates:2001
msgid "Database (de)configuration will be asked accordingly."
-msgstr "Chaque base de données sera (dé)configurée respectivement."
+msgstr "Chaque base de données sera respectivement (dé)configurée."
#. Type: string
#. Description
Modified: trunk/redmine/debian/po/templates.pot
===================================================================
--- trunk/redmine/debian/po/templates.pot 2009-09-22 22:56:46 UTC (rev 4194)
+++ trunk/redmine/debian/po/templates.pot 2009-09-22 22:56:51 UTC (rev 4195)
@@ -3,7 +3,6 @@
# 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"
Modified: trunk/redmine/debian/postinst
===================================================================
--- trunk/redmine/debian/postinst 2009-09-22 22:56:46 UTC (rev 4194)
+++ trunk/redmine/debian/postinst 2009-09-22 22:56:51 UTC (rev 4195)
@@ -15,11 +15,17 @@
db_get redmine/old-instances || true
gOldInstances="${RET}"
for lInstance in $gOldInstances; do
- dbc_go redmine/instances/$lInstance remove
+ db_get redmine/instances/$lInstance/dbconfig-install || true
+ if [ "$RET" = "true" ]; then
+ dbc_go redmine/instances/$lInstance remove
+ fi
done
. /usr/share/dbconfig-common/dpkg/postrm
for lInstance in $gOldInstances; do
- dbc_go redmine/instances/$lInstance purge
+ db_get redmine/instances/$lInstance/dbconfig-install || true
+ if [ "$RET" = "true" ]; then
+ dbc_go redmine/instances/$lInstance purge
+ fi
if which ucf >/dev/null 2>&1; then
ucf --purge /etc/redmine/$lInstance/database.yml
ucf --purge /etc/redmine/$lInstance/email.yml
@@ -68,8 +74,12 @@
fi
if [ ! -e public/plugin_assets ]; then
mkdir public/plugin_assets
- chown -f www-data:www-data public/plugin_assets
fi
+ chown -f www-data:www-data public/plugin_assets
+ if [ ! -e tmp ]; then
+ mkdir tmp
+ fi
+ chown -fR www-data:www-data tmp
cd $savedir
;;
@@ -91,50 +101,58 @@
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
- # use same dbname if one has been registered in debconf before
- # this is also needed for migration from version <= 0.9.0~svn2819
- db_get redmine/instances/$lInstance/db/dbname || true
- if [ -n "$RET" ]; then
- dbc_dbname="$RET"
- else
- dbc_dbname=redmine-$lInstance
- fi
- db_get redmine/instances/$lInstance/db/basepath || true
- if [ -n "$RET" ]; then
- dbc_basepath="$RET"
- fi
-
- 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) || true
- 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
+ db_get redmine/instances/$lInstance/dbconfig-install || true
+ if [ "$RET" = "true" ]; then
+ # dbconfig needs this folder to ouput database.yml
+ mkdir -p $fRailsEtc
+ chown -f www-data:www-data $fRailsEtc
+ fYml=$fRailsEtc/database.yml.new
+ dbc_generate_include=template:$fYml
+ 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
+ # use same dbname if one has been registered in debconf before
+ # this is also needed for migration from version <= 0.9.0~svn2819
+ fCode=0
+ db_get redmine/instances/$lInstance/db/dbname || fCode=$?
+ if [ $fCode -eq 0 -a -n "$RET" ]; then
+ dbc_dbname="$RET"
+ else
+ dbc_dbname=redmine-$lInstance
fi
+ fCode=0
+ db_get redmine/instances/$lInstance/db/basepath || fCode=$?
+ if [ $fCode -eq 0 -a -n "$RET" ]; then
+ dbc_basepath="$RET"
+ fi
+
+ ucf --purge $fYml
+ dbc_go redmine/instances/$lInstance $@
+ ucf --purge $fYml
+
+ if [ -e $fYml ]; then
+ hasdb=$(grep -m 1 -o -E 'adapter: (mysql|pgsql|sqlite3|postgresql)' $fYml) || true
+ 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' $fYml
+ ;;
+ sqlite3)
+ sed -i -r -e 's/^[^#]+((database|host|port|username|password): [^:]*)$/# \1/g' $fYml
+ ;;
+ esac
+ fi
+ ucf --debconf-ok $fYml /etc/redmine/$lInstance/database.yml
+ rm -f $fYml
+ fi
fi
-
case "$1" in
configure)
# create directories
@@ -155,9 +173,9 @@
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 X_DEBIAN_SITEID="${lInstance}" VERBOSE=$RAKE_VERBOSE
- rake -s redmine:load_default_data RAILS_ENV=$fRailsEnv X_DEBIAN_SITEID="${lInstance}" REDMINE_LANG=$DEFAULT_LANGUAGE
- rake -s config/initializers/session_store.rb RAILS_ENV=$fRailsEnv X_DEBIAN_SITEID="${lInstance}"
+ rake -s db:migrate RAILS_ENV=$fRailsEnv X_DEBIAN_SITEID="${lInstance}" VERBOSE=$RAKE_VERBOSE || true
+ rake -s redmine:load_default_data RAILS_ENV=$fRailsEnv X_DEBIAN_SITEID="${lInstance}" REDMINE_LANG=$DEFAULT_LANGUAGE || true
+ rake -s config/initializers/session_store.rb RAILS_ENV=$fRailsEnv X_DEBIAN_SITEID="${lInstance}" || true
# 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
@@ -173,9 +191,9 @@
if [ $withdb -eq 1 ]; then
savedir="`pwd`"
cd /usr/share/redmine
- rake -s db:migrate RAILS_ENV=$fRailsEnv X_DEBIAN_SITEID="${lInstance}" VERBOSE=$RAKE_VERBOSE
- rake -s tmp:cache:clear RAILS_ENV=$fRailsEnv X_DEBIAN_SITEID="${lInstance}"
- rake -s tmp:sessions:clear RAILS_ENV=$fRailsEnv X_DEBIAN_SITEID="${lInstance}"
+ rake -s db:migrate RAILS_ENV=$fRailsEnv X_DEBIAN_SITEID="${lInstance}" VERBOSE=$RAKE_VERBOSE || true
+ rake -s tmp:cache:clear RAILS_ENV=$fRailsEnv X_DEBIAN_SITEID="${lInstance}" || true
+ rake -s tmp:sessions:clear RAILS_ENV=$fRailsEnv X_DEBIAN_SITEID="${lInstance}" || true
# because rake task is executed as root, make sure owner is www-data
chown -f www-data:www-data ${fRailsLog}/production.log
cd $savedir
Modified: trunk/redmine/debian/postrm
===================================================================
--- trunk/redmine/debian/postrm 2009-09-22 22:56:46 UTC (rev 4194)
+++ trunk/redmine/debian/postrm 2009-09-22 22:56:51 UTC (rev 4195)
@@ -21,28 +21,48 @@
db_get redmine/old-instances || true
gOldInstances="${RET}"
for lInstance in $gOldInstances; do
- dbc_go redmine/instances/$lInstance $@
+ db_get redmine/instances/$lInstance/dbconfig-install || true
+ if [ "$RET" = "true" ]; then
+ dbc_go redmine/instances/$lInstance $@
+ fi
done
db_get redmine/current-instances || true
gInstances="${RET}"
for lInstance in $gInstances; do
- dbc_go redmine/instances/$lInstance $@
+ db_get redmine/instances/$lInstance/dbconfig-install || true
+ if [ "$RET" = "true" ]; then
+ dbc_go redmine/instances/$lInstance $@
+ fi
done
fi
;;
purge)
+ db_get redmine/old-instances || true
+ gOldInstances="${RET}"
+ db_get redmine/current-instances || true
+ gInstances="${RET}"
+ if [ -f /usr/share/dbconfig-common/dpkg/postrm ]; then
+ . /usr/share/dbconfig-common/dpkg/postrm
+ for lInstance in $gOldInstances; do
+ db_get redmine/instances/$lInstance/dbconfig-install || true
+ if [ "$RET" = "true" ]; then
+ dbc_go redmine/instances/$lInstance $@
+ fi
+ done
+ for lInstance in $gInstances; do
+ db_get redmine/instances/$lInstance/dbconfig-install || true
+ if [ "$RET" = "true" ]; then
+ dbc_go redmine/instances/$lInstance $@
+ fi
+ done
+ fi
if which ucf >/dev/null 2>&1; then
- db_get redmine/old-instances || true
- gOldInstances="${RET}"
for lInstance in $gOldInstances; do
ucf --purge /etc/redmine/$lInstance/database.yml
ucf --purge /etc/redmine/$lInstance/email.yml
done
-
- db_get redmine/current-instances || true
- gInstances="${RET}"
for lInstance in $gInstances; do
ucf --purge /etc/redmine/$lInstance/database.yml
ucf --purge /etc/redmine/$lInstance/email.yml
Modified: trunk/redmine/debian/prerm
===================================================================
--- trunk/redmine/debian/prerm 2009-09-22 22:56:46 UTC (rev 4194)
+++ trunk/redmine/debian/prerm 2009-09-22 22:56:51 UTC (rev 4195)
@@ -14,13 +14,19 @@
db_get redmine/old-instances || true
gOldInstances="${RET}"
for lInstance in $gOldInstances; do
- dbc_go redmine/instances/$lInstance $@
+ db_get redmine/instances/$lInstance/dbconfig-install || true
+ if [ "$RET" = "true" ]; then
+ dbc_go redmine/instances/$lInstance $@
+ fi
done
db_get redmine/current-instances || true
gInstances="${RET}"
for lInstance in $gInstances; do
- dbc_go redmine/instances/$lInstance $@
+ db_get redmine/instances/$lInstance/dbconfig-install || true
+ if [ "$RET" = "true" ]; then
+ dbc_go redmine/instances/$lInstance $@
+ fi
done
Modified: trunk/redmine/debian/rules
===================================================================
--- trunk/redmine/debian/rules 2009-09-22 22:56:46 UTC (rev 4194)
+++ trunk/redmine/debian/rules 2009-09-22 22:56:51 UTC (rev 4195)
@@ -62,7 +62,6 @@
# rename cgi script, check permissions
mv debian/redmine/usr/share/redmine/public/dispatch.fcgi.example debian/redmine/usr/share/redmine/public/dispatch.fcgi
- chown -f www-data:www-data debian/redmine/usr/share/redmine/public/dispatch.fcgi
# remove example config files
rm -f debian/redmine/usr/share/redmine/config/email.yml.example
@@ -105,14 +104,10 @@
dh_compress
# Correct some owners and permissions
+ # this is commented since for now the debian package does not handle email.yml
# chown -f root:www-data debian/redmine/etc/redmine/email.yml
# contains credentials, do it here so that dpkg-statoverride can be used.
# chmod 640 debian/redmine/etc/redmine/email.yml
- #chown -fR www-data:www-data debian/redmine/var/run/redmine/sockets
- chown -fR www-data:www-data debian/redmine/var/log/redmine
- chown -fR www-data:www-data debian/redmine/var/lib/redmine
- chown -fR www-data:www-data debian/redmine/var/cache/redmine
- #chown -fR www-data:www-data debian/redmine/usr/share/redmine/public/plugin_assets
dh_fixperms -Xdebian/redmine/var/ -Xdebian/redmine/etc -Xdebian/redmine/usr/share/redmine/public/plugin_assets
dh_installdeb
More information about the Pkg-ruby-extras-commits
mailing list