Package: hostname
Version: 3.13
Severity: normal
Tags: patch
User: upst...@packages.deban.org
Usertags: upstart-job

Dear Maintainer,

please consider applying the following patch that adds upstart
integration to set hostname at boot time.

I know that under sysv init, initscripts package ships
/etc/init.d/hostname.sh. But it seems out of place for upstart package
to ship hostname job file, when hostname package ships the binary. To me
hostname package is a better place to ship upstart job file to set
hostname, thus giving you control as to which args should be used by
default.

I have tested proposed changes on debian sid, with both sysvinit and
upstart.

There are two jobs provided: hostname & hostname.sh. The first one is
the one that sets the hostname, the second one is there for sysv
compatibility.

Regards,

Dmitrijs.

diff -Nru hostname-3.13/debian/changelog hostname-3.13+nmu1/debian/changelog
--- hostname-3.13/debian/changelog	2013-06-18 10:52:28.000000000 +0100
+++ hostname-3.13+nmu1/debian/changelog	2013-06-24 13:10:16.000000000 +0100
@@ -1,3 +1,12 @@
+hostname (3.13+nmu1) UNRELEASED; urgency=low
+
+  * Non-maintainer upload.
+  * Provide upstart job to set hostname, and a dummy job hostname.sh, to
+    stay backwards compatible with sysv init scripts relying on the
+    previous name.
+
+ -- Dmitrijs Ledkovs <dmitrij.led...@ubuntu.com>  Fri, 21 Jun 2013 16:23:15 +0100
+
 hostname (3.13) unstable; urgency=low
 
   * Finally completely remove verbose option.
diff -Nru hostname-3.13/debian/hostname.hostname.sh.upstart hostname-3.13+nmu1/debian/hostname.hostname.sh.upstart
--- hostname-3.13/debian/hostname.hostname.sh.upstart	1970-01-01 01:00:00.000000000 +0100
+++ hostname-3.13+nmu1/debian/hostname.hostname.sh.upstart	2013-06-21 16:13:37.000000000 +0100
@@ -0,0 +1,9 @@
+# hostname.sh - compatibility job for sysvinit dependencies
+#
+# This job runs once hostname job finished running, to signal startpar
+# that other rcS jobs relying on the historic hostname.sh interface
+# can continue.
+
+description     "Signal sysvinit that hostname is set"
+
+start on stopped hostname
diff -Nru hostname-3.13/debian/hostname.hostname.upstart hostname-3.13+nmu1/debian/hostname.hostname.upstart
--- hostname-3.13/debian/hostname.hostname.upstart	1970-01-01 01:00:00.000000000 +0100
+++ hostname-3.13+nmu1/debian/hostname.hostname.upstart	2013-06-21 16:08:37.000000000 +0100
@@ -0,0 +1,12 @@
+#
+# This task is run on startup to set the system hostname from /etc/hostname,
+# falling back to "localhost" if that file is not readable or is empty and
+# no hostname has yet been set.
+
+description     "set system hostname"
+
+start on startup
+
+task
+exec hostname -b -F /etc/hostname
+
diff -Nru hostname-3.13/debian/rules hostname-3.13+nmu1/debian/rules
--- hostname-3.13/debian/rules	2012-01-15 12:50:32.000000000 +0000
+++ hostname-3.13+nmu1/debian/rules	2013-06-24 15:03:50.000000000 +0100
@@ -59,6 +59,8 @@
 	dh_installchangelogs
 	dh_installdocs
 	dh_install
+	dh_installinit --no-start --name hostname
+	dh_installinit --no-start --name hostname.sh -- start 02 S .
 	dh_strip
 	dh_compress
 	dh_fixperms

Reply via email to