[med-svn] r13441 - trunk/packages/gnuhealth/trunk/debian

Emilien Klein e2jk-guest at alioth.debian.org
Mon Apr 29 19:56:52 UTC 2013


Author: e2jk-guest
Date: 2013-04-29 19:56:51 +0000 (Mon, 29 Apr 2013)
New Revision: 13441

Modified:
   trunk/packages/gnuhealth/trunk/debian/postinst
   trunk/packages/gnuhealth/trunk/debian/postrm
Log:
Add system user and create log directory


Modified: trunk/packages/gnuhealth/trunk/debian/postinst
===================================================================
--- trunk/packages/gnuhealth/trunk/debian/postinst	2013-04-29 19:04:04 UTC (rev 13440)
+++ trunk/packages/gnuhealth/trunk/debian/postinst	2013-04-29 19:56:51 UTC (rev 13441)
@@ -27,8 +27,19 @@
 # the debian-policy package
 
 
+GNUHEALTH_USER="gnuhealth"
+GNUHEALTH_LOGDIR="/var/log/gnuhealth"
+
 case "$1" in
     configure)
+		# Creating system user
+		adduser --no-create-home --quiet --system --group ${GNUHEALTH_USER}
+        
+		# Creating log directory
+		mkdir -p ${GNUHEALTH_LOGDIR}
+		chown ${GNUHEALTH_USER}:adm ${GNUHEALTH_LOGDIR}
+		chmod 0750 ${GNUHEALTH_LOGDIR}
+		
         # Check if the gnuhealth database role already exists
         role=`psql -U postgres -c "\du" 2>/dev/null | grep gnuhealth | wc -l`
         if [ $role -eq 0 ]; then
@@ -48,6 +59,7 @@
                 db_go
             fi
         fi
+        
         # Start the Tryton server
         if which invoke-rc.d >/dev/null 2>&1; then
             invoke-rc.d tryton-server start

Modified: trunk/packages/gnuhealth/trunk/debian/postrm
===================================================================
--- trunk/packages/gnuhealth/trunk/debian/postrm	2013-04-29 19:04:04 UTC (rev 13440)
+++ trunk/packages/gnuhealth/trunk/debian/postrm	2013-04-29 19:56:51 UTC (rev 13441)
@@ -28,8 +28,21 @@
 # the debian-policy package
 
 
+GNUHEALTH_USER="gnuhealth"
+GNUHEALTH_LOGDIR="/var/log/gnuhealth"
+
 case "$1" in
-    purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+    purge)
+		# Remove system user
+		if [ -x /usr/sbin/deluser ]; then
+			deluser --quiet --system ${GNUHEALTH_USER}
+		fi
+
+		# Remove log directory
+		rmdir --ignore-fail-on-non-empty ${GNUHEALTH_LOGDIR} > /dev/null 2>&1 || true
+		;;
+	
+    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
         # Start the Tryton server
         if which invoke-rc.d >/dev/null 2>&1; then
             invoke-rc.d tryton-server start




More information about the debian-med-commit mailing list