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

sgolovan at alioth.debian.org sgolovan at alioth.debian.org
Fri Dec 20 11:50:10 UTC 2013


Author: sgolovan
Date: 2013-12-20 11:50:10 +0000 (Fri, 20 Dec 2013)
New Revision: 1580

Modified:
   yaws/trunk/debian/changelog
   yaws/trunk/debian/control
   yaws/trunk/debian/yaws.init
   yaws/trunk/debian/yaws.postinst
   yaws/trunk/debian/yaws.postrm
Log:
[yaws]
  * Use userdel --force in postrm script to remove the yaws user on purging
    the yaws package.
  * Create yaws homedir if it doesn't exist in postinst script.
  * Delete /etc/yaws directory in postrm script only if it does exist.
  * Use init functions from lsb-base to report init.d script progress and
    status.
  * More carefully process errors when starting and stopping the Yaws daemon
    (closes: #728796).


Modified: yaws/trunk/debian/changelog
===================================================================
--- yaws/trunk/debian/changelog	2013-12-16 11:58:29 UTC (rev 1579)
+++ yaws/trunk/debian/changelog	2013-12-20 11:50:10 UTC (rev 1580)
@@ -1,8 +1,15 @@
-yaws (1.98-2) UNRELEASED; urgency=low
+yaws (1.98-2) unstable; urgency=low
 
-  * NOT RELEASED YET
+  * Use userdel --force in postrm script to remove the yaws user on purging
+    the yaws package.
+  * Create yaws homedir if it doesn't exist in postinst script.
+  * Delete /etc/yaws directory in postrm script only if it does exist.
+  * Use init functions from lsb-base to report init.d script progress and
+    status.
+  * More carefully process errors when starting and stopping the Yaws daemon
+    (closes: #728796).
 
- -- Sergei Golovan <sgolovan at debian.org>  Fri, 22 Nov 2013 20:05:51 +0400
+ -- Sergei Golovan <sgolovan at debian.org>  Fri, 20 Dec 2013 15:49:50 +0400
 
 yaws (1.98-1) unstable; urgency=low
 

Modified: yaws/trunk/debian/control
===================================================================
--- yaws/trunk/debian/control	2013-12-16 11:58:29 UTC (rev 1579)
+++ yaws/trunk/debian/control	2013-12-20 11:50:10 UTC (rev 1580)
@@ -15,7 +15,7 @@
 Package: yaws
 Architecture: all
 Provides: httpd, httpd-cgi
-Depends: erlang-yaws (>= ${binary:Version}), adduser, ssl-cert, ${misc:Depends}
+Depends: erlang-yaws (>= ${binary:Version}), adduser, ssl-cert, lsb-base (>= 3.0-6), ${misc:Depends}
 Suggests: yaws-doc, yaws-chat, yaws-mail, yaws-wiki, yaws-yapp
 Description: High performance HTTP 1.1 webserver written in Erlang
  Yaws is a high performance HTTP 1.1 webserver written in Erlang. It is a 

Modified: yaws/trunk/debian/yaws.init
===================================================================
--- yaws/trunk/debian/yaws.init	2013-12-16 11:58:29 UTC (rev 1579)
+++ yaws/trunk/debian/yaws.init	2013-12-20 11:50:10 UTC (rev 1580)
@@ -18,14 +18,11 @@
 #                    HTTP 1.1 webserver written in Erlang.
 ### END INIT INFO
 
-set -e
-
 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 DAEMON=/usr/bin/yaws
-NAME="Yaws web server"
-DESC=yaws
+NAME=yaws
+DESC="Yaws web server"
 YAWS_USER=yaws
-YAWS_USER_HOME=/var/cache/yaws
 YAWS_ID=debian_yaws
 
 test -x $DAEMON || exit 0
@@ -35,11 +32,14 @@
     . /etc/default/yaws
 fi
 
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
+. /lib/lsb/init-functions
+
 daemon()
 {
-    cd $YAWS_USER_HOME
     script="$DAEMON --id $YAWS_ID $@"
-    su $YAWS_USER -c "$script"
+    su -l $YAWS_USER -c "$script"
 }
 
 start()
@@ -48,14 +48,14 @@
 
     cnt=0
     while ! (daemon --status >/dev/null || test $? = 3) ; do
-	echo -n .
+	log_progress_msg .
 	cnt=`expr $cnt + 1`
 	if [ $cnt -ge 10 ] ; then
-	    echo -n " failed"
-	    break
+	    return 1
 	fi
 	sleep 1
     done
+    return 0
 }
 
 stop()
@@ -64,39 +64,39 @@
 
     cnt=0
     while ! (daemon --status >/dev/null || test $? = 3) ; do
-	echo -n .
+	log_progress_msg .
 	cnt=`expr $cnt + 1`
 	if [ $cnt -ge 10 ] ; then
-	    echo -n " failed"
-	    break
+	    return 1
 	fi
 	sleep 1
     done
+    return 0
 }
 
 case "$1" in
     start)
-	echo -n "Starting $DESC: "
+	log_daemon_msg "Starting $DESC" "$NAME"
 	start
-	echo "$NAME."
+	log_end_msg $?
     ;;
     stop)
-	echo -n "Stopping $DESC: "
+	log_daemon_msg "Stopping $DESC" "$NAME"
 	stop
-	echo "$NAME."
+	log_end_msg $?
     ;;
     status)
 	daemon --status
     ;;
     reload|force-reload)
-	echo "Reloading $DESC configuration files."
-	daemon --hup
+	log_daemon_msg "Reloading $DESC config" "$NAME"
+	daemon --hup >/dev/null && log_end_msg 0 || log_end_msg 1
     ;;
     restart)
-	echo -n "Restarting $DESC: "
+	log_daemon_msg "Restarting $DESC" "$NAME"
 	stop
 	start
-	echo "$NAME."
+	log_end_msg $?
     ;;
     *)
 	N=/etc/init.d/$NAME

Modified: yaws/trunk/debian/yaws.postinst
===================================================================
--- yaws/trunk/debian/yaws.postinst	2013-12-16 11:58:29 UTC (rev 1579)
+++ yaws/trunk/debian/yaws.postinst	2013-12-20 11:50:10 UTC (rev 1580)
@@ -66,6 +66,9 @@
 	    adduser --quiet yaws ssl-cert
 	fi
 
+	# Create the homedir if it doesn't exist for some reason
+	mkdir -p /var/cache/yaws
+
 	# Only user yaws and root are allowed to create yaws control files
 	chown -R yaws:yaws /var/cache/yaws
 	chmod 750 /var/cache/yaws

Modified: yaws/trunk/debian/yaws.postrm
===================================================================
--- yaws/trunk/debian/yaws.postrm	2013-12-16 11:58:29 UTC (rev 1579)
+++ yaws/trunk/debian/yaws.postrm	2013-12-20 11:50:10 UTC (rev 1580)
@@ -34,15 +34,18 @@
 
 	# Remove /etc/yaws/conf.d and /etc/yaws/ if they're empty
 	# (we won't remove user-created files)
-	(cd /etc && rmdir --parents --ignore-fail-on-non-empty yaws/conf.d)
+	if [ -d /etc/yaws/conf.d ] ; then
+	    (cd /etc && rmdir --parents --ignore-fail-on-non-empty yaws/conf.d)
+	elif [ -d /etc/yaws ] ; then
+	    (cd /etc && rmdir --ignore-fail-on-non-empty yaws)
+	fi
 
 	rm -f /etc/default/yaws 2>/dev/null
 	rm -rf /var/log/yaws 2>/dev/null
 	rm -rf /var/run/yaws 2>/dev/null
 	rm -rf /var/cache/yaws 2>/dev/null
 
-	deluser yaws 2>/dev/null || true
-	delgroup yaws 2>/dev/null || true
+	userdel --force --remove yaws 2>/dev/null || true
     ;;
 
     *)




More information about the Pkg-erlang-commits mailing list