[Pkg-grid-commits] nws/debian nws.postinst,1.2,1.3

Martin Quinson mquinson at alioth.debian.org
Mon Aug 8 21:26:07 UTC 2005


Update of /cvsroot/pkg-grid/nws/debian
In directory haydn:/tmp/cvs-serv4324

Modified Files:
	nws.postinst 
Log Message:
Create the user we need on package installation

Index: nws.postinst
===================================================================
RCS file: /cvsroot/pkg-grid/nws/debian/nws.postinst,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- nws.postinst	26 Jul 2004 17:17:04 -0000	1.2
+++ nws.postinst	8 Aug 2005 21:26:04 -0000	1.3
@@ -38,6 +38,31 @@
 #  [ -e $LOCALCONF ] && cp $LOCALCONF /tmp/nws.debug
 }
 
+#########################
+## Create the nws user if needed
+##
+
+if ! getent passwd nws >/dev/null; then
+   adduser --quiet --system --no-create-home --home /var/state/nws nws
+fi
+NWSUID=`getent passwd nws |cut -d: -f 3`
+
+#########################
+## Give the right rights to the directories the processes need to write onto
+##
+for dir in /var/log/nws /var/state/nws ; do
+   if ! dpkg-statoverride --list $dir >/dev/null; then
+      dpkg-statoverride --update --add nws root 2755 $dir
+   fi
+   override=`dpkg-statoverride --list $dir|cut -d' ' -f1,2|sed 's/ /:/'`
+   for file in `find $dir -type f` ; do 
+     chown $override $file
+   done
+done
+
+#########################
+## Generate the config file from debconf answers if asked to
+##
 db_get nws/debconf
 if [ "$RET" = "true" ] ; then
 	db_get nws/run_nameserver;		RUN_NS="$RET"
@@ -104,13 +129,15 @@
 ## Configuration for this machine ##
 ####################################
 
-# nameserver: location of the nameserver to use
 END
-#EOF1;
 
-echo "nameserver=$NS" >>$LOCALCONF 
-echo                  >>$LOCALCONF
-echo "# memory: location of the memory server to use" >> $LOCALCONF
+echo "# uid: user ID under which NWS processes must run">>$LOCALCONF
+echo "uid=$NWSUID"                                      >>$LOCALCONF 
+echo                                                   >>$LOCALCONF
+echo "# nameserver: location of the nameserver to use" >> $LOCALCONF
+echo "nameserver=$NS"                                  >>$LOCALCONF 
+echo                                                   >>$LOCALCONF
+echo "# memory: location of the memory server to use"  >> $LOCALCONF
 echo "memory=$MEM"    >>$LOCALCONF
 echo                  >>$LOCALCONF
 echo "# part_to_run: nws elements to run on this machine"   >>$LOCALCONF
@@ -183,6 +210,11 @@
 
 fi # only generate the conf file when asked so in debconf
 
+########################################################################
+#########    End of debconf and configuration generation stuff #########
+########################################################################
+
+                                
 # dh_installdeb will replace this with shell code automatically
 # generated by other debhelper scripts.
 




More information about the Pkg-grid-commits mailing list