[Debian-l10n-commits] r2788 - /pootle/trunk/debian/pootle.postinst

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


Author: themill-guest
Date: Wed Nov 16 16:09:12 2011
New Revision: 2788

URL: http://svn.debian.org/wsvn/?sc=1&rev=2788
Log:
Catch dbconfig-common database rename

* sql database can be renamed by dbconfig-common depending on the
  debconf level and previous answers to debconf questions. Handle this
  renaming gracefully within the postinst.

Modified:
    pootle/trunk/debian/pootle.postinst

Modified: pootle/trunk/debian/pootle.postinst
URL: http://svn.debian.org/wsvn/pootle/trunk/debian/pootle.postinst?rev=2788&op=diff
==============================================================================
--- pootle/trunk/debian/pootle.postinst (original)
+++ pootle/trunk/debian/pootle.postinst Wed Nov 16 16:09:12 2011
@@ -51,12 +51,20 @@
     chmod -R 755 $POOTLE_HOME/dbs
     chown -R $POOTLE_USER:$POOTLE_GROUP $POOTLE_HOME/dbs
 
+    # also fix the permission on the sqlite database if relevant
     [ -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"
+        # handle name change of database that dbconfig-common might
+        # choose to make depending on previous answers to debconf questions
+        # and debconf priority used by user
+        db="$dbc_basepath/$dbc_dbname"
+        if [ ! -f "$db" -a -f "$db.db" ]; then
+            mv "$db.db" "$db"
+        fi
+        chown -f $POOTLE_USER:$POOTLE_GROUP "$dbc_basepath/$dbc_dbname"
+        chmod -f 640 "$dbc_basepath/$dbc_dbname"
     fi
 
     # Also protect config files




More information about the Debian-l10n-commits mailing list