debuggers.hg
changeset 22225:b59f87f56b1e
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 <bruce.edge@gmail.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
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 <bruce.edge@gmail.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
author | <bruce.edge@gmail.com> |
---|---|
date | Mon Sep 20 17:54:25 2010 +0100 (2010-09-20) |
parents | 81c40c5db26e |
children | 0bc640853cfd |
files | Config.mk Makefile config/StdGNU.mk docs/misc/distro_mapping.txt tools/hotplug/Linux/Makefile tools/hotplug/Linux/init.d/xen-watchdog tools/hotplug/Linux/init.d/xend tools/hotplug/Linux/init.d/xendomains tools/xenballoon/xenballoond tools/xenballoon/xenballoond.README tools/xenballoon/xenballoond.init |
line diff
1.1 --- a/Config.mk Mon Sep 20 16:57:08 2010 +0100 1.2 +++ b/Config.mk Mon Sep 20 17:54:25 2010 +0100 1.3 @@ -31,6 +31,12 @@ DOCDIR ?= $(SHAREDIR)/doc/xen 1.4 MANDIR ?= $(SHAREDIR)/man 1.5 BASH_COMPLETION_DIR ?= $(CONFIG_DIR)/bash_completion.d 1.6 1.7 +# These are the Red Hat settings. 1.8 +# See distro_mapping.txt for other options 1.9 +CONFIG_LEAF_DIR ?= sysconfig 1.10 +SUBSYS_DIR ?= /var/run/subsys 1.11 +INITD_DIR ?= /etc/rc.d/init.d 1.12 + 1.13 ifneq ($(EXTRA_PREFIX),) 1.14 EXTRA_INCLUDES += $(EXTRA_PREFIX)/include 1.15 EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBLEAFDIR)
2.1 --- a/Makefile Mon Sep 20 16:57:08 2010 +0100 2.2 +++ b/Makefile Mon Sep 20 17:54:25 2010 +0100 2.3 @@ -203,7 +203,7 @@ uninstall: 2.4 rm -f $(D)$(CONFIG_DIR)/udev/xen-backend.rules 2.5 rm -f $(D)$(CONFIG_DIR)/udev/rules.d/xend.rules 2.6 rm -f $(D)$(CONFIG_DIR)/udev/xend.rules 2.7 - rm -f $(D)$(CONFIG_DIR)/sysconfig/xendomains 2.8 + rm -f $(D)$(SYSCONFIG_DIR)/xendomains 2.9 rm -rf $(D)/var/run/xen* $(D)/var/lib/xen* 2.10 rm -rf $(D)/boot/*xen* 2.11 rm -rf $(D)/lib/modules/*xen*
3.1 --- a/config/StdGNU.mk Mon Sep 20 16:57:08 2010 +0100 3.2 +++ b/config/StdGNU.mk Mon Sep 20 17:54:25 2010 +0100 3.3 @@ -49,7 +49,7 @@ else 3.4 CONFIG_DIR = $(PREFIX)/etc 3.5 endif 3.6 3.7 -SYSCONFIG_DIR = $(CONFIG_DIR)/sysconfig 3.8 +SYSCONFIG_DIR = $(CONFIG_DIR)/$(CONFIG_LEAF_DIR) 3.9 3.10 XEN_CONFIG_DIR = $(CONFIG_DIR)/xen 3.11 XEN_SCRIPT_DIR = $(XEN_CONFIG_DIR)/scripts
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/docs/misc/distro_mapping.txt Mon Sep 20 17:54:25 2010 +0100 4.3 @@ -0,0 +1,27 @@ 4.4 +With directory layout differences between Red Hat, Debian, Suse and 4.5 +other distros one needs to set the variables for the elements below 4.6 + 4.7 +-----------------+------------------+---------------+----------------+ 4.8 + | RedHat (default) | Debian | Suse | 4.9 +-----------------+------------------+---------------+----------------+ 4.10 +CONFIG_LEAF_DIR | sysconfig | default | sysconfig | 4.11 +SUBSYS_DIR | /var/run/subsys | /var/run | /var/run | 4.12 +INITD_DIR | /etc/rc.d/init.d | /etc/init.d | /etc/init.d | 4.13 +-----------------+------------------+---------------+----------------+ 4.14 + 4.15 +The build currently defaults to the elements used by Red Hat. 4.16 +For others, these env variables must be set in the shell env 4.17 +or modified in Config.mk before running make. 4.18 + 4.19 +This mechanism sets the location that files are installed to, but does 4.20 +not change the code itself. Scripts that refer to files affected by these 4.21 +directories must check each possible location at run time. 4.22 + 4.23 +To add support for new distributions that don't use the above locations, 4.24 +one must grep for the above elements and add appropriate checks. 4.25 + 4.26 +For example if a new distro uses /etc/bork as it's config dir, It's not 4.27 +sufficient to set CONFIG_LEAF_DIR=bork, one must also add tests for the 4.28 +existance of the bork dir in every context where config files are read. 4.29 + 4.30 +
5.1 --- a/tools/hotplug/Linux/Makefile Mon Sep 20 16:57:08 2010 +0100 5.2 +++ b/tools/hotplug/Linux/Makefile Mon Sep 20 17:54:25 2010 +0100 5.3 @@ -62,16 +62,17 @@ build: 5.4 .PHONY: install 5.5 install: all install-initd install-scripts $(HOTPLUGS) 5.6 5.7 +# See docs/misc/distro_mapping.txt for INITD_DIR location 5.8 .PHONY: install-initd 5.9 install-initd: 5.10 - [ -d $(DESTDIR)$(CONFIG_DIR)/init.d ] || $(INSTALL_DIR) $(DESTDIR)$(CONFIG_DIR)/init.d 5.11 + [ -d $(DESTDIR)$(INITD_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(INITD_DIR) 5.12 [ -d $(DESTDIR)$(SYSCONFIG_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(SYSCONFIG_DIR) 5.13 - $(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d 5.14 - $(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d 5.15 + $(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)$(INITD_DIR) 5.16 + $(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)$(INITD_DIR) 5.17 $(INSTALL_PROG) $(XENDOMAINS_SYSCONFIG) $(DESTDIR)$(SYSCONFIG_DIR)/xendomains 5.18 - $(INSTALL_PROG) $(XENCOMMONS_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d 5.19 + $(INSTALL_PROG) $(XENCOMMONS_INITD) $(DESTDIR)$(INITD_DIR) 5.20 $(INSTALL_PROG) $(XENCOMMONS_SYSCONFIG) $(DESTDIR)$(SYSCONFIG_DIR)/xencommons 5.21 - $(INSTALL_PROG) init.d/xen-watchdog $(DESTDIR)$(CONFIG_DIR)/init.d 5.22 + $(INSTALL_PROG) init.d/xen-watchdog $(DESTDIR)$(INITD_DIR) 5.23 5.24 .PHONY: install-scripts 5.25 install-scripts:
6.1 --- a/tools/hotplug/Linux/init.d/xen-watchdog Mon Sep 20 16:57:08 2010 +0100 6.2 +++ b/tools/hotplug/Linux/init.d/xen-watchdog Mon Sep 20 17:54:25 2010 +0100 6.3 @@ -18,7 +18,24 @@ 6.4 # 6.5 6.6 # Source function library. 6.7 -. /etc/init.d/functions 6.8 +if [ -e /etc/init.d/functions ] ; then 6.9 + . /etc/init.d/functions 6.10 +elif [ -e /lib/lsb/init-functions ] ; then 6.11 + . /lib/lsb/init-functions 6.12 + success () { 6.13 + log_success_msg $* 6.14 + } 6.15 + failure () { 6.16 + log_failure_msg $* 6.17 + } 6.18 +else 6.19 + success () { 6.20 + echo $* 6.21 + } 6.22 + failure () { 6.23 + echo $* 6.24 + } 6.25 +fi 6.26 6.27 start() { 6.28 local r
7.1 --- a/tools/hotplug/Linux/init.d/xend Mon Sep 20 16:57:08 2010 +0100 7.2 +++ b/tools/hotplug/Linux/init.d/xend Mon Sep 20 17:54:25 2010 +0100 7.3 @@ -40,14 +40,20 @@ case "$1" in 7.4 echo "xencommons should be started first." 7.5 exit 1 7.6 fi 7.7 - mkdir -p /var/lock/subsys 7.8 - touch /var/lock/subsys/xend 7.9 + # mkdir shouldn't be needed as most distros have this already created. Default to using subsys. 7.10 + # See docs/misc/distro_mapping.txt 7.11 + mkdir -p /var/lock 7.12 + if [ -d /var/lock/subsys ] ; then 7.13 + touch /var/lock/subsys/xend 7.14 + else 7.15 + touch /var/lock/xend 7.16 + fi 7.17 xend start 7.18 await_daemons_up 7.19 ;; 7.20 stop) 7.21 xend stop 7.22 - rm -f /var/lock/subsys/xend 7.23 + rm -f /var/lock/subsys/xend /var/lock/xend 7.24 ;; 7.25 status) 7.26 xend status
8.1 --- a/tools/hotplug/Linux/init.d/xendomains Mon Sep 20 16:57:08 2010 +0100 8.2 +++ b/tools/hotplug/Linux/init.d/xendomains Mon Sep 20 17:54:25 2010 +0100 8.3 @@ -46,8 +46,18 @@ if ! [ -e /proc/xen/privcmd ]; then 8.4 exit 0 8.5 fi 8.6 8.7 -LOCKFILE=/var/lock/subsys/xendomains 8.8 -XENDOM_CONFIG=/etc/sysconfig/xendomains 8.9 +# See docs/misc/distro_mapping.txt 8.10 +if [ -d /var/lock/subsys ]; then 8.11 + LOCKFILE=/var/lock/subsys/xendomains 8.12 +else 8.13 + LOCKFILE=/var/lock/xendomains 8.14 +fi 8.15 + 8.16 +if [ -d /etc/sysconfig ]; then 8.17 + XENDOM_CONFIG=/etc/sysconfig/xendomains 8.18 +else 8.19 + XENDOM_CONFIG=/etc/default/xendomains 8.20 +fi 8.21 8.22 test -r $XENDOM_CONFIG || { echo "$XENDOM_CONFIG not existing"; 8.23 if [ "$1" = "stop" ]; then exit 0;
9.1 --- a/tools/xenballoon/xenballoond Mon Sep 20 16:57:08 2010 +0100 9.2 +++ b/tools/xenballoon/xenballoond Mon Sep 20 17:54:25 2010 +0100 9.3 @@ -21,7 +21,7 @@ 9.4 # If xenbus is running and the /usr/bin/xenstore-* tools are installed, 9.5 # "xenbus is enabled". 9.6 # 9.7 -# Parameters are documented in /etc/sysconfig/xenballoon.conf. Although 9.8 +# Parameters are documented in <SYSCONFIG>/xenballoon.conf. Although 9.9 # some are not used with directed ballooning, all must be set properly. 9.10 # If xenbus is enabled, some of these parameters may be overridden by values 9.11 # set by domain0 via xenbus. 9.12 @@ -237,7 +237,12 @@ else 9.13 fi 9.14 preswapnow=0 9.15 9.16 -. /etc/sysconfig/xenballoon.conf 9.17 +# See docs/misc/distro_mapping.txt 9.18 +if [ -f /etc/sysconfig/xenballoon.conf ]; then 9.19 + . /etc/sysconfig/xenballoon.conf 9.20 +elif [ -f /etc/default/xenballoon.conf ]; then 9.21 + . /etc/default/xenballoon.conf 9.22 +fi 9.23 9.24 while true; 9.25 do
10.1 --- a/tools/xenballoon/xenballoond.README Mon Sep 20 16:57:08 2010 +0100 10.2 +++ b/tools/xenballoon/xenballoond.README Mon Sep 20 17:54:25 2010 +0100 10.3 @@ -56,16 +56,20 @@ Guest prerequisites to use xenballoond: 10.4 be installed. Binaries can be obtained, for example, by building 10.5 xen-vvv.gz/tools in a guest-binary-compatible development tree 10.6 10.7 -Instructions to install/deploy xenballoond (in Redhat-based system): 10.8 +Instructions to install/deploy xenballoond: 10.9 + (see docs/misc/distro_mapping.txt for SYSCONFIG and INITD_DIR definitions) 10.10 - in each guest: 10.11 - ensure pre-requisites are met (see above) 10.12 - - place xenballoon.conf in /etc/sysconfig 10.13 + - place xenballoon.conf in <SYSCONFIG> 10.14 - place xenballoond in /usr/sbin 10.15 - - copy xenballoond.init to /etc/rc.d/init.d/xenballoond (note file rename) 10.16 - - edit /etc/sysconfig/xenballoond.conf as desired (especially note that 10.17 + - copy xenballoond.init to <INITD_DIR>/xenballoond (note file rename) 10.18 + - edit <SYSCONFIG>/xenballoond.conf as desired (especially note that 10.19 selfballooning defaults as off) 10.20 - start xenballoond with "service xenballoond start", and/or configure 10.21 - xenballoond to start at init (e.g. "chkconfig xenballoond on") 10.22 + xenballoond to start at init 10.23 + (Red Hat e.g. "chkconfig xenballoond on") 10.24 + (Debian e.g. " update-rc.d xenballoond defaults") 10.25 + (Suse e.g. " insserv xenballoond") 10.26 - in domain0: 10.27 - if monitoring is desired, xenballoon-monitor may be installed in /usr/sbin 10.28 - note that certain xenballoond.conf variables may be overridden by domain0 10.29 @@ -73,7 +77,6 @@ Instructions to install/deploy xenballoo 10.30 xenballoond.conf 10.31 10.32 TODO: 10.33 -080630 modifications to support SUSE-based and debian-based guests 10.34 080630 domain0 ballooning policy module 10.35 080630 experiment with more aggressive (optionally) memory minimum targets 10.36 080630 BUG: xenballoond doesn't properly record the fact that it's running;
11.1 --- a/tools/xenballoon/xenballoond.init Mon Sep 20 16:57:08 2010 +0100 11.2 +++ b/tools/xenballoon/xenballoond.init Mon Sep 20 17:54:25 2010 +0100 11.3 @@ -29,6 +29,8 @@ 11.4 11.5 if [ -f /etc/sysconfig/xenballoon.conf ]; then 11.6 . /etc/sysconfig/xenballoon.conf 11.7 +elif [ -f /etc/default/xenballoon.conf ]; then 11.8 + . /etc/default/xenballoon.conf 11.9 fi 11.10 11.11 # Check that balloon driver is present