[Debian-l10n-commits] r2796 - in /pootle/trunk/debian: pootle.config pootle.default pootle.init pootle.postinst

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


Author: themill-guest
Date: Wed Nov 16 16:09:37 2011
New Revision: 2796

URL: http://svn.debian.org/wsvn/?sc=1&rev=2796
Log:
Run PootleServer as selected user/group

* also make selection of user/group more robust

Modified:
    pootle/trunk/debian/pootle.config
    pootle/trunk/debian/pootle.default
    pootle/trunk/debian/pootle.init
    pootle/trunk/debian/pootle.postinst

Modified: pootle/trunk/debian/pootle.config
URL: http://svn.debian.org/wsvn/pootle/trunk/debian/pootle.config?rev=2796&op=diff
==============================================================================
--- pootle/trunk/debian/pootle.config (original)
+++ pootle/trunk/debian/pootle.config Wed Nov 16 16:09:37 2011
@@ -3,6 +3,8 @@
 set -e
 
 . /usr/share/debconf/confmodule
+
+[ -r /etc/default/pootle ] && . /etc/default/pootle
 
 POOTLE_HOME=/var/lib/pootle
 
@@ -32,20 +34,27 @@
 db_input high pootle/webserver || true
 db_go || true
 
-# Pick sensible default user/group names for the installation depending
-# on what configuration route the user has selected
-db_get pootle/webserver
-if [ "$RET" = "standalone" ]; then
-      db_set pootle/server-username pootle
-      db_set pootle/server-groupname pootle
-elif [ -d "$POOTLE_HOME" ]; then
-    POOTLE_USER=$(stat -c"%U" "$POOTLE_HOME")
-    POOTLE_GROUP=$(stat -c"%G" "$POOTLE_HOME")
-    if [ "$POOTLE_USER" != "root" -a "$POOTLE_GROUP" != "root" ]; then
-        db_set pootle/server-username $POOTLE_USER
-        db_set pootle/server-groupname $POOTLE_GROUP
+
+db_fget pootle/server-username seen || true
+if [ "$RET" = "false" ]; then
+    # Pick sensible default user/group names for the installation depending
+    # on what configuration route the user has selected
+    db_get pootle/webserver
+    if [ "$RET" = "standalone" ]; then
+          POOTLE_USER=pootle
+          POOTLE_GROUP=pootle
+    elif [ -d "$POOTLE_HOME" ]; then
+        POOTLE_USER=$(stat -c"%U" "$POOTLE_HOME")
+        POOTLE_GROUP=$(stat -c"%G" "$POOTLE_HOME")
+        if [ "$POOTLE_USER" = "root" -o "$POOTLE_GROUP" = "root" ]; then
+            POOTLE_USER=www-data
+            POOTLE_GROUP=www-data
+        fi
     fi
 fi
+
+db_set pootle/server-username $POOTLE_USER
+db_set pootle/server-groupname $POOTLE_GROUP
 
 db_input medium pootle/server-username || true
 db_input medium pootle/server-groupname || true

Modified: pootle/trunk/debian/pootle.default
URL: http://svn.debian.org/wsvn/pootle/trunk/debian/pootle.default?rev=2796&op=diff
==============================================================================
--- pootle/trunk/debian/pootle.default (original)
+++ pootle/trunk/debian/pootle.default Wed Nov 16 16:09:37 2011
@@ -6,3 +6,8 @@
 # Additional options for the Pootle daemon
 POOTLE_OPTIONS=""
 
+# User that the Pootle daemon should run as
+POOTLE_USER=pootle
+
+# Group that the Pootle daemon should run as
+POOTLE_GROUP=pootle

Modified: pootle/trunk/debian/pootle.init
URL: http://svn.debian.org/wsvn/pootle/trunk/debian/pootle.init?rev=2796&op=diff
==============================================================================
--- pootle/trunk/debian/pootle.init (original)
+++ pootle/trunk/debian/pootle.init Wed Nov 16 16:09:37 2011
@@ -15,6 +15,14 @@
 
 set -e
 
+# Defaults
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/sbin/PootleServer
+PIDFILE=/var/run/pootle/pootle.pid
+POOTLE_USER=pootle
+POOTLE_GROUP=pootle
+DESC="Pootle daemon: PootleServer"
+
 [ -r /etc/default/pootle ] && . /etc/default/pootle
 
 case "$POOTLE_ENABLE" in
@@ -25,14 +33,6 @@
 		exit 0
 		;;
 esac
-
-# Defaults
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
-DAEMON=/usr/sbin/PootleServer
-PIDFILE=/var/run/pootle/pootle.pid
-POOTLE_USER=pootle
-POOTLE_GROUP=pootle
-DESC="Pootle daemon: PootleServer"
 
 OPTIONS="$POOTLE_OPTIONS"
 

Modified: pootle/trunk/debian/pootle.postinst
URL: http://svn.debian.org/wsvn/pootle/trunk/debian/pootle.postinst?rev=2796&op=diff
==============================================================================
--- pootle/trunk/debian/pootle.postinst (original)
+++ pootle/trunk/debian/pootle.postinst Wed Nov 16 16:09:37 2011
@@ -13,7 +13,7 @@
 
 db_get pootle/server-username || true
 POOTLE_USER=${RET-www-data}
-db_get pootle/server-username || true
+db_get pootle/server-groupname || true
 POOTLE_GROUP=${RET-www-data}
 
 dbc_first_version="2.0.5-2"
@@ -70,6 +70,11 @@
     # Also protect config files
     chmod 750 /etc/pootle
     chown -R root:$POOTLE_GROUP /etc/pootle
+
+    # Store the user selection in /etc/default/pootle for init script
+    sed -i "s/^POOTLE_USER=.*/POOTLE_USER=$POOTLE_USER/;
+            s/^POOTLE_GROUP=.*/POOTLE_GROUP=$POOTLE_GROUP/" \
+            /etc/default/pootle
 }
 
 configure_memcached() {




More information about the Debian-l10n-commits mailing list