Now that Bryan has documented the udev rules, I was thinking that we
should install them. They're much better off on disk then in the
tarball.

We could just add a command to the book to do it, but then I figured a
Makefile would be nice. So, I've attached a diff that adds some simple
Makefiles to the udev-config directories.

The usage would be:

make install # installs rules in /etc/udev/rules.d
make install-doc # installs doc files in /usr/share/doc/udev-$(UDEV_VERSION)

The sucky part is that I couldn't figure out how to query the udev
version from the installed files, so it's just a hardcoded variable in
the Makefile. This might not be so bad, though, since this value would
also indicate which udev version the rules are compatible/tested with.

Thoughts? The Makefile details can definitely be changed. I just want
to see what people's thoughts are on the installation.

--
Dan
Index: udev-config/doc/Makefile
===================================================================
--- udev-config/doc/Makefile	(revision 0)
+++ udev-config/doc/Makefile	(revision 0)
@@ -0,0 +1,24 @@
+# Makefile to install udev rules and documentation
+
+UDEV_VERSION = 101
+RULES_DIR = /etc/udev/rules.d
+DOC_DIR = /usr/share/doc/udev-$(UDEV_VERSION)
+INSTALL = /usr/bin/install
+INSTALL_DATA = $(INSTALL) -m644
+DOC_FILES = \
+	05-udev-early.txt \
+	25-lfs.txt \
+	26-modprobe.txt \
+	27-firmware.txt \
+	60-persistent-input.txt \
+	60-persistent-storage.txt \
+	81-cdrom.txt \
+	95-udev-late.txt
+
+all:
+
+install-doc:
+	$(INSTALL) -d $(DESTDIR)$(DOC_DIR)
+	for doc in $(DOC_FILES); do \
+		$(INSTALL_DATA) $$doc $(DESTDIR)$(DOC_DIR) || exit 1; \
+	done;
Index: udev-config/Makefile
===================================================================
--- udev-config/Makefile	(revision 0)
+++ udev-config/Makefile	(revision 0)
@@ -0,0 +1,29 @@
+# Makefile to install udev rules and documentation
+
+UDEV_VERSION = 101
+RULES_DIR = /etc/udev/rules.d
+DOC_DIR = /usr/share/doc/udev-$(UDEV_VERSION)
+INSTALL = /usr/bin/install
+INSTALL_DATA = $(INSTALL) -m644
+RULES_FILES = \
+	05-udev-early.rules \
+	25-lfs.rules \
+	26-modprobe.rules \
+	27-firmware.rules \
+	60-persistent-input.rules \
+	60-persistent-storage.rules \
+	81-cdrom.rules \
+	95-udev-late.rules
+
+all:
+
+install: install-rules
+
+install-rules:
+	$(INSTALL) -d $(DESTDIR)$(RULES_DIR)
+	for rule in $(RULES_FILES); do \
+		$(INSTALL_DATA) $$rule $(DESTDIR)$(RULES_DIR) || exit 1; \
+	done;
+
+install-doc:
+	$(MAKE) -C doc $@ || exit 1
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to