From: Jeremy Katz Subject: [PATCH] support udev or hotplug based on the system [2/3] Date: Thu, 06 Oct 2005 11:27:01 -0400 Message-ID: <1128612421.12602.20.camel@bree.local.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-5zsAw+uuIDoN3zr5+i9H" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org --=-5zsAw+uuIDoN3zr5+i9H Content-Type: text/plain Content-Transfer-Encoding: 7bit Add udev rules that map similar to the hotplug agent. Based off of what Chris Bainbridge posted the end of last week but doing things as directly as possible. Signed-off-by: Jeremy Katz Jeremy --=-5zsAw+uuIDoN3zr5+i9H Content-Disposition: attachment; filename=xen-udev-dist-install.patch Content-Type: text/x-patch; name=xen-udev-dist-install.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit unchanged: --- a/Makefile Thu Oct 6 03:31:41 2005 +++ b/Makefile Thu Oct 6 04:36:33 2005 @@ -36,16 +36,25 @@ $(MAKE) -C tools build $(MAKE) -C docs build -# build and install everything into local dist directory -dist: DESTDIR=$(DISTDIR)/install -dist: dist-xen dist-kernels dist-tools dist-docs +# build and install everything into local dist directory. +dist: + @make XEN_BUILD_DIST=1 realdist +dist-%: + @make XEN_BUILD_DIST=1 realdist-`echo -n $@ | sed -e 's/dist-//'` + +# these are the real targets, but we need to set a variable so that +# everything will be installed to the distdir (making the tarball complete +# for any distribution) +realdist: DESTDIR=$(DISTDIR)/install +realdist: dist-xen dist-kernels dist-tools dist-docs $(INSTALL_DIR) $(DISTDIR)/check $(INSTALL_DATA) ./COPYING $(DISTDIR) $(INSTALL_DATA) ./README $(DISTDIR) $(INSTALL_PROG) ./install.sh $(DISTDIR) $(INSTALL_PROG) tools/check/chk tools/check/check_* $(DISTDIR)/check -dist-%: DESTDIR=$(DISTDIR)/install -dist-%: install-% +realdist-%: DESTDIR=$(DISTDIR)/install +realdist-%: install-% + export XEN_BUILD_DIST=1 @: # do nothing # Legacy dist targets diff -u b/install.sh b/install.sh --- b/install.sh Thu Oct 6 04:36:33 2005 +++ b/install.sh Thu Oct 6 15:23:14 2005 @@ -24,8 +24,14 @@ echo "Installing Xen from '$src' to '$dst'..." -(cd $src; tar -cf - --exclude etc/init.d * ) | tar -C $dst -xf - +(cd $src; tar -cf - --exclude etc/init.d --exclude etc/hotplug --exclude etc/udev * ) | tar -C $dst -xf - cp -fdRL $src/etc/init.d/* $dst/etc/init.d/ echo "All done." +if [ -x /sbin/udev ] && [ `/sbin/udev -V` -ge 059 ]; then + cp -f $src/etc/udev/rules.d/xen-backend.rules $dst/etc/udev/rules.d/xen-backend.rules +else + cp -f $src/etc/hotplug/xen-backend.agent $dst/etc/hotplug/xen-backend.agent +fi + echo "Checking to see whether prerequisite tools are installed..." cd $src/../check unchanged: --- a/tools/check/check_hotplug Thu Oct 6 03:31:41 2005 +++ b/tools/check/check_hotplug Thu Oct 6 04:36:33 2005 @@ -7,4 +7,7 @@ exit 1 } +if [ -x /sbin/udev ] && [ `udev -V` -ge 059 ]; then + exit 0 +fi which hotplug 1>/dev/null 2>&1 || error diff -u b/tools/examples/Makefile b/tools/examples/Makefile --- b/tools/examples/Makefile Thu Oct 6 04:36:33 2005 +++ b/tools/examples/Makefile Thu Oct 6 15:23:14 2005 @@ -28,10 +28,23 @@ XEN_HOTPLUG_DIR = /etc/hotplug XEN_HOTPLUG_SCRIPTS = xen-backend.agent +UDEV_RULES_DIR = /etc/udev/rules.d +UDEV_RULES = xen-backend.rules + +ifeq (1, $(XEN_BUILD_DIST)) +HOTPLUGS=install-hotplug install-udev +else +ifeq (1,$(shell if [ -x /sbin/udev ] && [ `/sbin/udev -V` -ge 059 ]; then echo 1; fi)) +HOTPLUGS=install-udev +else +HOTPLUGS=install-hotplug +endif +endif + all: build: -install: all install-initd install-configs install-scripts install-hotplug +install: all install-initd install-configs install-scripts $(HOTPLUGS) install-initd: [ -d $(DESTDIR)/etc/init.d ] || $(INSTALL_DIR) $(DESTDIR)/etc/init.d @@ -66,2 +79,11 @@ +install-udev: + [ -d $(DESTDIR)$(UDEV_RULES_DIR) ] || \ + $(INSTALL_DIR) $(DESTDIR)$(UDEV_RULES_DIR) + for i in $(UDEV_RULES); \ + do \ + $(INSTALL_PROG) $$i $(DESTDIR)$(UDEV_RULES_DIR); \ + done + + clean: --=-5zsAw+uuIDoN3zr5+i9H Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-5zsAw+uuIDoN3zr5+i9H--