[Debian-l10n-commits] r2785 - in /pootle/trunk/debian: TODO dbconfig.template pootle.postinst

themill-guest at users.alioth.debian.org themill-guest at users.alioth.debian.org
Wed Nov 16 16:09:05 UTC 2011


Author: themill-guest
Date: Wed Nov 16 16:09:05 2011
New Revision: 2785

URL: http://svn.debian.org/wsvn/?sc=1&rev=2785
Log:
Handle permissions and sqlite db better

Modified:
    pootle/trunk/debian/TODO
    pootle/trunk/debian/dbconfig.template
    pootle/trunk/debian/pootle.postinst

Modified: pootle/trunk/debian/TODO
URL: http://svn.debian.org/wsvn/pootle/trunk/debian/TODO?rev=2785&op=diff
==============================================================================
--- pootle/trunk/debian/TODO (original)
+++ pootle/trunk/debian/TODO Wed Nov 16 16:09:05 2011
@@ -12,10 +12,6 @@
 
 * implement a lighttpd configuration
 
-* sqlite database gets left behind on purge (dbconfig-common gets the name
-  of the database wrong; it's missing the .db)
-
-
 lintian
 =======
 I: pootle source: quilt-patch-missing-description debian_use_dbconfig.patch

Modified: pootle/trunk/debian/dbconfig.template
URL: http://svn.debian.org/wsvn/pootle/trunk/debian/dbconfig.template?rev=2785&op=diff
==============================================================================
--- pootle/trunk/debian/dbconfig.template (original)
+++ pootle/trunk/debian/dbconfig.template Wed Nov 16 16:09:05 2011
@@ -9,4 +9,4 @@
     DATABASE_ENGINE = 'postgresql_psycopg2'
 
 if DATABASE_ENGINE == 'sqlite3':
-    DATABASE_NAME = working_path('dbs/pootle.db')
+    DATABASE_NAME = '_DBC_BASEPATH_/_DBC_DBNAME_'

Modified: pootle/trunk/debian/pootle.postinst
URL: http://svn.debian.org/wsvn/pootle/trunk/debian/pootle.postinst?rev=2785&op=diff
==============================================================================
--- pootle/trunk/debian/pootle.postinst (original)
+++ pootle/trunk/debian/pootle.postinst Wed Nov 16 16:09:05 2011
@@ -5,18 +5,9 @@
 
 set -e
 
-dbc_first_version="2.0.5-2"
-dbc_generate_include='template:/etc/pootle/dbconfig.py'
-dbc_generate_include_args=' -o template_infile=/usr/share/doc/pootle/dbconfig.template'
-dbc_generate_include_owner='root:root'
-dbc_generate_include_perms='640'
-dbc_pgsql_createdb_encoding='UTF8'
-dbc_sql_substitutions='true'
+. /usr/share/debconf/confmodule
+. /usr/share/dbconfig-common/dpkg/postinst
 
-. /usr/share/debconf/confmodule
-# source dbconfig-common stuff');
-. /usr/share/dbconfig-common/dpkg/postinst
-dbc_go pootle $@
 
 POOTLE_HOME=/var/lib/pootle
 
@@ -25,7 +16,15 @@
 db_get pootle/server-username || true
 POOTLE_GROUP=${RET-www-data}
 
-set_permissions() {
+dbc_first_version="2.0.5-2"
+dbc_generate_include='template:/etc/pootle/dbconfig.py'
+dbc_generate_include_args=' -o template_infile=/usr/share/doc/pootle/dbconfig.template'
+dbc_generate_include_owner="$POOTLE_USER:$POOTLE_GROUP"
+dbc_generate_include_perms='640'
+dbc_pgsql_createdb_encoding='UTF8'
+dbc_sql_substitutions='true'
+
+create_user_group() {
     if ! getent group $POOTLE_GROUP > /dev/null 2>&1; then
         echo -n "Adding group $POOTLE_GROUP.."
         addgroup --quiet --system $POOTLE_GROUP
@@ -39,6 +38,10 @@
                 $POOTLE_USER
         echo "..done"
     fi
+}
+
+set_permissions() {
+    create_user_group
 
     mkdir -p $POOTLE_HOME
     chmod 755 $POOTLE_HOME
@@ -47,6 +50,14 @@
     chown -R $POOTLE_USER:$POOTLE_GROUP $POOTLE_HOME/po
     chmod -R 755 $POOTLE_HOME/dbs
     chown -R $POOTLE_USER:$POOTLE_GROUP $POOTLE_HOME/dbs
+
+    [ -r /etc/dbconfig-common/pootle.conf ] && \
+        . /etc/dbconfig-common/pootle.conf
+    if [ "$dbc_dbtype" = "sqlite3" -a  \
+            ! -z "$dbc_basepath" -a ! -z "$dbc_dbname" ]; then
+        chown $POOTLE_USER:$POOTLE_GROUP "$dbc_basepath/$dbc_dbname"
+        chmod 640 "$dbc_basepath/$dbc_dbname"
+    fi
 
     # Also protect config files
     chmod 750 /etc/pootle
@@ -113,8 +124,12 @@
     su $POOTLE_USER -p -c "django-admin updatedb --settings=pootle.settings"
 }
 
+
 case "$1" in
     configure|reconfigure)
+        create_user_group
+        dbc_go pootle $@
+
         set_permissions
         configure_memcached
         if [ -z "$2" ]; then
@@ -158,6 +173,7 @@
         ;;
 
     abort-upgrade|abort-remove|abort-deconfigure)
+        dbc_go pootle $@
         ;;
 
     *)




More information about the Debian-l10n-commits mailing list