From dd8a93e0d8d4db1810e8d0bc438c19c97876b810 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 25 Dec 2011 20:41:52 +0100 Subject: [PATCH] make: introduce --with-rootprefix= --- INSTALL | 23 ++++---- Makefile.am | 22 ++++++-- NEWS | 22 ++++---- autogen.sh | 8 ++- configure.ac | 8 ++- extras/keymap/check-keymaps.sh | 2 +- extras/keymap/findkeyboards | 4 +- extras/keymap/keyboard-force-release.sh.in | 2 +- test/.gitignore | 2 + test/rules-test.sh | 2 +- test/{udev-test.pl => udev-test.pl.in} | 64 +++++++++++----------- udev/test-udev.c | 4 ++ 12 files changed, 98 insertions(+), 65 deletions(-) mode change 100644 => 100755 extras/keymap/keyboard-force-release.sh.in create mode 100644 test/.gitignore rename test/{udev-test.pl => udev-test.pl.in} (93%) diff --git a/INSTALL b/INSTALL index 29620005..5fa900b1 100644 --- a/INSTALL +++ b/INSTALL @@ -20,26 +20,25 @@ The options used in a RPM spec file look like: The options to install udev in the rootfs instead of /usr, and udevadm in /sbin: - --bindir=/sbin - --libexecdir=/lib/udev - --with-systemdsystemunitdir=/lib/systemd/system - --with-rootlibdir=/lib64 + --prefix=%{_prefix} \ + --with-rootprefix= \ + --sysconfdir=%{_sysconfdir} \ + --bindir=/sbin \ + --libdir=%{_libdir} \ + --with-rootlibdir=/lib64 \ + --libexecdir=/lib/udev \ + --with-systemdsystemunitdir=/lib/systemd/system \ + --with-selinux Some tools expect udevadm in 'sbin'. A symlink to udevadm in 'bin' needs to be manually created if needed. The defined location for scripts and binaries which are called -from rules is /usr/lib/udev/ on all systems and architectures. Any +from rules is (/usr)/lib/udev/ on all systems and architectures. Any other location will break other packages, who rightfully expect -the /usr/lib/udev/ directory, to install their rule helper and udev +the (/usr)/lib/udev/ directory, to install their rule helper and udev rule files. -It is possible to use the /usr/lib/udev/devices/ directory to place -device nodes, directories and symlinks, which are copied to /dev/ -at every bootup. That way, nodes for devices which can not be -detected automatically, or are activated on-demand by opening the -pre-existing device node, will be available. - Default udev rules and persistent device naming rules may be required by other software that depends on the data udev collects from the devices. diff --git a/Makefile.am b/Makefile.am index 769a6f50..a7f29676 100644 --- a/Makefile.am +++ b/Makefile.am @@ -40,9 +40,10 @@ libexec_SCRIPTS = dist_libexec_SCRIPTS = SED_PROCESS = \ -$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \ + $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \ -e 's,@VERSION\@,$(VERSION),g' \ -e 's,@prefix\@,$(prefix),g' \ + -e 's,@rootprefix\@,$(rootprefix),g' \ -e 's,@exec_prefix\@,$(exec_prefix),g' \ -e 's,@libdir\@,$(libdir),g' \ -e 's,@includedir\@,$(includedir),g' \ @@ -56,11 +57,16 @@ $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \ %.rules: %.rules.in Makefile $(SED_PROCESS) -%.service: %.service.in +%.service: %.service.in Makefile $(SED_PROCESS) -%.sh: %.sh.in +%.sh: %.sh.in Makefile $(SED_PROCESS) + $(AM_V_GEN)chmod +x $@ + +%.pl: %.pl.in Makefile + $(SED_PROCESS) + $(AM_V_GEN)chmod +x $@ # ------------------------------------------------------------------------------ # libudev @@ -271,7 +277,15 @@ udev/%.html : udev/%.xml # ------------------------------------------------------------------------------ # udev tests # ------------------------------------------------------------------------------ -TESTS = test/udev-test.pl test/rules-test.sh +TESTS = \ + test/udev-test.pl \ + test/rules-test.sh + +EXTRA_DIST += \ + test/udev-test.pl.in + +CLEANFILES += \ + test/udev-test.pl check_PROGRAMS = \ libudev/test-libudev \ diff --git a/NEWS b/NEWS index 11b38831..b87d3721 100644 --- a/NEWS +++ b/NEWS @@ -1,22 +1,24 @@ udev 175 ======== -The default install location moved from /lib/udev to /usr/lib/udev, -to support systems without the / vs. /usr split. --libexecdir= -can still be configured to install things to /lib/udev. +The default configure options have changed, packages need to be adapted +otherwise udev will be installed in /usr. Example configuration options +are in INSTALL. + +The default prefix moved from / to /usr to support installations without +the historic / vs. /usr split. The default install location of the 'udevadm' tool moved from 'sbin' -to /usr/bin. --bindir= can still be configured to install it in -/sbin. Some tools expect udevadm in 'sbin'. A symlink to udevadm -in /usr/bin needs to be manually created if needed. +to /usr/bin. Some tools expect udevadm in 'sbin'. A symlink to udevadm +needs to be manually created if needed. Kernel modules are now loaded directly by linking udev to 'libkmod'. -The /sbin/modprobe tool is no longer executed by udev. +The 'modprobe' tool is no longer executed by udev. -The /sbin/blkid tool is no longer executed from udev rules. Udev links +The 'blkid' tool is no longer executed from udev rules. Udev links directly to libblkid now. -Firmware is loaded natively by udev now, the external firmware loading -binary is no longer used. +Firmware is loaded natively by udev now, the external 'firmware' binary +is no longer used. All built-in tools can be listed and tested with 'udevadm test-builtin'. diff --git a/autogen.sh b/autogen.sh index 50923f0a..683c4980 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,4 +1,6 @@ -#!/bin/sh -e +#!/usr/bin/env sh + +set -e gtkdocize autoreconf --install --symlink @@ -7,7 +9,9 @@ libdir() { echo $(cd $1/$(gcc -print-multi-os-directory); pwd) } -args="--prefix=/usr \ +args="\ +--prefix=/usr \ +--with-rootprefix= \ --sysconfdir=/etc \ --bindir=/sbin \ --libdir=$(libdir /usr/lib) \ diff --git a/configure.ac b/configure.ac index 723c0cbc..a9ba74c1 100644 --- a/configure.ac +++ b/configure.ac @@ -23,6 +23,11 @@ AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([POSIX RT library not fo PKG_CHECK_MODULES(BLKID, blkid >= 2.20) PKG_CHECK_MODULES(KMOD, libkmod >= 2) +AC_ARG_WITH([rootprefix], + AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]), + [], [with_rootprefix=$prefix]) +AC_SUBST([rootprefix], [$with_rootprefix]) + AC_ARG_WITH([rootlibdir], AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]), [], [with_rootlibdir=$libdir]) @@ -56,7 +61,7 @@ AS_IF([test "x$enable_logging" = "xyes"], [ AC_DEFINE(ENABLE_LOGGING, [1], [Syst AC_ARG_WITH(firmware-path, AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]], [Firmware search path (default=/lib/firmware/updates:/lib/firmware)]), - [], [with_firmware_path="/lib/firmware/updates:/lib/firmware"]) + [], [with_firmware_path="$rootprefix/lib/firmware/updates:$rootprefix/lib/firmware"]) OLD_IFS=$IFS IFS=: for i in $with_firmware_path; do @@ -224,6 +229,7 @@ AC_MSG_RESULT([ ======== prefix: ${prefix} + rootprefix: ${rootprefix} sysconfdir: ${sysconfdir} bindir: ${bindir} libdir: ${libdir} diff --git a/extras/keymap/check-keymaps.sh b/extras/keymap/check-keymaps.sh index df18c3f4..350a8571 100755 --- a/extras/keymap/check-keymaps.sh +++ b/extras/keymap/check-keymaps.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # check that all key names in keymaps/* are known in # and that all key maps listed in the rules are valid and present in diff --git a/extras/keymap/findkeyboards b/extras/keymap/findkeyboards index 537d1631..eba3737a 100755 --- a/extras/keymap/findkeyboards +++ b/extras/keymap/findkeyboards @@ -1,4 +1,4 @@ -#!/bin/sh -e +#!/usr/bin/env sh # Find "real" keyboard devices and print their device path. # Author: Martin Pitt # @@ -14,6 +14,8 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. +set -e + # returns OK if $1 contains $2 strstr() { [ "${1#*$2*}" != "$1" ] diff --git a/extras/keymap/keyboard-force-release.sh.in b/extras/keymap/keyboard-force-release.sh.in old mode 100644 new mode 100755 index 05dd5da2..ce91a154 --- a/extras/keymap/keyboard-force-release.sh.in +++ b/extras/keymap/keyboard-force-release.sh.in @@ -1,4 +1,4 @@ -#!/bin/sh -e +#!@rootprefix@/bin/sh -e # read list of scancodes, convert hex to decimal and # append to the atkbd force_release sysfs attribute # $1 sysfs devpath for serioX diff --git a/test/.gitignore b/test/.gitignore new file mode 100644 index 00000000..8d662eaf --- /dev/null +++ b/test/.gitignore @@ -0,0 +1,2 @@ +udev-test.pl + diff --git a/test/rules-test.sh b/test/rules-test.sh index b98b69ab..511f05d9 100755 --- a/test/rules-test.sh +++ b/test/rules-test.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env sh # Call the udev rule syntax checker on all rules that we ship # # (C) 2010 Canonical Ltd. diff --git a/test/udev-test.pl b/test/udev-test.pl.in similarity index 93% rename from test/udev-test.pl rename to test/udev-test.pl.in index c2dc70ef..0befc7b5 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl.in @@ -227,7 +227,7 @@ EOF devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "aaa", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node12345678", rules => < "special-device-5" , not_exp_name => "not" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "newline_removed" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "test-0:0:0:0" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "foo9" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "bar9" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "foo7" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "my-foo9" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "my-foo8" , rules => < "/devices/virtual/tty/console", exp_name => "TTY", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "scsi-0:0:0:0" , rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "test", rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "test", rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "this", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "test", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "link1", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "link4", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", rules => < "nonzero-program", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "sane", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "uber", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "replaced", rules => < "testsymlink2", exp_target => "ok2", rules => < "parent", option => "keep", rules => < "yes", rules => < "yes", rules => < "sda-8741C4G-end", exp_perms => "0:0:0600", rules => <