Skip to contentSkip to conversation

tools: Update init scripts

PATCH New Christoph Egger 1 participant 1 message Jun 8, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: Update init scripts

Hi!

Attached patch adds init scripts for NetBSD to be in line with changes in c/s 21549 and 21552.

While here, fix installation into non-default install directories for bash-completion files, tap-ctl and vif-setup.

Also fix compilation of blktap2: <sys/time.h> is needed for 'struct timeval' and get rid of non-portable <linux/major.h>

Signature · 6 lines
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Andrew Bowd, Thomas M. McCoy, Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
Config.mk +4 -2
diff -r 10776eef6fd9 Config.mk
@@ -29,7 +29,7 @@ include $(XEN_ROOT)/config/$(XEN_TARGET_
 SHAREDIR    ?= $(PREFIX)/share
 DOCDIR      ?= $(SHAREDIR)/doc/xen
 MANDIR      ?= $(SHAREDIR)/man
-BASH_COMPLETION_DIR ?= /etc/bash_completion.d
+BASH_COMPLETION_DIR ?= $(CONFIG_DIR)/bash_completion.d
 
 ifneq ($(EXTRA_PREFIX),)
 EXTRA_INCLUDES += $(EXTRA_PREFIX)/include
@@ -111,7 +111,9 @@ define buildmakevars2file-closure
 	echo "PRIVATE_BINDIR=\"$(PRIVATE_BINDIR)\"" >> $(1);           \
 	echo "XENFIRMWAREDIR=\"$(XENFIRMWAREDIR)\"" >> $(1);           \
 	echo "XEN_CONFIG_DIR=\"$(XEN_CONFIG_DIR)\"" >> $(1);           \
-	echo "XEN_SCRIPT_DIR=\"$(XEN_SCRIPT_DIR)\"" >> $(1)
+	echo "XEN_SCRIPT_DIR=\"$(XEN_SCRIPT_DIR)\"" >> $(1);           \
+	echo "XEN_RCD_DIR=\"$(XEN_RCD_DIR)\"" >> $(1);                 \
+	echo "PYTHONPATH=\"$(LIBDIR)/$(PYTHON)/site-packages\"" >> $(1)
 endef
 
 ifeq ($(debug),y)
config/Linux.mk +4 -0
diff -r 10776eef6fd9 config/Linux.mk
@@ -10,3 +10,7 @@ endif
 XKERNELS := $(foreach kernel, $(KERNELS), \
               $(patsubst buildconfigs/mk.%,%, \
                 $(wildcard buildconfigs/mk.$(kernel))) )
+
+# Some distros have /etc/rc.d (e.g. Slackware) while others
+# have /etc/init.d (e.g. SuSE)
+XEN_RCD_DIR = $(CONFIG_DIR)/$(shell test -d /etc/rc.d && echo "rc.d" || echo "init.d")
config/NetBSD.mk +2 -0
diff -r 10776eef6fd9 config/NetBSD.mk
@@ -7,6 +7,8 @@ LIBLEAFDIR_x86_64 = lib
 LIBEXEC = $(PREFIX)/libexec
 PRIVATE_BINDIR = $(BINDIR)
 
+XEN_RCD_DIR = $(CONFIG_DIR)/rc.d
+
 WGET = ftp
tools/blktap2/control/Makefile +2 -3
diff -r 10776eef6fd9 tools/blktap2/control/Makefile
@@ -2,7 +2,6 @@ XEN_ROOT := ../../../
 include $(XEN_ROOT)/tools/Rules.mk
 
 IBIN               = tap-ctl
-INST_DIR           = /usr/sbin
 
 CFLAGS            += -Werror
 CFLAGS            += -Wno-unused
@@ -45,8 +44,8 @@ libblktapctl.a: $(CTL_OBJS)
 	ar r $@ $^
 
 install: all
-	$(INSTALL_DIR) -p $(DESTDIR)$(INST_DIR)
-	$(INSTALL_PROG) $(IBIN) $(DESTDIR)$(INST_DIR)
+	$(INSTALL_DIR) -p $(DESTDIR)$(SBINDIR)
+	$(INSTALL_PROG) $(IBIN) $(DESTDIR)$(SBINDIR)
 
 clean:
 	rm -f $(OBJS) $(DEPS) $(IBIN) $(LIBS)
tools/blktap2/control/tap-ctl-allocate.c +1 -2
diff -r 10776eef6fd9 tools/blktap2/control/tap-ctl-allocate.c
@@ -36,7 +36,6 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/ioctl.h>
-#include <linux/major.h>
 
 #include "tap-ctl.h"
 #include "blktap2.h"
@@ -140,7 +139,7 @@ tap_ctl_check_environment(void)
 	while (fscanf(f, "%d %256s", &minor, name) == 2)
 		if (!strcmp(name, BLKTAP2_CONTROL_NAME)) {
 			err = tap_ctl_make_device(BLKTAP2_CONTROL_DEVICE,
-						  MISC_MAJOR,
+						  0,
 						  minor, S_IFCHR | 0600);
 			goto out;
 		}
tools/blktap2/include/blktaplib.h +1 -0
diff -r 10776eef6fd9 tools/blktap2/include/blktaplib.h
@@ -33,6 +33,7 @@
 #define __BLKTAPLIB_H__
 
 #include <syslog.h>
+#include <sys/time.h>
 #include <xenctrl.h>
 #include <xen/io/blkif.h>
 
tools/hotplug/Linux/Makefile +4 -4
diff -r 10776eef6fd9 tools/hotplug/Linux/Makefile
@@ -64,12 +64,12 @@ install: all install-initd install-scrip
 
 .PHONY: install-initd
 install-initd:
-	[ -d $(DESTDIR)$(CONFIG_DIR)/init.d ] || $(INSTALL_DIR) $(DESTDIR)$(CONFIG_DIR)/init.d
+	[ -d $(DESTDIR)$(XEN_RCD_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(XEN_RCD_DIR)
 	[ -d $(DESTDIR)$(CONFIG_DIR)/sysconfig ] || $(INSTALL_DIR) $(DESTDIR)$(CONFIG_DIR)/sysconfig
-	$(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d
-	$(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d
+	$(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)$(CONFIG_DIR)/$(XEN_RCD_DIR)
+	$(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)$(CONFIG_DIR)/$(XEN_RCD_DIR)
 	$(INSTALL_PROG) $(XENDOMAINS_SYSCONFIG) $(DESTDIR)$(CONFIG_DIR)/sysconfig/xendomains
-	$(INSTALL_PROG) $(XENCOMMONS_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d
+	$(INSTALL_PROG) $(XENCOMMONS_INITD) $(DESTDIR)$(CONFIG_DIR)/$(XEN_RCD_DIR)
 	$(INSTALL_PROG) $(XENCOMMONS_SYSCONFIG) $(DESTDIR)$(CONFIG_DIR)/sysconfig/xencommons
 
 .PHONY: install-scripts
tools/hotplug/Linux/vif-setup +4 -1
diff -r 10776eef6fd9 tools/hotplug/Linux/vif-setup
@@ -1,9 +1,12 @@
 #!/bin/bash
 
+DIR=$(dirname "$0")
+. "${DIR}/hotplugpath.sh"
+
 if test "$script"
 then
     exec "$script" $*
 else
-    exec /etc/xen/scripts/vif-bridge $*
+    exec "${XEN_SCRIPT_DIR}/vif-bridge $*
 fi
 
tools/hotplug/NetBSD/Makefile +11 -1
diff -r 10776eef6fd9 tools/hotplug/NetBSD/Makefile
@@ -8,6 +8,7 @@ XEN_SCRIPTS += vif-bridge
 XEN_SCRIPTS += vif-ip
 
 XEN_SCRIPT_DATA =
+XEN_RCD_PROG = rc.d/xencommons rc.d/xend rc.d/xendomains
 
 .PHONY: all
 all:
@@ -16,7 +17,7 @@ all:
 build:
 
 .PHONY: install
-install: all install-scripts
+install: all install-scripts install-rcd
 
 .PHONY: install-scripts
 install-scripts:
@@ -30,5 +31,14 @@ install-scripts:
 	   $(INSTALL_DATA) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \
 	done
 
+.PHONY: install-rcd
+install-rcd:
+	$(INSTALL_DIR) $(DESTDIR)$(XEN_RCD_DIR)
+	set -e; for i in $(XEN_RCD_PROG); \
+	   do \
+	   $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_RCD_DIR); \
+	done
+	$(INSTALL_DATA) ../common/hotplugpath.sh $(DESTDIR)$(XEN_RCD_DIR)/xen-hotplugpath.sh
+
 .PHONY: clean
 clean:
tools/hotplug/NetBSD/rc.d/xencommons new file +124 -0

124 lines not on this page · raw message

tools/hotplug/NetBSD/rc.d/xend new file +21 -0
diff -r 10776eef6fd9 tools/hotplug/NetBSD/rc.d/xend
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+# PROVIDE: xend
+# REQUIRE: xencommons
+
+. /etc/rc.subr
+
+DIR=$(dirname "$0")
+. "${DIR}/xen-hotplugpath.sh"
+
+LD_LIBRARY_PATH="${LIBDIR}"
+export LD_LIBRARY_PATH PYTHONPATH
+
+name="xend"
+rcvar=$name
+command="${SBINDIR}/xend"
+start_cmd="echo Starting ${name}. && PATH=${PATH}:${SBINDIR} ${command} start"
+pidfile="/var/run/xend.pid"
+
+load_rc_config $name
+run_rc_command "$1"
tools/hotplug/NetBSD/rc.d/xendomains new file +133 -0

133 lines not on this page · raw message

tools/misc/Makefile +2 -2
diff -r 10776eef6fd9 tools/misc/Makefile
@@ -39,10 +39,10 @@ build: $(TARGETS)
 install: build
 	$(INSTALL_DIR) $(DESTDIR)$(BINDIR)
 	$(INSTALL_DIR) $(DESTDIR)$(SBINDIR)
-	$(INSTALL_DIR) $(DESTDIR)$(CONFIG_DIR)/init.d
+	$(INSTALL_DIR) $(DESTDIR)$(XEN_RCD_DIR)
 	$(INSTALL_PYTHON_PROG) $(INSTALL_BIN) $(DESTDIR)$(BINDIR)
 	$(INSTALL_PYTHON_PROG) $(INSTALL_SBIN) $(DESTDIR)$(SBINDIR)
-	$(INSTALL_PROG) xen-watchdog $(DESTDIR)$(CONFIG_DIR)/init.d
+	$(INSTALL_PROG) xen-watchdog $(DESTDIR)$(XEN_RCD_DIR)
 	set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d install-recurse; done
 
 .PHONY: clean

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel