[Pkg-erlang-commits] r1632 - yaws/trunk/debian

sgolovan at alioth.debian.org sgolovan at alioth.debian.org
Mon May 12 09:25:29 UTC 2014


Author: sgolovan
Date: 2014-05-12 09:25:28 +0000 (Mon, 12 May 2014)
New Revision: 1632

Modified:
   yaws/trunk/debian/changelog
   yaws/trunk/debian/yaws.init
   yaws/trunk/debian/yaws.postinst
Log:
[yaws]
  * Don't use su for switching to the yaws user in init.d script. Use
    start-stop-daemon instead. Also, use the default shell for the yaws
    system user instead of /bin/sh.


Modified: yaws/trunk/debian/changelog
===================================================================
--- yaws/trunk/debian/changelog	2014-05-07 07:38:50 UTC (rev 1631)
+++ yaws/trunk/debian/changelog	2014-05-12 09:25:28 UTC (rev 1632)
@@ -1,8 +1,10 @@
-yaws (1.98-3) UNRELEASED; urgency=low
+yaws (1.98-3) unstable; urgency=low
 
-  * NOT RELEASED YET
+  * Don't use su for switching to the yaws user in init.d script. Use
+    start-stop-daemon instead. Also, use the default shell for the yaws
+    system user instead of /bin/sh.
 
- -- Sergei Golovan <sgolovan at debian.org>  Fri, 20 Dec 2013 15:53:24 +0400
+ -- Sergei Golovan <sgolovan at debian.org>  Mon, 12 May 2014 13:23:41 +0400
 
 yaws (1.98-2) unstable; urgency=low
 

Modified: yaws/trunk/debian/yaws.init
===================================================================
--- yaws/trunk/debian/yaws.init	2014-05-07 07:38:50 UTC (rev 1631)
+++ yaws/trunk/debian/yaws.init	2014-05-12 09:25:28 UTC (rev 1632)
@@ -32,22 +32,29 @@
     . /etc/default/yaws
 fi
 
+YAWS_HOME=$(sh -c "echo ~$YAWS_USER")
+
 # Define LSB log_* functions.
 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
 . /lib/lsb/init-functions
 
-daemon()
+control()
 {
-    script="$DAEMON --id $YAWS_ID $@"
-    su -l $YAWS_USER -c "$script"
+    HOME="$YAWS_HOME" $DAEMON --id $YAWS_ID $@
 }
 
 start()
 {
-    daemon --daemon $DAEMON_OPTS
-
+    HOME="$YAWS_HOME" start-stop-daemon --quiet \
+					--user $YAWS_USER \
+					--chuid $YAWS_USER \
+					--exec $DAEMON \
+					--start \
+					-- \
+					--id $YAWS_ID \
+					--daemon $DAEMON_OPTS
     cnt=0
-    while ! (daemon --status >/dev/null || test $? = 3) ; do
+    while ! (control --status >/dev/null || test $? = 3) ; do
 	log_progress_msg .
 	cnt=`expr $cnt + 1`
 	if [ $cnt -ge 10 ] ; then
@@ -60,10 +67,10 @@
 
 stop()
 {
-    daemon --stop >/dev/null || test $? = 3
+    control --stop >/dev/null || test $? = 3
 
     cnt=0
-    while ! (daemon --status >/dev/null || test $? = 3) ; do
+    while ! (control --status >/dev/null || test $? = 3) ; do
 	log_progress_msg .
 	cnt=`expr $cnt + 1`
 	if [ $cnt -ge 10 ] ; then
@@ -86,11 +93,11 @@
 	log_end_msg $?
     ;;
     status)
-	daemon --status
+	control --status
     ;;
     reload|force-reload)
 	log_daemon_msg "Reloading $DESC config" "$NAME"
-	daemon --hup >/dev/null && log_end_msg 0 || log_end_msg 1
+	control --hup >/dev/null && log_end_msg 0 || log_end_msg 1
     ;;
     restart)
 	log_daemon_msg "Restarting $DESC" "$NAME"

Modified: yaws/trunk/debian/yaws.postinst
===================================================================
--- yaws/trunk/debian/yaws.postinst	2014-05-07 07:38:50 UTC (rev 1631)
+++ yaws/trunk/debian/yaws.postinst	2014-05-12 09:25:28 UTC (rev 1632)
@@ -25,7 +25,7 @@
 case "$1" in
     configure)
 	# Create yaws user
-	adduser --quiet --system --shell /bin/sh --group --home /var/cache/yaws yaws
+	adduser --quiet --system --group --home /var/cache/yaws yaws
 	# Moving home directory if it's still in /var/run
 	usermod --home /var/cache/yaws --move-home yaws >/dev/null 2>/dev/null
 




More information about the Pkg-erlang-commits mailing list