[debian-edu-commits] debian-edu/pkg-team/ 120/159: init script

Dominik George natureshadow-guest at moszumanska.debian.org
Tue Feb 23 10:04:31 UTC 2016


This is an automated email from the git hooks/post-receive script.

natureshadow-guest pushed a commit to branch master
in repository xrdp.

commit 40ccc7b24fb59740bd234ec296f5e68f21c5ebd5
Author: mirabilos <tg at mirbsd.org>
Date:   Sun Aug 30 21:03:39 2015 +0000

    init script
---
 README.Debian |  12 ++--
 README.source |   4 +-
 changelog     |   3 +-
 xrdp.init     | 212 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 224 insertions(+), 7 deletions(-)

diff --git a/README.Debian b/README.Debian
index 6e70299..93a0dbd 100644
--- a/README.Debian
+++ b/README.Debian
@@ -1,9 +1,13 @@
-There currently is only integration with systemd.
-XXX missing: SESMAN_START is not honoured there
+There is currently integration with:
+• systemd
+  ‣ SESMAN_START is not honoured
+  ‣ xrdp is started as root
+  ‣ /var/run/xrdp may not be created correctly
+• sysvinit (file-rc, sysv-rc)
 
 To start this manually, you have to do the following
-(please submit actual methods, fixes, sysv-rc/file-rc
-scripts, and possibly upstart and OpenRC scripts, to us):
+(please submit actual methods, fixes, and possibly
+upstart and OpenRC scripts, to us):
 
 Initially:
 • review /etc/xrdp/xrdp.ini
diff --git a/README.source b/README.source
index 7aff8b8..ff0dccb 100644
--- a/README.source
+++ b/README.source
@@ -14,9 +14,9 @@ way doesn’t work well automatedly either.
 
 TODO:
 
-- provide Debian init system integration, cf. README.Debian
+- improve Debian init system integration, cf. README.Debian
 
-- create upgrade path from xrdb-in-debian (conffiles, piuparts, etc.)
+- test upgrade path from xrdb-in-debian (conffiles, piuparts, etc.)
 
 - build and install the pulseaudio plugin
   from sesman/chansrv/pulse but there is no pulseaudio-modules-dev
diff --git a/changelog b/changelog
index 10862ff..3d07336 100644
--- a/changelog
+++ b/changelog
@@ -1,8 +1,9 @@
 xrdp (0.9.0~git20150830+dfsg-1~beta2) teckids; urgency=medium
 
   * Adjust Recommends and add Provides for xorgxrdp setup
+  * Add sysvinit (file-rc, sysv-rc) LSB script (untested)
 
- -- Thorsten Glaser <thorsten.glaser at teckids.org>  Sun, 30 Aug 2015 20:09:50 +0000
+ -- Thorsten Glaser <thorsten.glaser at teckids.org>  Sun, 30 Aug 2015 21:03:14 +0000
 
 xrdp (0.9.0~git20150830+dfsg-1~beta1) teckids; urgency=high
 
diff --git a/xrdp.init b/xrdp.init
new file mode 100644
index 0000000..290a353
--- /dev/null
+++ b/xrdp.init
@@ -0,0 +1,212 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:          xrdp
+# Required-Start:    $remote_fs $syslog $network
+# Required-Stop:     $remote_fs $syslog $network
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: XRDP startup script
+# Description:       The xrdp daemon uses the Remote Desktop Protocol
+#                    to present a graphical login to a remote client,
+#                    allowing connections to a VNC or X.org-xrdp or
+#                    another RDP server; xrdp-sesman manages user
+#                    sessions: it authenticates the user against PAM
+#                    and starts the appropriate X server, if any.
+### END INIT INFO
+#-
+# Copyright © 2015 mirabilos <thorsten.glaser at teckids.org>
+# Published under The MirOS Licence.
+
+# absolute basics
+LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin
+export LC_ALL PATH
+unset LANGUAGE
+
+# exit cleanly if disabled or not installed
+test -x /usr/sbin/xrdp || exit 0
+
+# Debian/LSB init script foobar
+DESC='Remote Desktop Protocol server'
+NAME=xrdp
+. /lib/init/vars.sh
+test -t 0 && VERBOSE=yes
+. /lib/lsb/init-functions
+
+# read options
+SESMAN_START=yes
+SESMAN_OPTIONS=
+XRDP_OPTIONS=
+test -r /etc/default/xrdp && . /etc/default/xrdp
+
+# create run directory
+test -d /var/run/xrdp || mkdir /var/run/xrdp || exit $?
+chown xrdp:xrdp /var/run/xrdp || exit $?
+
+# take action
+rv=0
+case $1 in
+(start)
+	test x"$VERBOSE" = x"no" || log_daemon_msg "Starting $DESC"
+	test x"SESMAN_START" = x"yes" && \
+	    if start-stop-daemon --start --quiet \
+	    --pidfile /var/run/xrdp/xrdp-sesman.pid \
+	    --startas /usr/sbin/xrdp-sesman --name xrdp-sesman \
+	    --exec /usr/sbin/xrdp-sesman --test; then
+		test x"$VERBOSE" = x"no" || log_progress_msg "xrdp-sesman"
+		start-stop-daemon --start --quiet \
+		    --pidfile /var/run/xrdp/xrdp-sesman.pid \
+		    --startas /usr/sbin/xrdp-sesman --name xrdp-sesman \
+		    --exec /usr/sbin/xrdp-sesman -- $SESMAN_OPTIONS
+		rc=$?
+		test $rc -gt 0 && rv=$rc
+	else
+		test x"$VERBOSE" = x"no" || \
+		    log_progress_msg "sesman already running"
+	fi
+	if start-stop-daemon --start --quiet \
+	    --pidfile /var/run/xrdp/xrdp.pid \
+	    --chuid xrdp:xrdp \
+	    --startas /usr/sbin/xrdp --name xrdp \
+	    --exec /usr/sbin/xrdp --test; then
+		test x"$VERBOSE" = x"no" || log_progress_msg "xrdp"
+		start-stop-daemon --start --quiet \
+		    --pidfile /var/run/xrdp/xrdp.pid \
+		    --chuid xrdp:xrdp \
+		    --startas /usr/sbin/xrdp --name xrdp \
+		    --exec /usr/sbin/xrdp -- $XRDP_OPTIONS
+		rc=$?
+		test $rc -gt 0 && rv=$rc
+	else
+		test x"$VERBOSE" = x"no" || \
+		    log_progress_msg "xrdp already running"
+	fi
+	test x"$VERBOSE" = x"no" || log_end_msg $rv
+	;;
+(stop)
+	test x"$VERBOSE" = x"no" || log_daemon_msg "Stopping $DESC"
+	test x"$VERBOSE" = x"no" || log_progress_msg "xrdp"
+	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \
+	    --pidfile /var/run/xrdp/xrdp.pid \
+	    --name xrdp --exec /usr/sbin/xrdp
+	rc=$?
+	if test $rc -gt 1; then
+		rv=$rc
+	else
+		start-stop-daemon --stop --quiet --oknodo \
+		    --retry=0/30/KILL/5 --exec /usr/sbin/xrdp
+		rc=$?
+		test $rc -gt 1 && test $rv -lt $rc && rv=$rc
+	fi
+	test x"$VERBOSE" = x"no" || log_progress_msg "xrdp-sesman"
+	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \
+	    --pidfile /var/run/xrdp/xrdp-sesman.pid \
+	    --name xrdp-sesman --exec /usr/sbin/xrdp-sesman
+	rc=$?
+	if test $rc -gt 1; then
+		rv=$rc
+	else
+		start-stop-daemon --stop --quiet --oknodo \
+		    --retry=0/30/KILL/5 --exec /usr/sbin/xrdp-sesman
+		rc=$?
+		test $rc -gt 1 && test $rv -lt $rc && rv=$rc
+	fi
+	rm -f /var/run/xrdp/xrdp-sesman.pid /var/run/xrdp/xrdp.pid
+	test x"$VERBOSE" = x"no" || log_end_msg $rv
+	;;
+(status)
+	if test x"SESMAN_START" = x"yes"; then
+		status_of_proc -p /var/run/xrdp/xrdp-sesman.pid \
+		    /usr/sbin/xrdp-sesman xrdp-sesman
+		rc=$?
+		test $rc -gt $rv && rv=$rc
+	fi
+	status_of_proc -p /var/run/xrdp/xrdp.pid /usr/sbin/xrdp xrdp
+	rc=$?
+	test $rc -gt $rv && rv=$rc
+	exit $rv
+	;;
+(force-reload|restart)
+	test x"$VERBOSE" = x"no" || log_daemon_msg "Restarting $DESC"
+	if test x"SESMAN_START" = x"yes"; then
+		test x"$VERBOSE" = x"no" || log_progress_msg "xrdp-sesman"
+		start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \
+		    --pidfile /var/run/xrdp/xrdp-sesman.pid \
+		    --name xrdp-sesman --exec /usr/sbin/xrdp-sesman
+		if test $? -lt 2; then
+			start-stop-daemon --stop --quiet --oknodo \
+			    --retry=0/30/KILL/5 --exec /usr/sbin/xrdp-sesman
+		fi
+		rm -f /var/run/xrdp/xrdp-sesman.pid
+		start-stop-daemon --start --quiet \
+		    --pidfile /var/run/xrdp/xrdp-sesman.pid \
+		    --startas /usr/sbin/xrdp-sesman --name xrdp-sesman \
+		    --exec /usr/sbin/xrdp-sesman -- $SESMAN_OPTIONS
+		rc=$?
+		test $rc -gt 0 && rv=$rc
+	fi
+	test x"$VERBOSE" = x"no" || log_progress_msg "xrdp"
+	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \
+	    --pidfile /var/run/xrdp/xrdp.pid \
+	    --name xrdp --exec /usr/sbin/xrdp
+	if test $? -lt 2; then
+		start-stop-daemon --stop --quiet --oknodo \
+		    --retry=0/30/KILL/5 --exec /usr/sbin/xrdp
+	fi
+	rm -f /var/run/xrdp/xrdp.pid
+	start-stop-daemon --start --quiet \
+	    --pidfile /var/run/xrdp/xrdp.pid \
+	    --chuid xrdp:xrdp \
+	    --startas /usr/sbin/xrdp --name xrdp \
+	    --exec /usr/sbin/xrdp -- $XRDP_OPTIONS
+	rc=$?
+	test $rc -gt 0 && rv=$rc
+	;;
+(try-restart)
+	log_daemon_msg "Trying to restart $DESC"
+	if ! status_of_proc -p /var/run/xrdp/xrdp.pid \
+	    /usr/sbin/xrdp xrdp >/dev/null 2>&1; then
+		log_progress_msg "is not running."
+		log_end_msg 1
+		exit 0
+	fi
+	if status_of_proc -p /var/run/xrdp/xrdp-sesman.pid \
+	    /usr/sbin/xrdp-sesman xrdp-sesman >/dev/null 2>&1; then
+		test x"$VERBOSE" = x"no" || log_progress_msg "xrdp-sesman"
+		start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \
+		    --pidfile /var/run/xrdp/xrdp-sesman.pid \
+		    --name xrdp-sesman --exec /usr/sbin/xrdp-sesman
+		if test $? -lt 2; then
+			start-stop-daemon --stop --quiet --oknodo \
+			    --retry=0/30/KILL/5 --exec /usr/sbin/xrdp-sesman
+		fi
+		rm -f /var/run/xrdp/xrdp-sesman.pid
+		start-stop-daemon --start --quiet \
+		    --pidfile /var/run/xrdp/xrdp-sesman.pid \
+		    --startas /usr/sbin/xrdp-sesman --name xrdp-sesman \
+		    --exec /usr/sbin/xrdp-sesman -- $SESMAN_OPTIONS
+		rc=$?
+		test $rc -gt 0 && rv=$rc
+	fi
+	test x"$VERBOSE" = x"no" || log_progress_msg "xrdp"
+	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \
+	    --pidfile /var/run/xrdp/xrdp.pid \
+	    --name xrdp --exec /usr/sbin/xrdp
+	if test $? -lt 2; then
+		start-stop-daemon --stop --quiet --oknodo \
+		    --retry=0/30/KILL/5 --exec /usr/sbin/xrdp
+	fi
+	rm -f /var/run/xrdp/xrdp.pid
+	start-stop-daemon --start --quiet \
+	    --pidfile /var/run/xrdp/xrdp.pid \
+	    --chuid xrdp:xrdp \
+	    --startas /usr/sbin/xrdp --name xrdp \
+	    --exec /usr/sbin/xrdp -- $XRDP_OPTIONS
+	rc=$?
+	test $rc -gt 0 && rv=$rc
+	;;
+(*)
+	echo >&2 "Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
+	exit 3
+	;;
+esac
+exit 0

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/pkg-team/xrdp.git



More information about the debian-edu-commits mailing list