There are 2 locations that are not optimal for Debian based distributions. These are /etc/sysconfig, and /var/subsys. Debian uses /etc/default and /var for these respectively. This patch provides a new make config variable, XEN_CONFIG_ARCH, which changes the location of these 2 elements if set. If unset it defaults to the current behavior, but if set to the string "default", it uses the Debian locations. For the runtime scripts it checks whether the Red Hat sysconfig files exist first, then looks in the Debian location. This lets the config files reside in the desired location and does not require any additional runtime config file to point to their location. This patch also adds a sysconfig.txt file describing the build time usage. Author: Bruce Edge Signed-off-by: Bruce Edge Index: xen-unstable.hg/Config.mk =================================================================== --- xen-unstable.hg.orig/Config.mk 2010-09-13 10:44:48.000000000 -0700 +++ xen-unstable.hg/Config.mk 2010-09-13 10:45:11.000000000 -0700 @@ -8,6 +8,9 @@ XEN_TARGET_ARCH ?= $(XEN_COMPILE_ARCH) XEN_OS ?= $(shell uname -s) +# Override for debian based systems that use /etc instead of /etc/sysconfig +XEN_CONFIG_ARCH ?= /sysconfig + CONFIG_$(XEN_OS) := y SHELL ?= /bin/sh Index: xen-unstable.hg/config/StdGNU.mk =================================================================== --- xen-unstable.hg.orig/config/StdGNU.mk 2010-09-13 10:44:48.000000000 -0700 +++ xen-unstable.hg/config/StdGNU.mk 2010-09-13 10:45:11.000000000 -0700 @@ -49,7 +49,7 @@ CONFIG_DIR = $(PREFIX)/etc endif -SYSCONFIG_DIR = $(CONFIG_DIR)/sysconfig +SYSCONFIG_DIR = $(CONFIG_DIR)/$(XEN_CONFIG_ARCH) XEN_CONFIG_DIR = $(CONFIG_DIR)/xen XEN_SCRIPT_DIR = $(XEN_CONFIG_DIR)/scripts Index: xen-unstable.hg/Makefile =================================================================== --- xen-unstable.hg.orig/Makefile 2010-09-13 10:44:48.000000000 -0700 +++ xen-unstable.hg/Makefile 2010-09-13 10:45:11.000000000 -0700 @@ -203,7 +203,7 @@ rm -f $(D)$(CONFIG_DIR)/udev/xen-backend.rules rm -f $(D)$(CONFIG_DIR)/udev/rules.d/xend.rules rm -f $(D)$(CONFIG_DIR)/udev/xend.rules - rm -f $(D)$(CONFIG_DIR)/sysconfig/xendomains + rm -f $(D)$(SYSCONFIG_DIR)/xendomains rm -rf $(D)/var/run/xen* $(D)/var/lib/xen* rm -rf $(D)/boot/*xen* rm -rf $(D)/lib/modules/*xen* Index: xen-unstable.hg/docs/misc/network_setup.txt =================================================================== --- xen-unstable.hg.orig/docs/misc/network_setup.txt 2010-09-13 10:44:48.000000000 -0700 +++ xen-unstable.hg/docs/misc/network_setup.txt 2010-09-13 10:45:11.000000000 -0700 @@ -44,7 +44,7 @@ Creating network initscripts ---------------------------- -In the /etc/sysconfig/network-scripts directory it is necccessary to create +In the /network-scripts directory it is necccessary to create 2 config files. The first (ifcfg-eth0) defines your physical network interface, and says that it will be part of a bridge: @@ -79,8 +79,8 @@ The final step is to configure iptables to allow all traffic to be forwarded across the bridge -# echo "-I FORWARD -m physdev --physdev-is-bridged -j ACCEPT" > /etc/sysconfig/iptables-forward-bridged -# lokkit --custom-rules=ipv4:filter:/etc/sysconfig/iptables-forward-bridged +# echo "-I FORWARD -m physdev --physdev-is-bridged -j ACCEPT" > /iptables-forward-bridged +# lokkit --custom-rules=ipv4:filter:/iptables-forward-bridged # service libvirtd reload Alternatively, you can prevent bridged traffic getting pushed through Index: xen-unstable.hg/docs/misc/sysconfig.txt =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ xen-unstable.hg/docs/misc/sysconfig.txt 2010-09-13 10:45:11.000000000 -0700 @@ -0,0 +1,14 @@ +This describes the use of the and variables. + +Red hat and most other RPM based distros use /etc/sysconfig for configuration data. + +Debian and other derivative distros use /etc/default for this same data. + +The same applies to /var/subsys and /var. Red Hat uses the former and Debian the latter. + +These differences are handled by the XEN_CONFIG_ARCH build time variable. The default is for the Red Hat configuration. Debian and other derivatives need to set this variable to "default" in the build shell's environment. + +eg: + +XEN_CONFIG_ARCH="" make dist + Index: xen-unstable.hg/tools/vnet/doc/vnet-xend.txt =================================================================== --- xen-unstable.hg.orig/tools/vnet/doc/vnet-xend.txt 2010-09-13 10:44:49.000000000 -0700 +++ xen-unstable.hg/tools/vnet/doc/vnet-xend.txt 2010-09-13 10:45:11.000000000 -0700 @@ -79,8 +79,8 @@ MTU=1400 -in /etc/sysconfig/network-scripts/ifcfg-eth0. You may also have to change or remove -cached config files for eth0 under /etc/sysconfig/networking. +in /network-scripts/ifcfg-eth0. You may also have to change or remove +cached config files for eth0 under /networking. Once configured, vnets are persistent in the xend database. To remove a vnet use Index: xen-unstable.hg/tools/xenballoon/xenballoond.init =================================================================== --- xen-unstable.hg.orig/tools/xenballoon/xenballoond.init 2010-09-13 10:44:49.000000000 -0700 +++ xen-unstable.hg/tools/xenballoon/xenballoond.init 2010-09-13 10:45:11.000000000 -0700 @@ -29,6 +29,10 @@ if [ -f /etc/sysconfig/xenballoon.conf ]; then . /etc/sysconfig/xenballoon.conf +else + if [ -f /etc/default/xenballoon.conf ]; then + . /etc/default/xenballoon.conf + fi fi # Check that balloon driver is present Index: xen-unstable.hg/tools/xenballoon/xenballoond =================================================================== --- xen-unstable.hg.orig/tools/xenballoon/xenballoond 2010-09-13 10:44:49.000000000 -0700 +++ xen-unstable.hg/tools/xenballoon/xenballoond 2010-09-13 10:45:11.000000000 -0700 @@ -21,7 +21,7 @@ # If xenbus is running and the /usr/bin/xenstore-* tools are installed, # "xenbus is enabled". # -# Parameters are documented in /etc/sysconfig/xenballoon.conf. Although +# Parameters are documented in /xenballoon.conf. Although # some are not used with directed ballooning, all must be set properly. # If xenbus is enabled, some of these parameters may be overridden by values # set by domain0 via xenbus. @@ -237,7 +237,13 @@ fi preswapnow=0 -. /etc/sysconfig/xenballoon.conf +if [ -f /etc/sysconfig/xenballoon.conf ]; then + . /etc/sysconfigxenballoon.conf +else + if [ -f /etc/default/xenballoon.conf ]; then + . /etc/default/xenballoon.conf + fi +fi while true; do Index: xen-unstable.hg/tools/xenballoon/xenballoond.README =================================================================== --- xen-unstable.hg.orig/tools/xenballoon/xenballoond.README 2010-09-13 10:44:49.000000000 -0700 +++ xen-unstable.hg/tools/xenballoon/xenballoond.README 2010-09-13 10:45:11.000000000 -0700 @@ -59,10 +59,10 @@ Instructions to install/deploy xenballoond (in Redhat-based system): - in each guest: - ensure pre-requisites are met (see above) - - place xenballoon.conf in /etc/sysconfig + - place xenballoon.conf in - place xenballoond in /usr/sbin - copy xenballoond.init to /etc/rc.d/init.d/xenballoond (note file rename) - - edit /etc/sysconfig/xenballoond.conf as desired (especially note that + - edit /xenballoond.conf as desired (especially note that selfballooning defaults as off) - start xenballoond with "service xenballoond start", and/or configure xenballoond to start at init (e.g. "chkconfig xenballoond on") Index: xen-unstable.hg/tools/hotplug/Linux/init.d/xendomains =================================================================== --- xen-unstable.hg.orig/tools/hotplug/Linux/init.d/xendomains 2010-09-13 10:44:48.000000000 -0700 +++ xen-unstable.hg/tools/hotplug/Linux/init.d/xendomains 2010-09-13 10:45:11.000000000 -0700 @@ -46,9 +46,13 @@ exit 0 fi -LOCKFILE=/var/lock/subsys/xendomains -XENDOM_CONFIG=/etc/sysconfig/xendomains - +if [ -d /etc/sysconfig ]; then + LOCKFILE=/var/lock/subsys/xendomains + XENDOM_CONFIG=/etc/sysconfig/xendomains +else + LOCKFILE=/var/lock/xendomains + XENDOM_CONFIG=/etc/default/xendomains +fi test -r $XENDOM_CONFIG || { echo "$XENDOM_CONFIG not existing"; if [ "$1" = "stop" ]; then exit 0; else exit 6; fi; } Index: xen-unstable.hg/tools/hotplug/Linux/init.d/xend =================================================================== --- xen-unstable.hg.orig/tools/hotplug/Linux/init.d/xend 2010-09-13 13:53:19.000000000 -0700 +++ xen-unstable.hg/tools/hotplug/Linux/init.d/xend 2010-09-13 13:56:52.000000000 -0700 @@ -40,14 +40,20 @@ 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. + # This makes it Red Had/Debian agnostic + 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