From 0bab0306bb0c1cfa01ed5e7855dccdbfb71e4311 Mon Sep 17 00:00:00 2001 From: Robert Schwebel Date: Sun, 26 Nov 2006 07:20:06 +0000 Subject: * dbus: rest of the config fixes; patch by Roland Hostettler git-svn-id: https://svn.pengutronix.de/svn/ptxdist/trunks/ptxdist-trunk@6375 33e552b5-05e3-0310-8538-816dae2090ed --- CREDITS | 4 +++ generic/etc/init.d/dbus | 84 ++++++++++++++++++++++++++++++++++++++++++++ rules/dbus.in | 14 +++++++- rules/dbus.make | 56 +++++++++++++++++------------ rules/rootfs_configfiles.in | 70 ++++++++++++++++++++++++++++++++++++ rules/rootfs_init_d_files.in | 35 +++++++++++++++++- rules/rootfs_rc_d_links.in | 10 ++++++ 7 files changed, 249 insertions(+), 24 deletions(-) create mode 100644 generic/etc/init.d/dbus diff --git a/CREDITS b/CREDITS index 81e4467a8..f581e0fd5 100644 --- a/CREDITS +++ b/CREDITS @@ -67,6 +67,10 @@ E: chgans@free.fr E: chgans@gna.org D: Developer +N: Roland Hostettler +E: r.hostettler@gmx.ch +D: Developer + N: Lev Iserovich E: lev.iserovich@deshaw.com D: Developer diff --git a/generic/etc/init.d/dbus b/generic/etc/init.d/dbus new file mode 100644 index 000000000..e8d2449de --- /dev/null +++ b/generic/etc/init.d/dbus @@ -0,0 +1,84 @@ +#! /bin/sh +# -*- coding: utf-8 -*- +# Modified Debian init.d script for D-Bus on Pengutronix OSELAS Embedded Linux +# Copyright © 2003 Colin Walters +# Copyright © 2005 Sjoerd Simons +# Adapted to OSELAS/PTXdist 2006 Roland Hostettler + +set -e + +DAEMON=/usr/bin/dbus-daemon +NAME=dbus +DAEMONUSER=messagebus +PIDDIR=/var/run/dbus +PIDFILE=$PIDDIR/pid +DESC="system message bus" +EVENTDIR=/etc/dbus-1/event.d + +test -x $DAEMON || exit 0 + +PARAMS="" + +start_it_up() +{ + if [ ! -d $PIDDIR ]; then + mkdir -p $PIDDIR + chown $DAEMONUSER $PIDDIR + chgrp $DAEMONUSER $PIDDIR + fi + if [ -e $PIDFILE ]; then + PIDDIR=/proc/`cat $PIDFILE` + if [ -d ${PIDDIR} -a "`readlink -f ${PIDDIR}/exe`" = "${DAEMON}" ]; then + echo "$DESC already started; not starting." + else + echo "Removing stale PID file $PIDFILE." + rm -f $PIDFILE + fi + fi + echo -n "Starting $DESC:" "$NAME" + $DAEMON --system $PARAMS + echo "." + if [ -d $EVENTDIR ]; then + run-parts --arg=start $EVENTDIR || true + fi +} + +shut_it_down() +{ + echo -n "Stopping $DESC:" "$NAME" + kill `cat $PIDFILE` + echo "." + rm -f $PIDFILE +} + +reload_it() +{ + echo -n "Reloading $DESC config" + dbus-send --print-reply --system --type=method_call \ + --dest=org.freedesktop.DBus \ + / org.freedesktop.DBus.ReloadConfig > /dev/null + # hopefully this is enough time for dbus to reload it's config file. + echo "." +} + +case "$1" in +start) + start_it_up + ;; +stop) + shut_it_down + ;; + reload|force-reload) + reload_it + ;; +restart) + shut_it_down + start_it_up + ;; +*) + echo "Usage: /etc/init.d/$NAME {start|stop|reload|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/rules/dbus.in b/rules/dbus.in index e0da9cc51..65563fcde 100644 --- a/rules/dbus.in +++ b/rules/dbus.in @@ -1,3 +1,5 @@ +# dbus configuration + menuconfig DBUS bool prompt "dbus" @@ -22,6 +24,17 @@ choice prompt "libxml2" endchoice +config DBUS_USER + depends on DBUS + string + prompt "user for running the dbus daemon" + default "messagebus" + help + Enter the user name to run the D-Bus daemon with. The PTXdist + standard configuration has only root, so if you want to use + the dbus default user "messagebus" you have to create a + related user yourself. + # --enable-tests enable unit test code # --enable-ansi enable -ansi -pedantic gcc flags # --enable-verbose-mode support verbose debug mode @@ -60,7 +73,6 @@ endchoice # directory to check for console ownerhip # --with-console-owner-file=filename # file whose owner determines current console owner -# --with-dbus-user= User for running the DBUS daemon (messagebus) # --with-dbus-daemondir=dirname # Directory for installing the DBUS daemon # --with-x use the X Window System diff --git a/rules/dbus.make b/rules/dbus.make index 1616b4829..7a7b0376e 100644 --- a/rules/dbus.make +++ b/rules/dbus.make @@ -1,7 +1,7 @@ # -*-makefile-*- -# $Id: template 6001 2006-08-12 10:15:00Z mkl $ +# $Id$ # -# Copyright (C) 2006 by Robert Schwebel +# Copyright (C) 2006 by Roland Hostettler # # See CREDITS for details about who has contributed to this project. # @@ -116,7 +116,7 @@ $(STATEDIR)/dbus.targetinstall: $(dbus_targetinstall_deps_default) @$(call install_fixup,dbus,PRIORITY,optional) @$(call install_fixup,dbus,VERSION,$(DBUS_VERSION)) @$(call install_fixup,dbus,SECTION,base) - @$(call install_fixup,dbus,AUTHOR,"Robert Schwebel ") + @$(call install_fixup,dbus,AUTHOR,"Roland Hostettler ") @$(call install_fixup,dbus,DEPENDS,) @$(call install_fixup,dbus,DESCRIPTION,missing) @@ -138,45 +138,57 @@ $(STATEDIR)/dbus.targetinstall: $(dbus_targetinstall_deps_default) @$(call install_copy, dbus, 0, 0, 0755, /etc/dbus-1/event.d/) # - # use the default config file + # use the default /etc/dbus-1/system.conf config file # -ifdef PTXCONF_DBUS_DEFAULTCONFIG +ifdef PTXCONF_ROOTFS_GENERIC_DBUS_SYSTEM_CONF @$(call install_copy, dbus, 0, 0, 0644, $(DBUS_DIR)/bus/system.conf, /etc/dbus-1/system.conf,n) - @$(call install_copy, dbus, 0, 0, 0644, $(DBUS_DIR)/bus/session.conf, /etc/dbus-1/session.conf,n) -else +endif # - # use users configuration instead + # use the users /etc/dbus-1/system.conf config file from projectroot/etc/dbus-1/system.conf # -ifdef PTXCONF_DBUS_USER_SYSTEM_CONFIG -ifneq ($(PTXCONF_DBUS_USER_SYSTEM_CONFIG), "") +ifdef PTXCONF_ROOTFS_USER_DBUS_SYSTEM_CONF @echo "installing user system config file..." - @$(call install_copy, dbus, 12, 102, 0644, $(PTXCONF_DBUS_USER_SYSTEM_CONFIG), /etc/dbus-1/system.conf,n) -endif -ifneq ($(PTXCONF_DBUS_USER_SESSION_CONFIG), "") - @echo "installing user session config file..." - @$(call install_copy, dbus, 12, 102, 0644, $(PTXCONF_DBUS_USER_SESSION_CONFIG), /etc/dbus-1/session.conf,n) -endif + @$(call install_copy, dbus, 0, 0, 0644, $(PTXDIST_WORKSPACE)/projectroot/etc/dbus-1/system.conf, /etc/dbus-1/system.conf,n) endif + + # + # use the default /etc/dbus-1/session.conf config file + # +ifdef PTXCONF_ROOTFS_GENERIC_DBUS_SESSION_CONF + @$(call install_copy, dbus, 0, 0, 0644, $(DBUS_DIR)/bus/session.conf, /etc/dbus-1/session.conf,n) endif # - # create init script and link to launch at startup + # use the user's /etc/dbus-1/session.conf config file from projectroot/etc/dbus-1/session.conf # -ifdef PTXCONF_ROOTFS_ETC_INITD_DBUS -ifneq ($(call remove_quotes,$(PTXCONF_ROOTFS_ETC_INITD_DBUS_USER_FILE)),) - @$(call install_copy, dbus, 0, 0, 0755, $(PTXCONF_ROOTFS_ETC_INITD_DBUS_USER_FILE), /etc/init.d/dbus, n) +ifdef PTXCONF_ROOTFS_USER_DBUS_SESSION_CONF + @echo "installing user session config file..." + @$(call install_copy, dbus, 0, 0, 0644, $(PTXDIST_WORKSPACE)/projectroot/etc/dbus-1/session.conf, /etc/dbus-1/session.conf,n) +endif -else + # + # use the generic startup script in /etc/init.d/dbus + # +ifdef PTXCONF_ROOTFS_ETC_INITD_DBUS_GENERIC @$(call install_copy, dbus, 0, 0, 0755, $(PTXDIST_TOPDIR)/generic/etc/init.d/dbus, /etc/init.d/dbus, n) endif + # + # use the user's startup script in /etc/init.d/dbus from projectroot/etc/init.d/dbus + # +ifdef PTXCONF_ROOTFS_ETC_INITD_DBUS_USER + @$(call install_copy, dbus, 0, 0, 0755, $(PTXDIST_WORKSPACE)/projectroot/etc/init.d/dbus, /etc/init.d/dbus,n) +endif + + # + # create a link in /etc/rc.d/ to /etc/init.d/dbus + # ifdef PTXCONF_ROOTFS_ETC_INITD_DBUS_LINK ifneq ($(PTXCONF_ROOTFS_ETC_INITD_DBUS_LINK),"") @$(call install_copy, dbus, 0, 0, 0755, /etc/rc.d) @$(call install_link, dbus, ../init.d/dbus, /etc/rc.d/$(PTXCONF_ROOTFS_ETC_INITD_DBUS_LINK)) endif -endif endif @$(call install_finish,dbus) diff --git a/rules/rootfs_configfiles.in b/rules/rootfs_configfiles.in index 3bcfe56cf..6cbd67792 100644 --- a/rules/rootfs_configfiles.in +++ b/rules/rootfs_configfiles.in @@ -603,4 +603,74 @@ config ROOTFS_USERS_CROND_CONF Install /var/spool/cron/crontabs/root from projectroot/crond/root and /etc/cron/daily from projectroot/crond/daily +# +# /etc/dbus-1/system.conf +# +menuconfig ROOTFS_DBUS_SYSTEM_CONF + depends on ROOTFS + depends on DBUS + bool + prompt "/etc/dbus-1/system.conf " + default y + help + Installs a /etc/dbus-1/system.conf file from a selectable source. + + choice + prompt "Kind of /etc/dbus-1/system.conf" + depends on ROOTFS_DBUS_SYSTEM_CONF + default ROOTFS_GENERIC_DBUS_SYSTEM_CONF + + config ROOTFS_GENERIC_DBUS_SYSTEM_CONF + bool + prompt "Use generic" + help + This uses the generic configuration file for your dbus which is + shipped with the sources. This configuration is likely to fail + because it is thought for a desktop PC. + + config ROOTFS_USER_DBUS_SYSTEM_CONF + bool + prompt "User defined" + help + This uses a user defined /etc/dbus-1/system.conf. PTXdist + uses file projectroot/etc/dbus-1/system.conf in your local + project. + + endchoice + +# +# /etc/dbus-1/session.conf +# +menuconfig ROOTFS_DBUS_SESSION_CONF + depends on ROOTFS + depends on DBUS + bool + prompt "/etc/dbus-1/session.conf " + default y + help + Installs a /etc/dbus-1/session.conf file from a selectable source. + + choice + prompt "Kind of /etc/dbus-1/system.conf" + depends on ROOTFS_DBUS_SESSION_CONF + default ROOTFS_GENERIC_DBUS_SESSION_CONF + + config ROOTFS_GENERIC_DBUS_SESSION_CONF + bool + prompt "Use generic" + help + This uses the generic configuration file for your dbus which is + shipped with the sources. This configuration is likely to fail + because it is thought for a desktop PC. + + config ROOTFS_USER_DBUS_SESSION_CONF + bool + prompt "User defined" + help + This uses a user defined /etc/dbus-1/session.conf. PTXdist + uses file projectroot/etc/dbus-1/session.conf in your local + project. + + endchoice + endmenu diff --git a/rules/rootfs_init_d_files.in b/rules/rootfs_init_d_files.in index 926d9a2e2..4a783e6bf 100644 --- a/rules/rootfs_init_d_files.in +++ b/rules/rootfs_init_d_files.in @@ -241,7 +241,7 @@ menuconfig ROOTFS_ETC_INITD_DROPBEAR The /etc/init.d/dropbear script lets you control the dropbear daemon. choice - prompt "Kind of startup scrict" + prompt "Kind of startup script" depends on ROOTFS_ETC_INITD_DROPBEAR default ROOTFS_ETC_INITD_DROPBEAR_DEFAULT @@ -299,4 +299,37 @@ menuconfig ROOTFS_ETC_INITD_CROND your local project endchoice +######################## D-Bus ############################################ + +menuconfig ROOTFS_ETC_INITD_DBUS + depends on ROOTFS_ETC_INITD + depends on DBUS + bool + prompt "dbus " + default y + help + The /etc/init.d/dbus script starts up your D-Bus daemon (system bus). + + choice + prompt "Kind of startup script" + depends on ROOTFS_ETC_INITD_DBUS + default ROOTFS_ETC_INITD_DBUS_GENERIC + + config ROOTFS_ETC_INITD_DBUS_GENERIC + bool + prompt "Use generic" + help + This uses the generic configuration file for your dbus which is + shipped with the sources. This configuration is likely to fail + because it is thought for a desktop PC. + + config ROOTFS_ETC_INITD_DBUS_USER + bool + prompt "User defined" + help + This uses a user defined /etc/init.d/dbus. PTXdist uses + file projectroot/etc/init.d/dbus in your local project. + + endchoice + endmenu diff --git a/rules/rootfs_rc_d_links.in b/rules/rootfs_rc_d_links.in index 716f50ea9..39a5b93cd 100644 --- a/rules/rootfs_rc_d_links.in +++ b/rules/rootfs_rc_d_links.in @@ -192,4 +192,14 @@ config ROOTFS_ETC_INITD_NFS_LINK start nfs server when system starts. Keep this entry empty if you do not want to start this service automatically. +config ROOTFS_ETC_INITD_DBUS_LINK + depends on ROOTFS_ETC_INITD_DBUS_GENERIC || ROOTFS_ETC_INITD_DBUS_USER + string + prompt "dbus link name" + default "S18_dbus" + help + Set a link into /etc/rc.d which points to /etc/init.d/dbus to + start dbus when system starts. Keep this entry empty if + you do not want to start this service automatically. + endmenu -- cgit v1.2.3