systemd/debian/extra/initramfs.hook
Martin Pitt 4ce5b1f1e4 Drop our Debian specific 50-udev-default.rules and 91-permissions.rules
Use the upstream rules with a patch for the remaining Debian specific default
device permissions. Many thanks to Marco d'Itri for researching which
Debian-specific rules are obsolete!

Amongst other things, this now also reads the hwdb info for USB devices and
gets rid of some syntax errors.

Closes: #717405
Closes: #706221
2014-04-26 16:26:43 +02:00

74 lines
2.0 KiB
Bash

#!/bin/sh -e
PREREQS=""
prereqs() { echo "$PREREQS"; }
case "$1" in
prereqs)
prereqs
exit 0
;;
esac
root_over_the_network() {
if egrep -qs '^/dev/(nbd|nd[a-z]|etherd/e)[^[:space:]]+[[:space:]]+/[[:space:]]' /etc/fstab; then
return 0
elif egrep -qs '^[^[:space:]#]+[[:space:]]+/[[:space:]]+nfs[234]?[[:space:]]' /etc/fstab; then
return 0
fi
return 1 # false
}
. /usr/share/initramfs-tools/hook-functions
mkdir -p $DESTDIR/lib/systemd
copy_exec /lib/systemd/systemd-udevd /lib/systemd
copy_exec /bin/udevadm /bin
# copy compat symlink
cp -a /sbin/udevadm $DESTDIR/sbin/udevadm
mkdir -p $DESTDIR/etc/udev
cp -p /etc/udev/udev.conf $DESTDIR/etc/udev/
mkdir -p $DESTDIR/lib/udev/rules.d/
for rules in 50-firmware.rules 50-udev-default.rules 60-persistent-storage.rules \
80-drivers.rules \
64-md-raid.rules 60-persistent-storage-lvm.rules \
55-dm.rules 60-persistent-storage-dm.rules; do
if [ -e /etc/udev/rules.d/$rules ]; then
cp -p /etc/udev/rules.d/$rules $DESTDIR/lib/udev/rules.d/
elif [ -e /lib/udev/rules.d/$rules ]; then
cp -p /lib/udev/rules.d/$rules $DESTDIR/lib/udev/rules.d/
fi
done
# try to autodetect the value of this configuration option
if [ -z "$NEED_PERSISTENT_NET" ] && root_over_the_network; then
NEED_PERSISTENT_NET='yes'
fi
# Copy the rules for persistent network interface names for the benefit of
# systems which need to boot over the network. If this is enabled then the
# initramfs must be rebuilt every time a new network interface is added.
# See #414287 for details.
case "$NEED_PERSISTENT_NET" in
YES|yes|Yes|Y|y)
if [ -e /etc/udev/rules.d/70-persistent-net.rules ]; then
cp -p /etc/udev/rules.d/70-persistent-net.rules $DESTDIR/lib/udev/rules.d/
fi
;;
esac
cp /lib/udev/hotplug.functions $DESTDIR/lib/udev/
for program in ata_id scsi_id; do
copy_exec /lib/udev/$program /lib/udev
done
copy_exec /sbin/blkid /sbin
if [ -x /lib/udev/vio_type ]; then
copy_exec /lib/udev/vio_type /lib/udev
fi