Hi, I included some patches to have nodm gracefully uses the upstart job. But I'm stuck as you are (in the git repo) because dh will refuse to add an init.d script if an upstart job is available.
Since those patches permits to have both init scripts in the system, no matter if upstart or sysvinit is used, a little more effort is required to proper build this package. I migrated to latest dh debian/rules, because it could be easier to write such an exception. Any hints on how to neatly have both init script files on the binary package? -- ESC:wq -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
From 4695b6f06bcef540332c09acbeae2d0fc6ba5fe9 Mon Sep 17 00:00:00 2001 From: Marco Amadori <[email protected]> Date: Fri, 11 Feb 2011 11:58:34 +0100 Subject: [PATCH 1/6] Update Standards-Version to 3.9.1 (no changes required). --- debian/changelog | 6 +++++- debian/control | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 3007028..faa6817 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,13 @@ nodm (0.7-2) UNRELEASED; urgency=low + [ Joachim Breitner ] * Included upstart job (Closes: #602511). Thanks to Luigi Capriotti for providing it. - -- Joachim Breitner <[email protected]> Tue, 08 Feb 2011 23:17:30 +0530 + [ Marco Amadori ] + * Update Standards-Version to 3.9.1 (no changes required). + + -- Marco Amadori <[email protected]> Fri, 11 Feb 2011 15:36:30 +0100 nodm (0.7-1.1) unstable; urgency=low diff --git a/debian/control b/debian/control index bb54910..08302ef 100644 --- a/debian/control +++ b/debian/control @@ -4,7 +4,7 @@ Priority: extra Maintainer: Debian FreeSmartphone.Org Team <[email protected]> Uploaders: Joachim Breitner <[email protected]>, Enrico Zini <[email protected]> Build-Depends: debhelper (>= 7), po-debconf, libpam0g-dev, help2man -Standards-Version: 3.8.2 +Standards-Version: 3.9.1 Vcs-Git: http://git.debian.org/git/pkg-fso/nodm.git Vcs-Browser: http://git.debian.org/?p=pkg-fso/nodm.git;a=summary -- 1.7.2.3
From da99f16641f973117da094c9ae4c0fac37d29aba Mon Sep 17 00:00:00 2001 From: Marco Amadori <[email protected]> Date: Fri, 11 Feb 2011 12:36:39 +0100 Subject: [PATCH 2/6] Upgraded debian/rules to debhelper >= 7.0.50. --- debian/control | 2 +- debian/rules | 25 ++++--------------------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/debian/control b/debian/control index 08302ef..50108e1 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: misc Priority: extra Maintainer: Debian FreeSmartphone.Org Team <[email protected]> Uploaders: Joachim Breitner <[email protected]>, Enrico Zini <[email protected]> -Build-Depends: debhelper (>= 7), po-debconf, libpam0g-dev, help2man +Build-Depends: debhelper (>= 7.0.50~), po-debconf, libpam0g-dev, help2man Standards-Version: 3.9.1 Vcs-Git: http://git.debian.org/git/pkg-fso/nodm.git Vcs-Browser: http://git.debian.org/?p=pkg-fso/nodm.git;a=summary diff --git a/debian/rules b/debian/rules index 8625fae..84b0911 100755 --- a/debian/rules +++ b/debian/rules @@ -1,24 +1,7 @@ #!/usr/bin/make -f -build: build-stamp -build-stamp: - dh build - touch build-stamp +%: + dh $@ -clean: - dh clean - -install: build install-stamp -install-stamp: - dh install --before dh_installinit - dh_installinit -r -u "defaults 30 01" - dh install --after dh_installinit - touch install-stamp - -binary-arch: install - dh binary-arch - -binary-indep: install - dh binary-indep - -binary: binary-arch binary-indep +override-dh_installinit: + dh_installinit -r -u "defaults 30 01" -- 1.7.2.3
From cc06610d4dbaebeb26d39852bd6f5de147ac47df Mon Sep 17 00:00:00 2001 From: Marco Amadori <[email protected]> Date: Fri, 11 Feb 2011 14:58:18 +0100 Subject: [PATCH 3/6] Build ./configure if missing. --- debian/rules | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/debian/rules b/debian/rules index 84b0911..13a179c 100755 --- a/debian/rules +++ b/debian/rules @@ -3,5 +3,12 @@ %: dh $@ +configure: + ./autogen.sh + +override-dh_auto_configure: configure + dh_auto_configure + + override-dh_installinit: - dh_installinit -r -u "defaults 30 01" + dh_installinit -r -u "defaults 30 01" -- 1.7.2.3
From c66d35368a8939809532bece76992ae6189e8303 Mon Sep 17 00:00:00 2001 From: Marco Amadori <[email protected]> Date: Fri, 11 Feb 2011 11:21:09 +0100 Subject: [PATCH 4/6] Removed mixed tab and spaces in debian scripts. --- debian/nodm.config | 6 ++-- debian/nodm.init | 48 +++++++++++++------------- debian/nodm.postinst | 88 +++++++++++++++++++++++++------------------------- 3 files changed, 71 insertions(+), 71 deletions(-) diff --git a/debian/nodm.config b/debian/nodm.config index 0c20a8e..6c40b5f 100644 --- a/debian/nodm.config +++ b/debian/nodm.config @@ -68,10 +68,10 @@ if [ "x$START" = "xtrue" ] ; then db_go db_input low nodm/first_vt || true - db_go + db_go - db_input low nodm/x_options || true - db_go + db_input low nodm/x_options || true + db_go db_input low nodm/min_session_time || true db_go diff --git a/debian/nodm.init b/debian/nodm.init index 53b2d00..1b8bb6e 100644 --- a/debian/nodm.init +++ b/debian/nodm.init @@ -48,30 +48,30 @@ export NODM_XINIT NODM_XSESSION NODM_X_OPTIONS NODM_USER NODM_MIN_SESSION_TIME N case "$1" in - start) - [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" - if [ "$NODM_ENABLED" = "no" ] || [ "$NODM_ENABLED" = "false" ] - then - log_warning_msg "Not starting $NAME because NODM_ENABLED is '$NODM_ENABLED' in /etc/default/$NAME" - else - start-stop-daemon --start --oknodo --pidfile ${PIDFILE} --make-pidfile --background --exec /usr/sbin/nodm - fi - [ "$VERBOSE" != no ] && log_end_msg $? - ;; - stop) - [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" - start-stop-daemon --stop --pidfile ${PIDFILE} --oknodo - rm -f ${PIDFILE} - [ "$VERBOSE" != no ] && log_end_msg $? - ;; - restart|force-reload) - $0 stop - $0 start - ;; - *) - log_success_msg "Usage: $0 {start|stop|restart|force-reload}" >&2 - exit 1 - ;; + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" + if [ "$NODM_ENABLED" = "no" ] || [ "$NODM_ENABLED" = "false" ] + then + log_warning_msg "Not starting $NAME because NODM_ENABLED is '$NODM_ENABLED' in /etc/default/$NAME" + else + start-stop-daemon --start --oknodo --pidfile ${PIDFILE} --make-pidfile --background --exec /usr/sbin/nodm + fi + [ "$VERBOSE" != no ] && log_end_msg $? + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + start-stop-daemon --stop --pidfile ${PIDFILE} --oknodo + rm -f ${PIDFILE} + [ "$VERBOSE" != no ] && log_end_msg $? + ;; + restart|force-reload) + $0 stop + $0 start + ;; + *) + log_success_msg "Usage: $0 {start|stop|restart|force-reload}" >&2 + exit 1 + ;; esac diff --git a/debian/nodm.postinst b/debian/nodm.postinst index 5452ebe..9ec548e 100644 --- a/debian/nodm.postinst +++ b/debian/nodm.postinst @@ -6,53 +6,53 @@ set -e . /usr/share/debconf/confmodule if [ "$1" = "configure" ] ; then - if [ -n "$2" ] && dpkg --compare-versions "$2" lt "0.2"; then - # Before version 0.2, nodm was only used on the OpenMoko. To - # guarantee a smooth upgrade, we can safely override debconf here - # using the openmoko parameters. - db_set nodm/enabled true - db_set nodm/first_vt "3" - db_set nodm/x_options "-nolisten tcp" - fi - if [ -n "$2" ] && dpkg --compare-versions "$2" lt "0.5"; then - # Add the NODM_FIRST_VT entry to the config file if it is missing - if [ -s /etc/default/nodm ] && ! grep -q NODM_FIRST_VT /etc/default/nodm - then - cat <<EOF >> /etc/default/nodm + if [ -n "$2" ] && dpkg --compare-versions "$2" lt "0.2"; then + # Before version 0.2, nodm was only used on the OpenMoko. To + # guarantee a smooth upgrade, we can safely override debconf here + # using the openmoko parameters. + db_set nodm/enabled true + db_set nodm/first_vt "3" + db_set nodm/x_options "-nolisten tcp" + fi + if [ -n "$2" ] && dpkg --compare-versions "$2" lt "0.5"; then + # Add the NODM_FIRST_VT entry to the config file if it is missing + if [ -s /etc/default/nodm ] && ! grep -q NODM_FIRST_VT /etc/default/nodm + then + cat <<EOF >> /etc/default/nodm # First vt to try when looking for free VTs NODM_FIRST_VT=7 EOF + fi fi - fi - - # Update /etc/default/nodm - db_get nodm/enabled - NODM_ENABLED="$RET" - db_get nodm/user - NODM_USER="$RET" - db_get nodm/first_vt - NODM_FIRST_VT="$RET" - db_get nodm/x_options - NODM_X_OPTIONS="$RET" - db_get nodm/min_session_time - NODM_MIN_SESSION_TIME="$RET" - db_get nodm/xinit - NODM_XINIT="$RET" - db_get nodm/xsession - NODM_XSESSION="$RET" - - if [ -s /etc/default/nodm ] ; then - sed -i -r -e "s,^NODM_ENABLED=.*,NODM_ENABLED=$NODM_ENABLED," \ - -e "s,^NODM_USER=.*,NODM_USER=$NODM_USER," \ - -e "s,^NODM_FIRST_VT=.*,NODM_FIRST_VT='$NODM_FIRST_VT'," \ - -e "s,^NODM_X_OPTIONS=.*,NODM_X_OPTIONS='$NODM_X_OPTIONS'," \ - -e "s,^NODM_MIN_SESSION_TIME=.*,NODM_MIN_SESSION_TIME=$NODM_MIN_SESSION_TIME," \ - -e "s,^NODM_XINIT=.*,NODM_XINIT=$NODM_XINIT," \ - -e "s,^NODM_XSESSION=.*,NODM_XSESSION=$NODM_XSESSION," \ - /etc/default/nodm - else - cat <<EOF > /etc/default/nodm + + # Update /etc/default/nodm + db_get nodm/enabled + NODM_ENABLED="$RET" + db_get nodm/user + NODM_USER="$RET" + db_get nodm/first_vt + NODM_FIRST_VT="$RET" + db_get nodm/x_options + NODM_X_OPTIONS="$RET" + db_get nodm/min_session_time + NODM_MIN_SESSION_TIME="$RET" + db_get nodm/xinit + NODM_XINIT="$RET" + db_get nodm/xsession + NODM_XSESSION="$RET" + + if [ -s /etc/default/nodm ] ; then + sed -i -r -e "s,^NODM_ENABLED=.*,NODM_ENABLED=$NODM_ENABLED," \ + -e "s,^NODM_USER=.*,NODM_USER=$NODM_USER," \ + -e "s,^NODM_FIRST_VT=.*,NODM_FIRST_VT='$NODM_FIRST_VT'," \ + -e "s,^NODM_X_OPTIONS=.*,NODM_X_OPTIONS='$NODM_X_OPTIONS'," \ + -e "s,^NODM_MIN_SESSION_TIME=.*,NODM_MIN_SESSION_TIME=$NODM_MIN_SESSION_TIME," \ + -e "s,^NODM_XINIT=.*,NODM_XINIT=$NODM_XINIT," \ + -e "s,^NODM_XSESSION=.*,NODM_XSESSION=$NODM_XSESSION," \ + /etc/default/nodm + else + cat <<EOF > /etc/default/nodm # nodm configuration # Set NODM_ENABLED to something different than 'false' to enable nodm @@ -77,9 +77,9 @@ NODM_X_OPTIONS='$NODM_X_OPTIONS' # increasing bit of time before restarting the session. NODM_MIN_SESSION_TIME=$NODM_MIN_SESSION_TIME EOF - fi + fi fi - + #DEBHELPER# # tell debconf we are done. otherwise, it hangs waiting for the daemon. -- 1.7.2.3
From f5f51aadd12c3053ad1bc7fee2253a3a5062aa5f Mon Sep 17 00:00:00 2001 From: Marco Amadori <[email protected]> Date: Fri, 11 Feb 2011 15:45:27 +0100 Subject: [PATCH 5/6] Exit from the sysvinit script to use the upstart job. --- debian/changelog | 3 ++- debian/nodm.init | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletions(-) diff --git a/debian/changelog b/debian/changelog index faa6817..c9711ab 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,8 +6,9 @@ nodm (0.7-2) UNRELEASED; urgency=low [ Marco Amadori ] * Update Standards-Version to 3.9.1 (no changes required). + * Exit from the sysvinit script to use the upstart job. - -- Marco Amadori <[email protected]> Fri, 11 Feb 2011 15:36:30 +0100 + -- Marco Amadori <[email protected]> Fri, 11 Feb 2011 15:45:07 +0100 nodm (0.7-1.1) unstable; urgency=low diff --git a/debian/nodm.init b/debian/nodm.init index 1b8bb6e..15ca887 100644 --- a/debian/nodm.init +++ b/debian/nodm.init @@ -18,6 +18,12 @@ NAME=nodm PIDDIR=/var/run/ PIDFILE=${PIDDIR}/${NAME}.pid +if [ -e "/etc/init/${NAME}.conf" ] && /sbin/telinit --version >/dev/null 2>&1 | grep -qs upstart +then + # An upstart job exists and upstart is in use, exit gracefully + exit 0 +fi + NODM_ENABLED=no NODM_XINIT=/usr/bin/xinit NODM_FIRST_VT=7 -- 1.7.2.3
From 47d9cedfc217790d3b88d71d982ac4219e6beb9e Mon Sep 17 00:00:00 2001 From: Marco Amadori <[email protected]> Date: Fri, 11 Feb 2011 11:18:54 +0100 Subject: [PATCH 6/6] Check if plymouth is available before using it. --- debian/changelog | 3 ++- debian/nodm.upstart | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index c9711ab..5d7dd50 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,8 +7,9 @@ nodm (0.7-2) UNRELEASED; urgency=low [ Marco Amadori ] * Update Standards-Version to 3.9.1 (no changes required). * Exit from the sysvinit script to use the upstart job. + * Check if plymouth is available before using it. - -- Marco Amadori <[email protected]> Fri, 11 Feb 2011 15:45:07 +0100 + -- Marco Amadori <[email protected]> Fri, 11 Feb 2011 15:49:46 +0100 nodm (0.7-1.1) unstable; urgency=low diff --git a/debian/nodm.upstart b/debian/nodm.upstart index ec6fc68..bd7d1d0 100644 --- a/debian/nodm.upstart +++ b/debian/nodm.upstart @@ -52,8 +52,11 @@ script initctl emit starting-dm - plymouth deactivate || true - plymouth quit --wait --retain-splash || true + if [ -x /bin/plymouth ] + then + plymouth deactivate || true + plymouth quit --wait --retain-splash || true + fi exec /usr/sbin/nodm end script -- 1.7.2.3
_______________________________________________ pkg-fso-maint mailing list [email protected] http://lists.alioth.debian.org/mailman/listinfo/pkg-fso-maint
