[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 08/12] tools/hotplug: use XEN_SCRIPT_DIR instead of hardcoded path
Helper scripts get installed into XEN_SCRIPT_DIR, but initscripts, helper scripts and udev rules still refer to the hardcoded location /etc/xen/scripts/. Update scripts, rules and Makefile to refer to @@XEN_SCRIPT_DIR@@ instead. Signed-off-by: Olaf Hering <olaf@xxxxxxxxx> --- tools/hotplug/Linux/Makefile | 30 ++++++++++++++++++++++-------- tools/hotplug/Linux/init.d/xen-watchdog | 2 +- tools/hotplug/Linux/init.d/xencommons | 2 +- tools/hotplug/Linux/init.d/xendomains | 2 +- tools/hotplug/Linux/vif-setup | 2 +- tools/hotplug/Linux/xen-backend.rules | 16 ++++++++-------- tools/hotplug/Linux/xen-hotplug-common.sh | 2 +- 7 files changed, 35 insertions(+), 21 deletions(-) diff --git a/tools/hotplug/Linux/Makefile b/tools/hotplug/Linux/Makefile index 4874ec5..aae7f9e 100644 --- a/tools/hotplug/Linux/Makefile +++ b/tools/hotplug/Linux/Makefile @@ -2,10 +2,11 @@ XEN_ROOT = $(CURDIR)/../../.. include $(XEN_ROOT)/tools/Rules.mk # Init scripts. -XENDOMAINS_INITD = init.d/xendomains +XEN_INIT_SCRIPTS = xen-watchdog +XEN_INIT_SCRIPTS += xendomains XENDOMAINS_SYSCONFIG = init.d/sysconfig.xendomains -XENCOMMONS_INITD = init.d/xencommons +XEN_INIT_SCRIPTS += xencommons XENCOMMONS_SYSCONFIG = init.d/sysconfig.xencommons # Xen script dir and scripts to go there. @@ -45,11 +46,15 @@ install: all install-initd install-scripts install-udev install-initd: [ -d $(DESTDIR)$(INITD_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(INITD_DIR) [ -d $(DESTDIR)$(SYSCONFIG_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(SYSCONFIG_DIR) - $(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)$(INITD_DIR) + set -e; for i in $(XEN_INIT_SCRIPTS); \ + do \ + o="$(DESTDIR)$(INITD_DIR)/$$i"; \ + sed 's|@@XEN_SCRIPT_DIR@@|$(XEN_SCRIPT_DIR)|g' \ + init.d/$$i > "$$o"; \ + chmod 755 "$$o"; \ + done $(INSTALL_DATA) $(XENDOMAINS_SYSCONFIG) $(DESTDIR)$(SYSCONFIG_DIR)/xendomains - $(INSTALL_PROG) $(XENCOMMONS_INITD) $(DESTDIR)$(INITD_DIR) $(INSTALL_DATA) $(XENCOMMONS_SYSCONFIG) $(DESTDIR)$(SYSCONFIG_DIR)/xencommons - $(INSTALL_PROG) init.d/xen-watchdog $(DESTDIR)$(INITD_DIR) .PHONY: install-scripts install-scripts: @@ -57,11 +62,17 @@ install-scripts: $(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR) set -e; for i in $(XEN_SCRIPTS); \ do \ - $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \ + o="$(DESTDIR)$(XEN_SCRIPT_DIR)/$$i"; \ + sed 's|@@XEN_SCRIPT_DIR@@|$(XEN_SCRIPT_DIR)|g' \ + $$i > "$$o"; \ + chmod 755 "$$o"; \ done set -e; for i in $(XEN_SCRIPT_DATA); \ do \ - $(INSTALL_DATA) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \ + o="$(DESTDIR)$(XEN_SCRIPT_DIR)/$$i"; \ + sed 's|@@XEN_SCRIPT_DIR@@|$(XEN_SCRIPT_DIR)|g' \ + $$i > "$$o"; \ + chmod 644 "$$o"; \ done .PHONY: install-udev @@ -70,7 +81,10 @@ install-udev: $(INSTALL_DIR) $(DESTDIR)$(UDEV_RULES_DIR)/rules.d set -e; for i in $(UDEV_RULES); \ do \ - $(INSTALL_DATA) $$i $(DESTDIR)$(UDEV_RULES_DIR)/rules.d; \ + o="$(DESTDIR)$(UDEV_RULES_DIR)/rules.d/$$i"; \ + sed 's|@@XEN_SCRIPT_DIR@@|$(XEN_SCRIPT_DIR)|g' \ + $$i > "$$o"; \ + chmod 644 "$$o"; \ done .PHONY: clean diff --git a/tools/hotplug/Linux/init.d/xen-watchdog b/tools/hotplug/Linux/init.d/xen-watchdog index 3592fda..d0d7966 100644 --- a/tools/hotplug/Linux/init.d/xen-watchdog +++ b/tools/hotplug/Linux/init.d/xen-watchdog @@ -17,7 +17,7 @@ ### END INIT INFO # -. /etc/xen/scripts/hotplugpath.sh +. @@XEN_SCRIPT_DIR@@/hotplugpath.sh DAEMON=${SBINDIR}/xenwatchdogd base=$(basename $DAEMON) diff --git a/tools/hotplug/Linux/init.d/xencommons b/tools/hotplug/Linux/init.d/xencommons index 4ebd636..c62bdb8 100644 --- a/tools/hotplug/Linux/init.d/xencommons +++ b/tools/hotplug/Linux/init.d/xencommons @@ -18,7 +18,7 @@ # Description: Starts and stops the daemons neeeded for xl/xend ### END INIT INFO -. /etc/xen/scripts/hotplugpath.sh +. @@XEN_SCRIPT_DIR@@/hotplugpath.sh if [ -d /etc/sysconfig ]; then xencommons_config=/etc/sysconfig diff --git a/tools/hotplug/Linux/init.d/xendomains b/tools/hotplug/Linux/init.d/xendomains index 59f1e3d..66f3f9a 100644 --- a/tools/hotplug/Linux/init.d/xendomains +++ b/tools/hotplug/Linux/init.d/xendomains @@ -27,7 +27,7 @@ # boots / shuts down. ### END INIT INFO -. /etc/xen/scripts/hotplugpath.sh +. @@XEN_SCRIPT_DIR@@/hotplugpath.sh CMD=${SBINDIR}/xm HEADCOMP="LinuxGuestRecord" diff --git a/tools/hotplug/Linux/vif-setup b/tools/hotplug/Linux/vif-setup index bcc462e..ce1ba56 100644 --- a/tools/hotplug/Linux/vif-setup +++ b/tools/hotplug/Linux/vif-setup @@ -4,6 +4,6 @@ if test "$script" then exec $script $* else - exec /etc/xen/scripts/vif-bridge $* + exec @@XEN_SCRIPT_DIR@@/vif-bridge $* fi diff --git a/tools/hotplug/Linux/xen-backend.rules b/tools/hotplug/Linux/xen-backend.rules index a0d409e..8e01533 100644 --- a/tools/hotplug/Linux/xen-backend.rules +++ b/tools/hotplug/Linux/xen-backend.rules @@ -1,10 +1,10 @@ -SUBSYSTEM=="xen-backend", KERNEL=="tap*", ENV{UDEV_CALL}="1", RUN+="/etc/xen/scripts/blktap $env{ACTION}" -SUBSYSTEM=="xen-backend", KERNEL=="vbd*", ENV{UDEV_CALL}="1", RUN+="/etc/xen/scripts/block $env{ACTION}" -SUBSYSTEM=="xen-backend", KERNEL=="vif2-*", RUN+="/etc/xen/scripts/vif2 $env{ACTION}" -SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ENV{UDEV_CALL}="1", ACTION=="online", RUN+="/etc/xen/scripts/vif-setup online type_if=vif" -SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ENV{UDEV_CALL}="1", ACTION=="offline", RUN+="/etc/xen/scripts/vif-setup offline type_if=vif" -SUBSYSTEM=="xen-backend", KERNEL=="vscsi*", RUN+="/etc/xen/scripts/vscsi $env{ACTION}" -SUBSYSTEM=="xen-backend", ACTION=="remove", ENV{UDEV_CALL}="1", RUN+="/etc/xen/scripts/xen-hotplug-cleanup" +SUBSYSTEM=="xen-backend", KERNEL=="tap*", ENV{UDEV_CALL}="1", RUN+="@@XEN_SCRIPT_DIR@@/blktap $env{ACTION}" +SUBSYSTEM=="xen-backend", KERNEL=="vbd*", ENV{UDEV_CALL}="1", RUN+="@@XEN_SCRIPT_DIR@@/block $env{ACTION}" +SUBSYSTEM=="xen-backend", KERNEL=="vif2-*", RUN+="@@XEN_SCRIPT_DIR@@/vif2 $env{ACTION}" +SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ENV{UDEV_CALL}="1", ACTION=="online", RUN+="@@XEN_SCRIPT_DIR@@/vif-setup online type_if=vif" +SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ENV{UDEV_CALL}="1", ACTION=="offline", RUN+="@@XEN_SCRIPT_DIR@@/vif-setup offline type_if=vif" +SUBSYSTEM=="xen-backend", KERNEL=="vscsi*", RUN+="@@XEN_SCRIPT_DIR@@/vscsi $env{ACTION}" +SUBSYSTEM=="xen-backend", ACTION=="remove", ENV{UDEV_CALL}="1", RUN+="@@XEN_SCRIPT_DIR@@/xen-hotplug-cleanup" KERNEL=="evtchn", NAME="xen/%k" SUBSYSTEM=="xen", KERNEL=="blktap[0-9]*", NAME="xen/%k", MODE="0600" SUBSYSTEM=="blktap2", KERNEL=="blktap[0-9]*", NAME="xen/blktap-2/%k", MODE="0600" @@ -12,4 +12,4 @@ KERNEL=="blktap-control", NAME="xen/blktap-2/control", MODE="0600" KERNEL=="gntdev", NAME="xen/%k", MODE="0600" KERNEL=="pci_iomul", NAME="xen/%k", MODE="0600" KERNEL=="tapdev[a-z]*", NAME="xen/blktap-2/tapdev%m", MODE="0600" -SUBSYSTEM=="net", KERNEL=="vif*-emu", ACTION=="add", ENV{UDEV_CALL}="1", RUN+="/etc/xen/scripts/vif-setup $env{ACTION} type_if=tap" +SUBSYSTEM=="net", KERNEL=="vif*-emu", ACTION=="add", ENV{UDEV_CALL}="1", RUN+="@@XEN_SCRIPT_DIR@@/vif-setup $env{ACTION} type_if=tap" diff --git a/tools/hotplug/Linux/xen-hotplug-common.sh b/tools/hotplug/Linux/xen-hotplug-common.sh index 7af4688..8128b9e 100644 --- a/tools/hotplug/Linux/xen-hotplug-common.sh +++ b/tools/hotplug/Linux/xen-hotplug-common.sh @@ -112,7 +112,7 @@ xenstore_write() { # Execute each hook in the <hook> directory. # call_hooks() { - for f in /etc/xen/scripts/${1}-${2}.d/*.hook; do + for f in @@XEN_SCRIPT_DIR@@/${1}-${2}.d/*.hook; do if [ -x "$f" ]; then . "$f"; fi done } _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |