From 744d6961f91581f603c0f285f52c4b23fa30ad4c Mon Sep 17 00:00:00 2001 From: Date: Mon, 20 Sep 2010 17:54:25 +0100 Subject: tools, build system: Make changing distro-specific layout aspects easier Introduce CONFIG_LEAF_DIR, SUBSYS_DIR, INITD_DIR variables to cope better with variation between distributions. See docs/misc/distro_mapping.txt for details. Signed-off-by: Bruce Edge Acked-by: Ian Jackson Signed-off-by: Ian Jackson --- tools/hotplug/Linux/Makefile | 11 ++++++----- tools/hotplug/Linux/init.d/xen-watchdog | 19 ++++++++++++++++++- tools/hotplug/Linux/init.d/xend | 12 +++++++++--- tools/hotplug/Linux/init.d/xendomains | 14 ++++++++++++-- 4 files changed, 45 insertions(+), 11 deletions(-) (limited to 'tools/hotplug') diff --git a/tools/hotplug/Linux/Makefile b/tools/hotplug/Linux/Makefile index 5815dcde7e..d3662a8455 100644 --- a/tools/hotplug/Linux/Makefile +++ b/tools/hotplug/Linux/Makefile @@ -62,16 +62,17 @@ build: .PHONY: install install: all install-initd install-scripts $(HOTPLUGS) +# See docs/misc/distro_mapping.txt for INITD_DIR location .PHONY: install-initd install-initd: - [ -d $(DESTDIR)$(CONFIG_DIR)/init.d ] || $(INSTALL_DIR) $(DESTDIR)$(CONFIG_DIR)/init.d + [ -d $(DESTDIR)$(INITD_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(INITD_DIR) [ -d $(DESTDIR)$(SYSCONFIG_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(SYSCONFIG_DIR) - $(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d - $(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d + $(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)$(INITD_DIR) + $(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)$(INITD_DIR) $(INSTALL_PROG) $(XENDOMAINS_SYSCONFIG) $(DESTDIR)$(SYSCONFIG_DIR)/xendomains - $(INSTALL_PROG) $(XENCOMMONS_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d + $(INSTALL_PROG) $(XENCOMMONS_INITD) $(DESTDIR)$(INITD_DIR) $(INSTALL_PROG) $(XENCOMMONS_SYSCONFIG) $(DESTDIR)$(SYSCONFIG_DIR)/xencommons - $(INSTALL_PROG) init.d/xen-watchdog $(DESTDIR)$(CONFIG_DIR)/init.d + $(INSTALL_PROG) init.d/xen-watchdog $(DESTDIR)$(INITD_DIR) .PHONY: install-scripts install-scripts: diff --git a/tools/hotplug/Linux/init.d/xen-watchdog b/tools/hotplug/Linux/init.d/xen-watchdog index 99122d80da..620e8415d0 100644 --- a/tools/hotplug/Linux/init.d/xen-watchdog +++ b/tools/hotplug/Linux/init.d/xen-watchdog @@ -18,7 +18,24 @@ # # Source function library. -. /etc/init.d/functions +if [ -e /etc/init.d/functions ] ; then + . /etc/init.d/functions +elif [ -e /lib/lsb/init-functions ] ; then + . /lib/lsb/init-functions + success () { + log_success_msg $* + } + failure () { + log_failure_msg $* + } +else + success () { + echo $* + } + failure () { + echo $* + } +fi start() { local r diff --git a/tools/hotplug/Linux/init.d/xend b/tools/hotplug/Linux/init.d/xend index 0f7f041f71..6168afea64 100755 --- a/tools/hotplug/Linux/init.d/xend +++ b/tools/hotplug/Linux/init.d/xend @@ -40,14 +40,20 @@ case "$1" in echo "xencommons should be started first." exit 1 fi - mkdir -p /var/lock/subsys - touch /var/lock/subsys/xend + # mkdir shouldn't be needed as most distros have this already created. Default to using subsys. + # See docs/misc/distro_mapping.txt + mkdir -p /var/lock + if [ -d /var/lock/subsys ] ; then + touch /var/lock/subsys/xend + else + touch /var/lock/xend + fi xend start await_daemons_up ;; stop) xend stop - rm -f /var/lock/subsys/xend + rm -f /var/lock/subsys/xend /var/lock/xend ;; status) xend status diff --git a/tools/hotplug/Linux/init.d/xendomains b/tools/hotplug/Linux/init.d/xendomains index cd5bad2691..8459d234c0 100644 --- a/tools/hotplug/Linux/init.d/xendomains +++ b/tools/hotplug/Linux/init.d/xendomains @@ -46,8 +46,18 @@ if ! [ -e /proc/xen/privcmd ]; then exit 0 fi -LOCKFILE=/var/lock/subsys/xendomains -XENDOM_CONFIG=/etc/sysconfig/xendomains +# See docs/misc/distro_mapping.txt +if [ -d /var/lock/subsys ]; then + LOCKFILE=/var/lock/subsys/xendomains +else + LOCKFILE=/var/lock/xendomains +fi + +if [ -d /etc/sysconfig ]; then + XENDOM_CONFIG=/etc/sysconfig/xendomains +else + XENDOM_CONFIG=/etc/default/xendomains +fi test -r $XENDOM_CONFIG || { echo "$XENDOM_CONFIG not existing"; if [ "$1" = "stop" ]; then exit 0; -- cgit v1.2.3