use libexecdir, bindir, sbindir, switch to /usr/lib/udev in documentation

This commit is contained in:
Kay Sievers 2011-12-01 12:17:22 +01:00
parent c096407caa
commit 12a362be5c
28 changed files with 103 additions and 73 deletions

37
INSTALL
View file

@ -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

View file

@ -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 = \

4
NEWS
View file

@ -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.

12
README
View file

@ -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.

4
TODO
View file

@ -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

View file

@ -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"

View file

@ -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}

View file

@ -1,6 +1,6 @@
keyboard-force-release.sh
keymap
keys-from-name.gperf
keys-from-name.h
keys-to-name.h
keys.txt

View file

@ -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"

View file

@ -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"

View file

@ -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"'.

View file

@ -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"

View file

@ -1 +1,2 @@
mtd_probe
75-probe_mtd.rules

View file

@ -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"

View file

@ -15,10 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
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.

View file

@ -1,2 +1,3 @@
scsi_id
scsi_id.8
scsi_id_version.h

View file

@ -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

2
rules/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
rules.d/60-persistent-storage.rules
rules.d/80-drivers.rules

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -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 => <<EOF
SUBSYSTEMS=="scsi", KERNEL=="sda1", PROGRAM=="/bin/echo -e name; (/sbin/badprogram)", RESULT=="name_ _/sbin/badprogram_", SYMLINK+="sane"
SUBSYSTEMS=="scsi", KERNEL=="sda1", PROGRAM=="/bin/echo -e name; (/usr/bin/badprogram)", RESULT=="name_ _/usr/bin/badprogram_", SYMLINK+="sane"
EOF
},
{

View file

@ -765,7 +765,7 @@ int udev_event_spawn(struct udev_event *event,
}
}
/* allow programs in /lib/udev/ to be called without the path */
/* allow programs in /usr/lib/udev/ to be called without the path */
if (argv[0][0] != '/') {
util_strscpyl(program, sizeof(program), LIBEXECDIR "/", argv[0], NULL);
argv[0] = program;

View file

@ -1798,13 +1798,13 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names)
if (udev_get_rules_path(udev) == NULL) {
char filename[UTIL_PATH_SIZE];
/* /lib/udev -- default/package rules */
/* /usr/lib/udev -- system rules */
add_matching_files(udev, &file_list, LIBEXECDIR "/rules.d", ".rules");
/* /etc/udev -- system-specific/user/admin rules */
/* /etc/udev -- local administration rules */
add_matching_files(udev, &file_list, SYSCONFDIR "/udev/rules.d", ".rules");
/* /run/udev -- throw-away/temporary rules */
/* /run/udev -- runtime rules */
util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/rules.d", NULL);
add_matching_files(udev, &file_list, filename, ".rules");
} else {

View file

@ -41,8 +41,8 @@
</refsect1>
<refsect1><title>Configuration</title>
<para>udev configuration files are placed in <filename>/etc/udev/</filename>
and <filename>/lib/udev/</filename>. All empty lines or lines beginning with
<para>udev configuration files are placed in <filename>/etc/udev</filename>
and <filename>/usr/lib/udev</filename>. All empty lines or lines beginning with
'#' are ignored.</para>
<refsect2><title>Configuration file</title>
@ -71,9 +71,9 @@
<refsect2><title>Rules files</title>
<para>The udev rules are read from the files located in the
system rules directory <filename>/lib/udev/rules.d/</filename>,
the local administration directory <filename>/etc/udev/rules.d/</filename>
and the volatile runtime directory <filename>/run/udev/rules.d/</filename>.
system rules directory <filename>/usr/lib/udev/rules.d</filename>,
the local administration directory <filename>/etc/udev/rules.d</filename>
and the volatile runtime directory <filename>/run/udev/rules.d</filename>.
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 <filename>/run</filename>
@ -398,7 +398,7 @@
detached from the event process itself.</para>
<para>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 <filename>/lib/udev</filename>), otherwise the absolute
(this is usually <filename>/usr/lib/udev</filename>), 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.</para>
@ -511,7 +511,7 @@
<listitem>
<para>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 <filename>/lib/udev/devices</filename>. These nodes might not have
or copied from <filename>/usr/lib/udev/devices</filename>. These nodes might not have
a corresponding kernel device at the time udevd is started; they can trigger
automatic kernel module loading.</para>
</listitem>

View file

@ -37,7 +37,7 @@
instructions specified in udev rules. See <citerefentry>
<refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum>
</citerefentry>.</para>
<para>On startup the content of the directory <filename>/lib/udev/devices</filename>
<para>On startup the content of the directory <filename>/usr/lib/udev/devices</filename>
is copied to <filename>/dev</filename>. 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