From: Jeremy Katz Subject: Re: [PATCH] support udev or hotplug based on the system [3/3] Date: Thu, 06 Oct 2005 15:10:04 -0400 Message-ID: <1128625804.12602.26.camel@bree.local.net> References: <1128612422.12602.21.camel@bree.local.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-PzRhLxdq8n6+RxFy8g5o" Return-path: In-Reply-To: <1128612422.12602.21.camel@bree.local.net> 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 --=-PzRhLxdq8n6+RxFy8g5o Content-Type: text/plain Content-Transfer-Encoding: 7bit On Thu, 2005-10-06 at 11:27 -0400, Jeremy Katz wrote: > Add installation of the udev rules if appropriate. With a normal 'make > install', the udev rules will be installed if udev version is >= 059; > otherwise, the hotplug rules get installed. And Hollis tells me I forgot the patch... where's my psychic email program? :) Jeremy --=-PzRhLxdq8n6+RxFy8g5o 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: --=-PzRhLxdq8n6+RxFy8g5o 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 --=-PzRhLxdq8n6+RxFy8g5o--