From: Kay Sievers Date: Thu, 1 Dec 2011 11:17:22 +0000 (+0100) Subject: use libexecdir, bindir, sbindir, switch to /usr/lib/udev in documentation X-Git-Tag: 176~61 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12a362be5c1982f80dbfb75bda070208a2c99cdf;p=systemd use libexecdir, bindir, sbindir, switch to /usr/lib/udev in documentation --- diff --git a/INSTALL b/INSTALL index 943a8a46..8ad69a43 100644 --- a/INSTALL +++ b/INSTALL @@ -1,30 +1,43 @@ -Usual options for udev installed in the root filesystem are: - ./configure \ +The options used used usually look like: + %configure \ --prefix=/usr \ --sysconfdir=/etc \ - --sbindir=/sbin \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ --libdir=/usr/lib64 \ - --with-rootlibdir=/lib64 \ - --libexecdir=/lib/udev \ + --libexecdir=/usr/lib/udev \ + --with-systemdsystemunitdir=/usr/lib/systemd/system \ --with-selinux -The options used in a RPM spec file usually look like: +The options used in a RPM spec file look like: %configure \ --prefix=%{_prefix} \ --sysconfdir=%{_sysconfdir} \ - --sbindir=/sbin \ + --bindir=%{_bindir} \ + --sbindir=%{_sbindir} \ --libdir=%{_libdir} \ - --with-rootlibdir=/%{_lib} \ - --libexecdir=/lib/udev \ + --libexecdir=%{_prefix}/lib/udev \ + --with-systemdsystemunitdir=%{_prefix}/lib/systemd/system \ --with-selinux +The options to install udev in the rootfs instead of /usr, +and udevadm in /sbin: + --bindir=/sbin + --sbindir=/sbin + --libexecdir=/lib/udev + --with-systemdsystemunitdir=/lib/systemd/system + --with-rootlibdir=/lib64 + +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 /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 /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 /lib/udev/devices/ directory to place +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 diff --git a/Makefile.am b/Makefile.am index 6a900b0a..acad5eca 100644 --- a/Makefile.am +++ b/Makefile.am @@ -114,14 +114,16 @@ EXTRA_DIST += \ udevrulesdir = $(libexecdir)/rules.d dist_udevrules_DATA = \ rules/rules.d/50-udev-default.rules \ - rules/rules.d/60-persistent-storage.rules \ rules/rules.d/60-persistent-storage-tape.rules \ rules/rules.d/60-persistent-serial.rules \ rules/rules.d/60-persistent-input.rules \ rules/rules.d/60-persistent-alsa.rules \ - rules/rules.d/80-drivers.rules \ rules/rules.d/95-udev-late.rules +udevrules_DATA = \ + rules/rules.d/60-persistent-storage.rules \ + rules/rules.d/80-drivers.rules + udevconfdir = $(sysconfdir)/udev dist_udevconf_DATA = udev.conf @@ -151,7 +153,7 @@ systemd-install-hook: INSTALL_DATA_HOOKS += systemd-install-hook endif -sbin_PROGRAMS = \ +bin_PROGRAMS = \ udev/udevadm libexec_PROGRAMS = \ diff --git a/NEWS b/NEWS index 344f21df..99d94e29 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,9 @@ udev 176 ======== +The udevadm tool moved from 'sbin' to 'bin'. Some tools expect +udevadm in 'sbin'. A symlink to udevadm in 'bin' needs to be +manually created if needed. + The systemd socket files use PassCred=yes, which requires systemd version 38. diff --git a/README b/README index 5a8d4cc0..0d25b84f 100644 --- a/README +++ b/README @@ -10,10 +10,10 @@ The upstream udev project's set of default rules may require a most recent kernel release to work properly. This is currently version 2.6.32. Tools and rules shipped by udev are not public API and may change at any time. -Never call any private tool in /lib/udev from any external application; it might -just go away in the next release. Access to udev information is only offered -by udevadm and libudev. Tools and rules in /lib/udev and the entire contents of -the /run/udev directory are private to udev and do change whenever needed. +Never call any private tool in /usr/lib/udev from any external application; it +might just go away in the next release. Access to udev information is only offered +by udevadm and libudev. Tools and rules in /usr/lib/udev and the entire contents +of the /run/udev directory are private to udev and do change whenever needed. Requirements: - Version 2.6.34 of the Linux kernel with sysfs, procfs, signalfd, inotify, @@ -72,8 +72,8 @@ Setup: - The udev daemon should be started to handle device events sent by the kernel. During bootup, the events for already existing devices can be replayed, so that they are configured by udev. This is usually done by: - /sbin/udevadm trigger --action=add --type=subsystems - /sbin/udevadm trigger --action=add --type=devices + udevadm trigger --action=add --type=subsystems + udevadm trigger --action=add --type=devices - Restarting the daemon never applies any rules to existing devices. diff --git a/TODO b/TODO index 1fd8eb26..661709aa 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,7 @@ + - move cc opts from autogen to configure.ac + + - move /lib/udev/devices/ to tmpfiles + - trigger --subsystem-match=usb/usb_device - test (now fixed) /dev/tape/ links diff --git a/autogen.sh b/autogen.sh index b6ffee72..ba956694 100755 --- a/autogen.sh +++ b/autogen.sh @@ -24,10 +24,11 @@ libdir() { args="--prefix=/usr \ --sysconfdir=/etc \ ---sbindir=/sbin \ +--bindir=/usr/bin \ +--sbindir=/usr/sbin \ --libdir=$(libdir /usr/lib) \ ---with-rootlibdir=$(libdir /lib) \ ---libexecdir=/lib/udev \ +--libexecdir=/usr/lib/udev \ +--with-systemdsystemunitdir=/usr/lib/systemd/system --with-selinux \ --enable-gtk-doc" diff --git a/configure.ac b/configure.ac index 2d90b544..df8d76d2 100644 --- a/configure.ac +++ b/configure.ac @@ -200,6 +200,9 @@ AM_CONDITIONAL([ENABLE_EDD], [test "x$enable_edd" = "xyes"]) AC_CONFIG_HEADERS(config.h) AC_CONFIG_FILES([ Makefile + extras/mtd_probe/75-probe_mtd.rules + rules/rules.d/80-drivers.rules + rules/rules.d/60-persistent-storage.rules udev/udev.pc systemd/udev.service systemd/udev-trigger.service @@ -210,6 +213,7 @@ AC_CONFIG_FILES([ extras/gudev/gudev-1.0.pc extras/gudev/docs/Makefile extras/gudev/docs/version.xml + extras/keymap/keyboard-force-release.sh ]) AC_OUTPUT @@ -219,7 +223,8 @@ AC_MSG_RESULT([ prefix: ${prefix} sysconfdir: ${sysconfdir} - sbindir: ${sbindir} + bindir: ${bindir} + sbindir: ${bindir} libdir: ${libdir} rootlibdir: ${rootlib_execdir} libexecdir: ${libexecdir} diff --git a/extras/keymap/.gitignore b/extras/keymap/.gitignore index f2c4c8dc..01d62e2b 100644 --- a/extras/keymap/.gitignore +++ b/extras/keymap/.gitignore @@ -1,6 +1,6 @@ +keyboard-force-release.sh keymap keys-from-name.gperf keys-from-name.h keys-to-name.h keys.txt - diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index 63cf67fb..79a1bc1c 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -5,10 +5,10 @@ # The atkbd driver has a quirk handler for generating synthetic # release events, which can be configured via sysfs since 2.6.32. # Simply add a file with a list of scancodes for your laptop model -# in /lib/udev/keymaps, and add a rule here. +# in /usr/lib/udev/keymaps, and add a rule here. # If the hotkeys also need a keymap assignment you can copy the # scancodes from the keymap file, otherwise you can run -# /lib/udev/keymap -i /dev/input/eventX +# /usr/lib/udev/keymap -i /dev/input/eventX # on a Linux vt to find out. ACTION=="remove", GOTO="force_release_end" diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 248c58f0..1ec18b7f 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -2,7 +2,7 @@ # # Key map overrides can be specified by either giving scancode/keyname pairs # directly as keymap arguments (if there are just one or two to change), or as -# a file name (in /lib/udev/keymaps), which has to contain scancode/keyname +# a file name (in /usr/lib/udev/keymaps), which has to contain scancode/keyname # pairs. ACTION=="remove", GOTO="keyboard_end" diff --git a/extras/keymap/README.keymap.txt b/extras/keymap/README.keymap.txt index 79d9971b..acdc0028 100644 --- a/extras/keymap/README.keymap.txt +++ b/extras/keymap/README.keymap.txt @@ -44,7 +44,7 @@ for inclusion you need to do the following steps: 1. Find the keyboard device. - Run /lib/udev/findkeyboards. This should always give you an "AT + Run /usr/lib/udev/findkeyboards. This should always give you an "AT keyboard" and possibly a "module". Some laptops (notably Thinkpads, Sonys, and Acers) have multimedia/function keys on a separate input device instead of the primary keyboard. The keyboard device should have a name like "input/event3". @@ -53,7 +53,7 @@ for inclusion you need to do the following steps: 2. Find broken scan codes: - sudo /lib/udev/keymap -i input/eventX + sudo /usr/lib/udev/keymap -i input/eventX Press all multimedia/function keys and check if the key name that gets printed out is plausible. If it is unknown or wrong, write down the scan code (looks @@ -67,14 +67,14 @@ for inclusion you need to do the following steps: 0x1E www # Fn+F2 web browser Repeat that for all other keys. Write the resulting list into a file. Look at - /lib/udev/keymaps/ for existing key map files and make sure that you use the + /usr/lib/udev/keymaps/ for existing key map files and make sure that you use the same structure. If the key only ever works once and then your keyboard (or the entire desktop) gets stuck for a long time, then it is likely that the BIOS fails to send a corresponding "key release" event after the key press event. Please note down this case as well, as it can be worked around in - /lib/udev/keymaps/95-keyboard-force-release.rules . + /usr/lib/udev/keymaps/95-keyboard-force-release.rules . 3. Find out your system vendor and product: @@ -87,8 +87,8 @@ for inclusion you need to do the following steps: and /tmp/udev-db.txt from step 4 to the linux-hotplug@vger.kernel.org mailing list, so that they can be included in the next release. -For local testing, copy your map file to /lib/udev/keymaps/ with an appropriate -name, and add an appropriate udev rule to /lib/udev/rules.d/95-keymap.rules: +For local testing, copy your map file to /usr/lib/udev/keymaps/ with an appropriate +name, and add an appropriate udev rule to /usr/lib/udev/rules.d/95-keymap.rules: * If you selected an "AT keyboard", add the rule to the section after 'LABEL="keyboard_vendorcheck"'. diff --git a/extras/keymap/keyboard-force-release.sh b/extras/keymap/keyboard-force-release.sh.in similarity index 89% rename from extras/keymap/keyboard-force-release.sh rename to extras/keymap/keyboard-force-release.sh.in index b157ac31..05dd5da2 100644 --- a/extras/keymap/keyboard-force-release.sh +++ b/extras/keymap/keyboard-force-release.sh.in @@ -6,7 +6,7 @@ case "$2" in /*) scf="$2" ;; - *) scf="/lib/udev/keymaps/force-release/$2" ;; + *) scf="@libexecdir@/keymaps/force-release/$2" ;; esac read attr <"/sys/$1/force_release" diff --git a/extras/mtd_probe/.gitignore b/extras/mtd_probe/.gitignore index 82b8ab50..70d3e831 100644 --- a/extras/mtd_probe/.gitignore +++ b/extras/mtd_probe/.gitignore @@ -1 +1,2 @@ mtd_probe +75-probe_mtd.rules diff --git a/extras/mtd_probe/75-probe_mtd.rules b/extras/mtd_probe/75-probe_mtd.rules.in similarity index 67% rename from extras/mtd_probe/75-probe_mtd.rules rename to extras/mtd_probe/75-probe_mtd.rules.in index 184fda58..2e28d37f 100644 --- a/extras/mtd_probe/75-probe_mtd.rules +++ b/extras/mtd_probe/75-probe_mtd.rules.in @@ -3,6 +3,6 @@ ACTION!="add", GOTO="mtd_probe_end" KERNEL=="mtd*ro", IMPORT{program}="mtd_probe $tempnode" -KERNEL=="mtd*ro", ENV{MTD_FTL}=="smartmedia", RUN+="/sbin/modprobe -bv sm_ftl" +KERNEL=="mtd*ro", ENV{MTD_FTL}=="smartmedia", RUN+="@sbindir@/modprobe -bv sm_ftl" LABEL="mtd_probe_end" diff --git a/extras/rule_generator/rule_generator.functions b/extras/rule_generator/rule_generator.functions index 4bec27a1..0f1b7385 100644 --- a/extras/rule_generator/rule_generator.functions +++ b/extras/rule_generator/rule_generator.functions @@ -15,10 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -PATH='/sbin:/bin' -# - -PATH='/sbin:/bin' +PATH='/usr/bin:/bin:/usr/sbin:/sbin' # Read a single line from file $1 in the $DEVPATH directory. # The function must not return an error even if the file does not exist. diff --git a/extras/scsi_id/.gitignore b/extras/scsi_id/.gitignore index 8372f681..10e9ae74 100644 --- a/extras/scsi_id/.gitignore +++ b/extras/scsi_id/.gitignore @@ -1,2 +1,3 @@ scsi_id +scsi_id.8 scsi_id_version.h diff --git a/extras/scsi_id/scsi_id.8 b/extras/scsi_id/scsi_id.8 index 0221b988..8f83f390 100644 --- a/extras/scsi_id/scsi_id.8 +++ b/extras/scsi_id/scsi_id.8 @@ -33,7 +33,7 @@ by page 0x80. For example: .sp .nf -# /lib/udev/scsi_id \-\-page=0x80 \-\-whitelisted \-\-device=/dev/sda +# /usr/lib/udev/scsi_id \-\-page=0x80 \-\-whitelisted \-\-device=/dev/sda SIBM 3542 1T05078453 .fi .P @@ -45,7 +45,7 @@ identifier starts with the NAA value of 6): .sp .nf -# /lib/udev/scsi_id \-\-page=0x83 \-\-whitelisted \-\-device=/dev/sda +# /usr/lib/udev/scsi_id \-\-page=0x83 \-\-whitelisted \-\-device=/dev/sda 3600a0b80000b174b000000d63efc5c8c .fi .P diff --git a/rules/.gitignore b/rules/.gitignore new file mode 100644 index 00000000..7240bd79 --- /dev/null +++ b/rules/.gitignore @@ -0,0 +1,2 @@ +rules.d/60-persistent-storage.rules +rules.d/80-drivers.rules diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules.in similarity index 95% rename from rules/rules.d/60-persistent-storage.rules rename to rules/rules.d/60-persistent-storage.rules.in index 894b50ba..47185386 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules.in @@ -66,12 +66,12 @@ ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PA ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end" # probe filesystem metadata of optical drives which have a media inserted -KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", IMPORT{program}="/sbin/blkid -o udev -p -u noraid -O $env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode" +KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", IMPORT{program}="@sbindir@/blkid -o udev -p -u noraid -O $env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode" # single-session CDs do not have ID_CDROM_MEDIA_SESSION_LAST_OFFSET -KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", IMPORT{program}="/sbin/blkid -o udev -p -u noraid $tempnode" +KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", IMPORT{program}="@sbindir@/blkid -o udev -p -u noraid $tempnode" # probe filesystem metadata of disks -KERNEL!="sr*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode" +KERNEL!="sr*", IMPORT{program}="@sbindir@/blkid -o udev -p $tempnode" # watch metadata changes by tools closing the device after writing KERNEL!="sr*", OPTIONS+="watch" diff --git a/rules/rules.d/80-drivers.rules b/rules/rules.d/80-drivers.rules deleted file mode 100644 index cf89735d..00000000 --- a/rules/rules.d/80-drivers.rules +++ /dev/null @@ -1,12 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION=="remove", GOTO="drivers_end" - -DRIVER!="?*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe -bv $env{MODALIAS}" -SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN+="/sbin/modprobe -bv tifm_sd" -SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN+="/sbin/modprobe -bv tifm_ms" -SUBSYSTEM=="memstick", RUN+="/sbin/modprobe -bv --all ms_block mspro_block" -SUBSYSTEM=="i2o", RUN+="/sbin/modprobe -bv i2o_block" -SUBSYSTEM=="module", KERNEL=="parport_pc", RUN+="/sbin/modprobe -bv ppdev" - -LABEL="drivers_end" diff --git a/rules/rules.d/80-drivers.rules.in b/rules/rules.d/80-drivers.rules.in new file mode 100644 index 00000000..96161357 --- /dev/null +++ b/rules/rules.d/80-drivers.rules.in @@ -0,0 +1,12 @@ +# do not edit this file, it will be overwritten on update + +ACTION=="remove", GOTO="drivers_end" + +DRIVER!="?*", ENV{MODALIAS}=="?*", RUN+="@sbindir@/modprobe -bv $env{MODALIAS}" +SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN+="@sbindir@/modprobe -bv tifm_sd" +SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN+="@sbindir@/modprobe -bv tifm_ms" +SUBSYSTEM=="memstick", RUN+="@sbindir/modprobe -bv --all ms_block mspro_block" +SUBSYSTEM=="i2o", RUN+="@sbindir@/modprobe -bv i2o_block" +SUBSYSTEM=="module", KERNEL=="parport_pc", RUN+="@sbindir@/modprobe -bv ppdev" + +LABEL="drivers_end" diff --git a/systemd/udev-settle.service.in b/systemd/udev-settle.service.in index f5f59589..b0a4964f 100644 --- a/systemd/udev-settle.service.in +++ b/systemd/udev-settle.service.in @@ -19,7 +19,7 @@ Before=basic.target Type=oneshot TimeoutSec=180 RemainAfterExit=yes -ExecStart=@sbindir@/udevadm settle +ExecStart=@bindir@/udevadm settle [Install] WantedBy=basic.target diff --git a/systemd/udev-trigger.service.in b/systemd/udev-trigger.service.in index 6d416c2b..cd81945c 100644 --- a/systemd/udev-trigger.service.in +++ b/systemd/udev-trigger.service.in @@ -7,4 +7,4 @@ DefaultDependencies=no [Service] Type=oneshot RemainAfterExit=yes -ExecStart=@sbindir@/udevadm trigger --type=subsystems --action=add ; @sbindir@/udevadm trigger --type=devices --action=add +ExecStart=@bindir@/udevadm trigger --type=subsystems --action=add ; @bindir@/udevadm trigger --type=devices --action=add diff --git a/test/udev-test.pl b/test/udev-test.pl index f93859c7..c2dc70ef 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1158,7 +1158,7 @@ EOF devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "sane", rules => < Configuration - udev configuration files are placed in /etc/udev/ - and /lib/udev/. All empty lines or lines beginning with + udev configuration files are placed in /etc/udev + and /usr/lib/udev. All empty lines or lines beginning with '#' are ignored. Configuration file @@ -71,9 +71,9 @@ Rules files The udev rules are read from the files located in the - system rules directory /lib/udev/rules.d/, - the local administration directory /etc/udev/rules.d/ - and the volatile runtime directory /run/udev/rules.d/. + system rules directory /usr/lib/udev/rules.d, + the local administration directory /etc/udev/rules.d + and the volatile runtime directory /run/udev/rules.d. All rules files are collectively sorted and processed in lexical order, regardless of the directories in which they live. However, files with identical file names replace each other. Files in /run @@ -398,7 +398,7 @@ detached from the event process itself. If no absolute path is given, the program is expected to live in the directory provided at compile-time to configure via --libexecdir - (this is usually /lib/udev), otherwise the absolute + (this is usually /usr/lib/udev), otherwise the absolute path must be specified. The program name and following arguments are separated by spaces. Single quotes can be used to specify arguments with spaces. @@ -511,7 +511,7 @@ Apply the permissions specified in this rule to the static device node with the specified name. Static device nodes might be provided by kernel modules - or copied from /lib/udev/devices. These nodes might not have + or copied from /usr/lib/udev/devices. These nodes might not have a corresponding kernel device at the time udevd is started; they can trigger automatic kernel module loading. diff --git a/udev/udevd.xml b/udev/udevd.xml index d335e2ec..c516eb97 100644 --- a/udev/udevd.xml +++ b/udev/udevd.xml @@ -37,7 +37,7 @@ instructions specified in udev rules. See udev7 . - On startup the content of the directory /lib/udev/devices + On startup the content of the directory /usr/lib/udev/devices is copied to /dev. If kernel modules specify static device nodes, these nodes are created even without a corresponding kernel device, to allow on-demand loading of kernel modules. Matching permissions specified in udev