Hi
> Can you post the patches for review here? Git is good for pulling the
> changes in once they are ready, but for review, we prefer patches on the
> list.
Here you go...

>From cc9cca1383e1fa1b9bacb09bc6cf2f77a2a35ccc Mon Sep 17 00:00:00 2001
From: Tim Sander <[email protected]>
Date: Thu, 27 May 2010 21:50:49 +0200
Subject: [PATCH 1/2] add upstart support to ptxdist

---
 generic/etc/init/avahi-daemon.conf      |   17 ++++
 generic/etc/init/dbus.conf              |   23 ++++++
 generic/etc/init/hostname.conf          |   12 +++
 generic/etc/init/loadmodules.conf       |   18 +++++
 generic/etc/init/mount.conf             |   16 ++++
 generic/etc/init/network-interface.conf |   19 +++++
 generic/etc/init/networking.conf        |   14 ++++
 generic/etc/init/rc.conf                |   18 +++++
 generic/etc/init/rcS.conf               |   26 +++++++
 generic/etc/init/ssh.conf               |   51 +++++++++++++
 generic/etc/init/syslogd.conf           |   14 ++++
 generic/etc/init/ttyS.conf              |    9 ++
 generic/etc/init/udev-finish.conf       |   30 ++++++++
 generic/etc/init/udev.conf              |   19 +++++
 generic/etc/init/udevmonitor.conf       |   13 +++
 generic/etc/init/udevtrigger.conf       |   15 ++++
 rules/avahi.in                          |    6 ++
 rules/avahi.make                        |   15 ++++-
 rules/dbus.make                         |    8 ++
 rules/host-libnih.in                    |    4 +
 rules/host-libnih.make                  |   33 ++++++++
 rules/initmethod.in                     |    1 -
 rules/libnih.in                         |    9 ++
 rules/libnih.make                       |  125 
+++++++++++++++++++++++++++++++
 rules/openssh.make                      |    4 +
 rules/upstart.in                        |    2 +
 rules/upstart.make                      |   50 ++++++++++---
 27 files changed, 558 insertions(+), 13 deletions(-)
 create mode 100644 generic/etc/init/avahi-daemon.conf
 create mode 100644 generic/etc/init/dbus.conf
 create mode 100644 generic/etc/init/hostname.conf
 create mode 100644 generic/etc/init/loadmodules.conf
 create mode 100644 generic/etc/init/mount.conf
 create mode 100644 generic/etc/init/network-interface.conf
 create mode 100644 generic/etc/init/networking.conf
 create mode 100644 generic/etc/init/rc.conf
 create mode 100644 generic/etc/init/rcS.conf
 create mode 100644 generic/etc/init/ssh.conf
 create mode 100644 generic/etc/init/syslogd.conf
 create mode 100644 generic/etc/init/ttyS.conf
 create mode 100644 generic/etc/init/udev-finish.conf
 create mode 100644 generic/etc/init/udev.conf
 create mode 100644 generic/etc/init/udevmonitor.conf
 create mode 100644 generic/etc/init/udevtrigger.conf
 create mode 100644 rules/host-libnih.in
 create mode 100644 rules/host-libnih.make
 create mode 100644 rules/libnih.in
 create mode 100644 rules/libnih.make

diff --git a/generic/etc/init/avahi-daemon.conf b/generic/etc/init/avahi-
daemon.conf
new file mode 100644
index 0000000..99be572
--- /dev/null
+++ b/generic/etc/init/avahi-daemon.conf
@@ -0,0 +1,17 @@
+# avahi-daemon - mDNS/DNS-SD daemon
+#
+# The Avahi daemon provides mDNS/DNS-SD discovery support (Bonjour/Zeroconf)
+# allowing applications to discover services on the network.
+
+description    "mDNS/DNS-SD daemon"
+
+start on (filesystem and started dbus)
+stop on stopping dbus
+
+expect daemon
+respawn
+
+script
+       opts="-D"
+       exec avahi-daemon ${opts}
+end script
diff --git a/generic/etc/init/dbus.conf b/generic/etc/init/dbus.conf
new file mode 100644
index 0000000..67376b4
--- /dev/null
+++ b/generic/etc/init/dbus.conf
@@ -0,0 +1,23 @@
+# dbus - D-Bus system message bus
+#
+# The D-Bus system message bus allows system daemons and user applications
+# to communicate.
+
+description    "D-Bus system message bus"
+
+start on filesystem and started networking
+stop on runlevel [06]
+
+expect fork
+respawn
+
+pre-start script
+    mkdir -p /var/run/dbus
+    chown messagebus:messagebus /var/run/dbus
+
+    exec dbus-uuidgen --ensure
+end script
+
+exec dbus-daemon --system --fork
+
+post-start exec kill -USR1 1
diff --git a/generic/etc/init/hostname.conf b/generic/etc/init/hostname.conf
new file mode 100644
index 0000000..8be3cb4
--- /dev/null
+++ b/generic/etc/init/hostname.conf
@@ -0,0 +1,12 @@
+# hostname - set system hostname
+#
+# 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 filesystem
+
+task
+exec hostname -F /etc/hostname
diff --git a/generic/etc/init/loadmodules.conf 
b/generic/etc/init/loadmodules.conf
new file mode 100644
index 0000000..4fc9fd8
--- /dev/null
+++ b/generic/etc/init/loadmodules.conf
@@ -0,0 +1,18 @@
+# module-init-tools - load modules from /etc/modules
+#
+# This task loads the kernel modules specified in the /etc/modules file
+
+description    "load modules from /etc/modules"
+
+start on (startup
+         and started udev)
+
+task
+script
+    grep '^[^#]' /etc/modules |
+       while read module args
+       do
+           [ "$module" ] || continue
+           modprobe $module $args || :
+       done
+end script
diff --git a/generic/etc/init/mount.conf b/generic/etc/init/mount.conf
new file mode 100644
index 0000000..ff70777
--- /dev/null
+++ b/generic/etc/init/mount.conf
@@ -0,0 +1,16 @@
+# mount-proc - mount proc
+#
+
+description "mount proc on startup"
+
+start on startup
+
+emits filesystem
+
+console owner
+script
+       echo "remounting root rw"
+       mount -o remount,rw /
+       initctl emit filesystem
+end script
+
diff --git a/generic/etc/init/network-interface.conf 
b/generic/etc/init/network-interface.conf
new file mode 100644
index 0000000..c0b6f2a
--- /dev/null
+++ b/generic/etc/init/network-interface.conf
@@ -0,0 +1,19 @@
+# network-interface - configure network device
+#
+# This service causes network devices to be brought up or down as a result
+# of hardware being added or removed, including that which isn't ordinarily
+# removable.
+
+description    "configure network device"
+
+start on net-device-added
+stop on net-device-removed INTERFACE=$INTERFACE
+
+instance $INTERFACE
+
+pre-start script
+    mkdir -p /var/run/network
+    exec ifup --allow auto $INTERFACE
+end script
+
+post-stop exec ifdown --allow auto $INTERFACE
diff --git a/generic/etc/init/networking.conf 
b/generic/etc/init/networking.conf
new file mode 100644
index 0000000..de573ea
--- /dev/null
+++ b/generic/etc/init/networking.conf
@@ -0,0 +1,14 @@
+# networking - configure virtual network devices
+#
+# This task causes virtual network devices that do not have an associated
+# kernel object to be started on boot.
+
+description    "configure virtual network devices"
+
+start on (filesystem and stopped udevtrigger)
+
+task
+
+pre-start exec mkdir -p /var/run/network
+
+exec ifup -a
diff --git a/generic/etc/init/rc.conf b/generic/etc/init/rc.conf
new file mode 100644
index 0000000..91a331a
--- /dev/null
+++ b/generic/etc/init/rc.conf
@@ -0,0 +1,18 @@
+# rc - System V runlevel compatibility
+#
+# This task runs the old System V-style rc script when changing between
+# runlevels.
+
+description    "System V runlevel compatibility"
+author         "Scott James Remnant <[email protected]>"
+
+start on runlevel [0123456]
+stop on runlevel [!$RUNLEVEL]
+
+export RUNLEVEL
+export PREVLEVEL
+
+task
+
+console output
+exec /etc/init.d/rc $RUNLEVEL
diff --git a/generic/etc/init/rcS.conf b/generic/etc/init/rcS.conf
new file mode 100644
index 0000000..7da7210
--- /dev/null
+++ b/generic/etc/init/rcS.conf
@@ -0,0 +1,26 @@
+# rcS - System V single-user mode compatibility
+#
+# This task handles the old System V-style single-user mode, this is
+# distinct from the other runlevels since running the rc script would
+# be bad.
+
+description    "System V single-user mode compatibility"
+author         "Scott James Remnant <[email protected]>"
+
+start on runlevel S
+stop on runlevel [!S]
+
+console owner
+exec /sbin/sulogin
+
+post-stop script
+    # Don't switch runlevels if we were stopped by an event, since that
+    # means we're already switching runlevels
+    if [ -n "${UPSTART_STOP_EVENTS}" ]
+    then
+       exit 0
+    fi
+
+    # Switch, passing a magic flag
+    start --no-wait rc-sysinit FROM_SINGLE_USER_MODE=y
+end script
diff --git a/generic/etc/init/ssh.conf b/generic/etc/init/ssh.conf
new file mode 100644
index 0000000..3214b33
--- /dev/null
+++ b/generic/etc/init/ssh.conf
@@ -0,0 +1,51 @@
+# ssh - OpenBSD Secure Shell server
+#
+# The OpenSSH server provides secure shell access to the system.
+
+description    "OpenSSH server"
+
+start on filesystem
+stop on runlevel S
+
+expect fork
+respawn
+respawn limit 10 5
+umask 022
+# replaces SSHD_OOM_ADJUST in /etc/default/ssh
+oom never
+
+pre-start script
+    test -x /usr/sbin/sshd || { stop; exit 0; }
+    test -e /etc/ssh/sshd_not_to_be_run && { stop; exit 0; }
+    test -c /dev/null || { stop; exit 0; }
+         OPENSSH_RSAKEY="/etc/ssh/ssh_host_rsa_key"
+    OPENSSH_DSAKEY="/etc/ssh/ssh_host_dsa_key"
+gen_key() {
+
+       key_type=$1
+       key_file=$2
+
+       rm -f $key_file > /dev/null 2>&1
+
+       echo -n "generating $key_type key..."
+       ssh-keygen -t $key_type -f $key_file -N "" > /dev/null 2>&1
+
+       if [ "$?" = "0" ]; then
+               echo "done"
+       else
+               echo "failed"
+               mount_root_restore
+               exit 1
+       fi
+
+}
+
+               [ \! -f "$OPENSSH_RSAKEY" ] && gen_key rsa "$OPENSSH_RSAKEY"
+               [ \! -f "$OPENSSH_DSAKEY" ] && gen_key dsa "$OPENSSH_DSAKEY"
+
+    mkdir -p -m0755 /var/run/sshd
+end script
+
+# if you used to set SSHD_OPTS in /etc/default/ssh, you can change the
+# 'exec' line here instead
+exec /usr/sbin/sshd
diff --git a/generic/etc/init/syslogd.conf b/generic/etc/init/syslogd.conf
new file mode 100644
index 0000000..a56a144
--- /dev/null
+++ b/generic/etc/init/syslogd.conf
@@ -0,0 +1,14 @@
+# rsyslog - system logging daemon
+#
+# rsyslog is an enhanced multi-threaded replacement for the traditional
+# syslog daemon, logging messages from applications
+
+description    "system logging daemon"
+
+start on filesystem
+stop on runlevel [06]
+
+expect fork
+respawn
+
+exec syslogd
diff --git a/generic/etc/init/ttyS.conf b/generic/etc/init/ttyS.conf
new file mode 100644
index 0000000..46a9d85
--- /dev/null
+++ b/generic/etc/init/ttyS.conf
@@ -0,0 +1,9 @@
+# ttyS - getty
+#
+# This service maintains a getty on tty1 from the point the system is
+# started until it is shut down again.
+
+start on (filesystem and started udev and stopped udev-finish)
+
+respawn
+exec /sbin/getty -L @SPEED@ @CONSOLE@ vt100
diff --git a/generic/etc/init/udev-finish.conf b/generic/etc/init/udev-
finish.conf
new file mode 100644
index 0000000..069b95d
--- /dev/null
+++ b/generic/etc/init/udev-finish.conf
@@ -0,0 +1,30 @@
+# udev-finish - save udev log and update rules
+#
+# While udev runs we not only create the log file of initial device
+# creation but udev rules may be generated, we need to copy both of
+# these out of /dev and onto the root filesystem.
+
+description    "save udev log and update rules"
+
+start on (startup
+         and filesystem
+         and started udev
+         and stopped udevtrigger
+         and stopped udevmonitor)
+
+task
+script
+    # Save udev log in /var/log/udev
+    if [ -e /dev/.udev.log ]
+    then
+       mv -f /dev/.udev.log /var/log/udev || :
+    fi
+
+    # Copy any rules generated while the root filesystem was read-only
+    for file in /dev/.udev/tmp-rules--*
+    do
+       [ -e "$file" ] || continue
+       cat "$file" >> "/etc/udev/rules.d/${file##*tmp-rules--}"
+       rm -f "$file"
+    done
+end script
diff --git a/generic/etc/init/udev.conf b/generic/etc/init/udev.conf
new file mode 100644
index 0000000..8d515a1
--- /dev/null
+++ b/generic/etc/init/udev.conf
@@ -0,0 +1,19 @@
+# udev - device node and kernel event manager
+#
+# The udev daemon receives events from the kernel about changes in the
+# /sys filesystem and manages the /dev filesystem.
+
+description    "device node and kernel event manager"
+
+start on filesystem
+stop on runlevel [06]
+
+expect fork
+respawn
+
+exec udevd --daemon
+
+post-start script 
+mkdir -p /dev/pts;
+mount -tdevpts none /dev/pts;
+end script
diff --git a/generic/etc/init/udevmonitor.conf 
b/generic/etc/init/udevmonitor.conf
new file mode 100644
index 0000000..da93dec
--- /dev/null
+++ b/generic/etc/init/udevmonitor.conf
@@ -0,0 +1,13 @@
+# udevmonitor - log initial device creation
+#
+# The set of devices created in the "cold plug" pass is generally
+# useful for debugging, so we monitor this and create a log file
+# from that.
+
+description    "log initial device creation"
+
+start on (startup
+         and starting udevtrigger)
+stop on stopped udevtrigger
+
+exec /sbin/udevadm monitor -e >/dev/.udev.log
diff --git a/generic/etc/init/udevtrigger.conf 
b/generic/etc/init/udevtrigger.conf
new file mode 100644
index 0000000..43ec47c
--- /dev/null
+++ b/generic/etc/init/udevtrigger.conf
@@ -0,0 +1,15 @@
+# udevtrigger - cold plug devices
+#
+# By the time udevd starts, we've already missed all of the events for
+# the devices populated in /sys.  This task causes the kernel to resend
+# them.
+
+description    "cold plug devices"
+
+start on (startup
+         and started udev)
+
+task
+
+exec udevadm trigger
+post-stop exec udevadm settle
diff --git a/rules/avahi.in b/rules/avahi.in
index 3b0a51e..c8dd8ea 100644
--- a/rules/avahi.in
+++ b/rules/avahi.in
@@ -117,6 +117,12 @@ config AVAHI_SERVICES
        help
          install avahi service descriptions
 
+config AVAHI_SERVICES_PROJECTROOT
+       bool
+       depends on AVAHI_DAEMON
+       prompt "avahi services from projectroot"
+       help
+         install avahi services from 
${ptxdist_workspace}/projectroot/etc/avahi/services
 endif
 
 config AVAHI_DNSCONFD
diff --git a/rules/avahi.make b/rules/avahi.make
index 5d9a88b..a357945 100644
--- a/rules/avahi.make
+++ b/rules/avahi.make
@@ -189,7 +189,16 @@ ifdef PTXCONF_AVAHI_SERVICES
        @$(call install_copy, avahi, 0, 0, 0644, -, 
/etc/avahi/services/ssh.service)
 endif
 
-ifdef PTXCONF_AVAHI_DNSCONFD
+ifdef PTXCONF_AVAHI_SERVICES_PROJECTROOT
+       @cd $(PTXDIST_WORKSPACE)/projectroot/etc/avahi/services/; \
+       for file in *; do \
+               $(call install_copy, avahi, 0, 0, 0644, \
+               $(PTXDIST_WORKSPACE)/projectroot/etc/avahi/services/$$file, \
+               /etc/avahi/services/$$file, n); \
+       done
+endif
+
+ifdef AVAHI_DNSCONFD
 #      avahi dnsconfd (Unicast DNS server from mDNS/DNS-SD configuration 
daemon)
 #      depends on avahi-daemon
        @$(call install_copy, avahi, 0, 0, 0755, -, /usr/sbin/avahi-dnsconfd)
@@ -207,6 +216,10 @@ ifdef PTXCONF_AVAHI_AUTOIP
        @$(call install_link, avahi, ../init.d/zeroconf, 
/etc/rc.d/S30zeroconf)
 endif
 
+ifdef PTXCONF_INITMETHOD_UPSTART
+       @$(call install_alternative, avahi, 0, 0, 0644, /etc/init/avahi-
daemon.conf)
+endif
+
        @$(call install_finish, avahi)
 
        @$(call touch)
diff --git a/rules/dbus.make b/rules/dbus.make
index b7af1e7..214aaed 100644
--- a/rules/dbus.make
+++ b/rules/dbus.make
@@ -2,6 +2,7 @@
 #
 # Copyright (C) 2006 by Roland Hostettler
 #               2008, 2009 by Marc Kleine-Budde <[email protected]>
+#                                                              2010 Tim 
Sander <[email protected]>
 #
 # See CREDITS for details about who has contributed to this project.
 #
@@ -111,6 +112,7 @@ $(STATEDIR)/dbus.targetinstall:
                /usr/lib/libdbus-1.so.3.4.0)
        @$(call install_link, dbus, libdbus-1.so.3.4.0, 
/usr/lib/libdbus-1.so.3)
        @$(call install_link, dbus, libdbus-1.so.3.4.0, /usr/lib/libdbus-1.so)
+       @$(call install_dir, dbus, 0, 0, 0755, -, /var/lib/dbus)
 
 #      #
 #      # create system.d and event.d directories, which are used by the 
configuration and startup files
@@ -148,6 +150,12 @@ ifdef PTXCONF_DBUS_STARTSCRIPT
 endif
 endif
 
+ifdef PTXCONF_INITMETHOD_UPSTART
+ifdef PTXCONF_DBUS_STARTSCRIPT
+       @$(call install_alternative, dbus, 0, 0, 0644, /etc/init/dbus.conf)
+endif
+endif
+
        @$(call install_finish,dbus)
 
        @$(call touch)
diff --git a/rules/host-libnih.in b/rules/host-libnih.in
new file mode 100644
index 0000000..53513d5
--- /dev/null
+++ b/rules/host-libnih.in
@@ -0,0 +1,4 @@
+## SECTION=hosttools_noprompt
+config HOST_LIBNIH
+       tristate
+       select HOST_DBUS
diff --git a/rules/host-libnih.make b/rules/host-libnih.make
new file mode 100644
index 0000000..385f8c5
--- /dev/null
+++ b/rules/host-libnih.make
@@ -0,0 +1,33 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2010 by Tim Sander <[email protected]>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+HOST_PACKAGES-$(PTXCONF_HOST_LIBNIH) += host-libnih
+
+#
+# Paths and names
+#
+HOST_LIBNIH_DIR        = $(HOST_BUILDDIR)/$(LIBNIH)
+
+# 
----------------------------------------------------------------------------
+# Prepare
+# 
----------------------------------------------------------------------------
+
+HOST_LIBNIH_PATH       := PATH=$(HOST_PATH)
+HOST_LIBNIH_ENV        := $(HOST_ENV)
+
+#
+# autoconf
+#
+HOST_LIBNIH_AUTOCONF   := $(HOST_AUTOCONF)
+
+# vim: syntax=make
diff --git a/rules/initmethod.in b/rules/initmethod.in
index 6864e6b..f735981 100644
--- a/rules/initmethod.in
+++ b/rules/initmethod.in
@@ -19,7 +19,6 @@ choice
 
        config INITMETHOD_UPSTART
                bool
-               depends on BROKEN
                prompt "upstart         "
 
        config INITMETHOD_INITNG
diff --git a/rules/libnih.in b/rules/libnih.in
new file mode 100644
index 0000000..0a883e2
--- /dev/null
+++ b/rules/libnih.in
@@ -0,0 +1,9 @@
+## SECTION=system_libraries
+
+config LIBNIH
+       bool
+       prompt "libnih"
+       select DBUS
+       select HOST_LIBNIH
+       help
+         libnih is a small library for C application development containing 
functions that, despite its name, are not implemented elsewhere in the 
standard library set.
diff --git a/rules/libnih.make b/rules/libnih.make
new file mode 100644
index 0000000..4ec69ce
--- /dev/null
+++ b/rules/libnih.make
@@ -0,0 +1,125 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2010 by Tim Sander
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_LIBNIH) += libnih
+
+#
+# Paths and names
+#
+LIBNIH_VERSION := 1.0.2
+LIBNIH         := libnih-$(LIBNIH_VERSION)
+LIBNIH_SUFFIX := tar.gz
+#LIBNIH_SRCDIR         := $(PTXDIST_WORKSPACE)/local_src/$(LIBNIH)
+LIBNIH_URL := 
http://launchpad.net/libnih/1.0/$(LIBNIH_VERSION)/+download/$(LIBNIH).
$(LIBNIH_SUFFIX)
+LIBNIH_DIR             := $(BUILDDIR)/$(LIBNIH)
+LIBNIH_SOURCE  := $(SRCDIR)/$(LIBNIH).$(LIBNIH_SUFFIX)
+
+# 
----------------------------------------------------------------------------
+# Get
+# 
----------------------------------------------------------------------------
+$(LIBNIH_SOURCE):
+       @$(call targetinfo)
+       @$(call get, LIBNIH)
+
+# 
----------------------------------------------------------------------------
+# Prepare
+# 
----------------------------------------------------------------------------
+
+LIBNIH_PATH    := PATH=$(CROSS_PATH)
+LIBNIH_ENV     := $(CROSS_ENV) NIH_DBUS_TOOL=${PTXDIST_PLATFORMDIR}/sysroot-
host/bin/nih-dbus-tool
+
+#
+# autoconf
+#
+LIBNIH_AUTOCONF := \
+       $(CROSS_AUTOCONF_USR)
+
+#$(STATEDIR)/libnih.prepare:
+#      @$(call targetinfo)
+#      @$(call clean, $(LIBNIH_DIR)/config.cache)
+#      cd $(LIBNIH_DIR) && \
+#              $(LIBNIH_PATH) $(LIBNIH_ENV) \
+#              $(LIBNIH_SRCDIR)/configure $(LIBNIH_AUTOCONF)
+#      @$(call touch)
+
+# 
----------------------------------------------------------------------------
+# Compile
+# 
----------------------------------------------------------------------------
+
+#$(STATEDIR)/libnih.compile:
+#      @$(call targetinfo)
+#      cd $(LIBNIH_DIR) && $(LIBNIH_ENV) $(LIBNIH_PATH) $(MAKE) 
$(PARALLELMFLAGS)
+#      @$(call touch)
+
+# 
----------------------------------------------------------------------------
+# Install
+# 
----------------------------------------------------------------------------
+
+#$(STATEDIR)/libnih.install:
+#      @$(call targetinfo)
+#      @$(call install, LIBNIH)
+#      @$(call touch)
+
+# 
----------------------------------------------------------------------------
+# Target-Install
+# 
----------------------------------------------------------------------------
+
+$(STATEDIR)/libnih.targetinstall:
+       @$(call targetinfo)
+
+       @$(call install_init,  libnih)
+       @$(call install_fixup, libnih, PACKAGE, libnih)
+       @$(call install_fixup, libnih, PRIORITY, optional)
+       @$(call install_fixup, libnih, VERSION, 1.0.1)
+       @$(call install_fixup, libnih, SECTION, base)
+       @$(call install_fixup, libnih, AUTHOR, "Tim Sander")
+       @$(call install_fixup, libnih, DEPENDS,)
+       @$(call install_fixup, libnih, DESCRIPTION, missing)
+
+#      #
+#      # example code:; copy all libraries, links and binaries
+#      #
+
+       @for i in $(shell cd $(PKGDIR)/$(LIBNIH) && find bin sbin usr/bin 
usr/sbin -type f); do \
+               $(call install_copy, libnih, 0, 0, 0755, -, /$$i); \
+       done
+       @for i in $(shell cd $(PKGDIR)/$(LIBNIH) && find lib usr/lib -name 
"*.so*"); do \
+               $(call install_copy, libnih, 0, 0, 0644, -, /$$i); \
+       done
+       @links="$(shell cd $(PKGDIR)/$(LIBNIH) && find lib usr/lib -type l)"; \
+       if [ -n "$$links" ]; then \
+               for i in $$links; do \
+                       from="`readlink $(PKGDIR)/$(LIBNIH)/$$i`"; \
+                       to="/$$i"; \
+                       $(call install_link, libnih, $$from, $$to); \
+               done; \
+       fi
+
+#      #
+#      # FIXME: add all necessary things here
+#      #
+
+       @$(call install_finish, libnih)
+
+       @$(call touch)
+
+# 
----------------------------------------------------------------------------
+# Clean
+# 
----------------------------------------------------------------------------
+
+libnih_clean:
+       rm -rf $(STATEDIR)/libnih.*
+       rm -rf $(PKGDIR)/libnih_*
+       rm -rf $(LIBNIH_DIR)
+
+# vim: syntax=make
diff --git a/rules/openssh.make b/rules/openssh.make
index 67ea8ab..13eab8b 100644
--- a/rules/openssh.make
+++ b/rules/openssh.make
@@ -99,6 +99,10 @@ ifdef PTXCONF_OPENSSH_SSHD_STARTSCRIPT
 endif
 endif
 
+ifdef PTXCONF_INITMETHOD_UPSTART
+       @$(call install_alternative, openssh, 0, 0, 0644, /etc/init/ssh.conf)
+endif
+
 ifdef PTXCONF_OPENSSH_SCP
        @$(call install_copy, openssh, 0, 0, 0755, -, \
                /usr/bin/scp)
diff --git a/rules/upstart.in b/rules/upstart.in
index 7f10a41..1bc3daa 100644
--- a/rules/upstart.in
+++ b/rules/upstart.in
@@ -2,7 +2,9 @@
 
 config UPSTART
        tristate
+       select UDEV
        select DBUS
+       select LIBNIH
        prompt "upstart"
        help
          upstart is a replacement for the /sbin/init daemon which
diff --git a/rules/upstart.make b/rules/upstart.make
index 38d2bad..26b10ea 100644
--- a/rules/upstart.make
+++ b/rules/upstart.make
@@ -1,6 +1,7 @@
 # -*-makefile-*-
 #
 # Copyright (C) 2009 by Robert Schwebel <[email protected]>
+# Copyright (C) 2010 by Tim Sander <[email protected]>
 #
 # See CREDITS for details about who has contributed to this project.
 #
@@ -16,10 +17,10 @@ PACKAGES-$(PTXCONF_UPSTART) += upstart
 #
 # Paths and names
 #
-UPSTART_VERSION        := 0.5.1
+UPSTART_VERSION        := 0.6.6
 UPSTART                := upstart-$(UPSTART_VERSION)
-UPSTART_SUFFIX := tar.bz2
-UPSTART_URL    := http://upstart.ubuntu.com/download/0.5/$(UPSTART).
$(UPSTART_SUFFIX)
+UPSTART_SUFFIX := tar.gz
+UPSTART_URL    := http://upstart.ubuntu.com/download/0.6/$(UPSTART).
$(UPSTART_SUFFIX)
 UPSTART_SOURCE := $(SRCDIR)/$(UPSTART).$(UPSTART_SUFFIX)
 UPSTART_DIR    := $(BUILDDIR)/$(UPSTART)
 
@@ -41,8 +42,10 @@ UPSTART_ENV  := $(CROSS_ENV)
 #
 # autoconf
 #
+
 UPSTART_AUTOCONF := \
        $(CROSS_AUTOCONF_USR) \
+  --disable-compiler-coverage \
        --disable-nls \
        --enable-threads=posix \
        --disable-rpath \
@@ -51,7 +54,6 @@ UPSTART_AUTOCONF := \
        --enable-threading \
        --enable-compiler-warnings \
        --enable-compiler-optimisations \
-       --disable-compiler-coverage \
        --enable-linker-optimisations \
        --with-gnu-ld \
        --without-libpth-prefix \
@@ -76,22 +78,48 @@ $(STATEDIR)/upstart.targetinstall:
        @$(call install_fixup, upstart,DESCRIPTION,missing)
 
        @$(call install_copy, upstart, 0, 0, 0755, -, /usr/sbin/init)
-       @$(call install_copy, upstart, 0, 0, 0755, -, /usr/sbin/halt)
-       @$(call install_copy, upstart, 0, 0, 0755, -, /usr/sbin/shutdown)
-       @$(call install_copy, upstart, 0, 0, 0755, -, /usr/sbin/stop)
+       @$(call install_copy, upstart, 0, 0, 0755, -, /usr/sbin/initctl)
+       @$(call install_link, upstart, initctl, /usr/sbin/reload)
+       @$(call install_link, upstart, initctl, /usr/sbin/restart)
+       @$(call install_link, upstart, initctl, /usr/sbin/start)
+       @$(call install_link, upstart, initctl, /usr/sbin/stop)
+       @$(call install_link, upstart, initctl, /usr/sbin/status)
        @$(call install_copy, upstart, 0, 0, 0755, -, /usr/sbin/reboot)
-       @$(call install_copy, upstart, 0, 0, 0755, -, /usr/sbin/poweroff)
+       @$(call install_copy, upstart, 0, 0, 0755, -, /usr/sbin/shutdown)
+       @$(call install_link, upstart, reboot, /usr/sbin/halt)
+       @$(call install_link, upstart, reboot, /usr/sbin/poweroff)
        @$(call install_copy, upstart, 0, 0, 0755, -, /usr/sbin/runlevel)
        @$(call install_copy, upstart, 0, 0, 0755, -, /usr/sbin/telinit)
-       @$(call install_copy, upstart, 0, 0, 0755, -, /usr/sbin/start)
-       @$(call install_copy, upstart, 0, 0, 0755, -, /usr/sbin/status)
-       @$(call install_copy, upstart, 0, 0, 0755, -, /usr/sbin/initctl)
+
+       #...@$(call install_copy, upstart, 0, 0, 0755, -, 
/usr/sbin/upstart-udev-
bridge)
 
        @$(call install_copy, upstart, 0, 0, 0755, /etc/init.d/conf.d)
        @$(call install_copy, upstart, 0, 0, 0755, /etc/init.d/jobs.d)
 
        @$(call install_copy, upstart, 0, 0, 0644, -, 
/etc/dbus-1/system.d/Upstart.conf)
 
+       #...@$(call install_alternative, upstart, 0, 0, 0644, /etc/init/rc-
sysinit.conf)
+       @$(call install_alternative, upstart, 0, 0, 0644, /etc/init/rcS.conf)
+       @$(call install_alternative, upstart, 0, 0, 0644, /etc/init/rc.conf)
+#      @$(call install_alternative, upstart, 0, 0, 0644, /etc/init/control-
alt-delete.conf)
+       @$(call install_alternative, upstart, 0, 0, 0644, 
/etc/init/mount.conf)
+       @$(call install_alternative, upstart, 0, 0, 0644, 
/etc/init/networking.conf)
+       @$(call install_alternative, upstart, 0, 0, 0644, /etc/init/network-
interface.conf)
+       @$(call install_alternative, upstart, 0, 0, 0644, 
/etc/init/hostname.conf)
+       @$(call install_alternative, upstart, 0, 0, 0644, /etc/init/ttyS.conf)
+#      @$(call install_alternative, upstart, 0, 0, 0644, /etc/init/tty1.conf)
+#      @$(call install_alternative, upstart, 0, 0, 0644, /etc/init/tty2.conf)
+#      @$(call install_alternative, upstart, 0, 0, 0644, /etc/init/tty3.conf)
+#      @$(call install_alternative, upstart, 0, 0, 0644, /etc/init/tty4.conf)
+#      @$(call install_alternative, upstart, 0, 0, 0644, /etc/init/tty5.conf)
+#      @$(call install_alternative, upstart, 0, 0, 0644, /etc/init/tty6.conf)
+#      @$(call install_alternative, upstart, 0, 0, 0644, /etc/init/upstart-
udev-bridge.conf)
+       @$(call install_alternative, upstart, 0, 0, 0644, 
/etc/init/syslogd.conf)
+#      @$(call install_alternative, upstart, 0, 0, 0755, /etc/init.d/rcS)
+
+       @$(call install_alternative, upstart, 0, 0, 0755, 
/etc/network/interfaces)
+       @$(call install_alternative, upstart, 0, 0, 0644, 
/etc/init/loadmodules.conf) #FIXME this should go to module-init-tools?
+       @$(call install_alternative, upstart, 0, 0, 0644, /etc/modules)
        @$(call install_finish, upstart)
 
        @$(call touch)
-- 
1.7.1

-- 
ptxdist mailing list
[email protected]

Reply via email to