Debian Codegraph @

debian/extra/initramfs-tools/hooks/udev

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`. -e
2
3 PREREQS=""
4
5 prereqsscip-shell shell systemd 261~rc3-1 prereqs().() { echoscip-shell system . . echo. "$PREREQS"; }
6
7 case "$1" in
8 prereqs)
9 prereqsscip-shell shell systemd 261~rc3-1 prereqs().
10 exit 0
11 ;;
12 esac
13
14 . /usr/share/initramfs-tools/hook-functionsscip-shell source . . `/usr/share/initramfs-tools/hook-functions`.
15
16 mkdirscip-shell system . . mkdir. -p "$DESTDIR/usr/lib/systemd"
17 copy_exec /usr/lib/systemd/systemd-udevdscip-shell filesystem . . `/usr/lib/systemd/systemd-udevd`. /usr/lib/systemdscip-shell filesystem . . `/usr/lib/systemd`.
18 copy_exec /usr/bin/udevadmscip-shell filesystem . . `/usr/bin/udevadm`. /usr/binscip-shell filesystem . . `/usr/bin`.
19 # libkmod is loaded via dlopen() since v256 so pull it in manually
20 for library in /usr/lib/*/libkmod.so.*; do
21 if [scip-shell system . . `[`. -f "${library}" ]; then
22 copy_exec "${library}"
23 fi
24 done
25
26 if [scip-shell system . . `[`. -e /etc/udev/udev.confscip-shell filesystem . . `/etc/udev/udev.conf`. ]; then
27 mkdirscip-shell system . . mkdir. -p "$DESTDIR/etc/udev"
28 cpscip-shell system . . cp. -p /etc/udev/udev.confscip-shell filesystem . . `/etc/udev/udev.conf`. "$DESTDIR/etc/udev/"
29 fi
30
31 # copy hwdb.bin
32 if [scip-shell system . . `[`. -e /usr/lib/udev/hwdb.binscip-shell filesystem . . `/usr/lib/udev/hwdb.bin`. ]; then
33 mkdirscip-shell system . . mkdir. -p "$DESTDIR/usr/lib/udev"
34 cpscip-shell system . . cp. -p /usr/lib/udev/hwdb.binscip-shell filesystem . . `/usr/lib/udev/hwdb.bin`. "$DESTDIR/usr/lib/udev/hwdb.bin"
35 fi
36
37 # copy .link files containing interface naming definitions
38 mkdirscip-shell system . . mkdir. -p "$DESTDIR/usr/lib/systemd/network/"
39 findscip-shell system . . find. -L /usr/lib/systemd/networkscip-shell filesystem . . `/usr/lib/systemd/network`. -name '*.link*' -execdir cp -r -pt "$DESTDIR/usr/lib/systemd/network/" '{}' +
40 if [scip-shell system . . `[`. -d /usr/local/lib/systemd/networkscip-shell filesystem . . `/usr/local/lib/systemd/network`. ]; then
41 findscip-shell system . . find. -L /usr/local/lib/systemd/networkscip-shell filesystem . . `/usr/local/lib/systemd/network`. -name '*.link*' -execdir cp -r -pt "$DESTDIR/usr/lib/systemd/network/" '{}' +
42 fi
43 if [scip-shell system . . `[`. -d /etc/systemd/networkscip-shell filesystem . . `/etc/systemd/network`. ]; then
44 findscip-shell system . . find. -L /etc/systemd/networkscip-shell filesystem . . `/etc/systemd/network`. -name '*.link*' -execdir cp -r -pt "$DESTDIR/usr/lib/systemd/network/" '{}' +
45 fi
46
47 mkdirscip-shell system . . mkdir. -p "$DESTDIR/usr/lib/udev/rules.d/"
48 for rules in 50-firmware.rules 50-udev-default.rules \
49 60-block.rules 60-persistent-storage.rules \
50 61-persistent-storage-android.rules 71-seat.rules \
51 73-special-net-names.rules 75-net-description.rules \
52 80-net-setup-link.rules 80-drivers.rules; do
53 if [scip-shell system . . `[`. -e /etc/udev/rules.d/$rules ]; then
54 cpscip-shell system . . cp. -p /etc/udev/rules.d/$rules "$DESTDIR/usr/lib/udev/rules.d/"
55 elif [scip-shell system . . `[`. -e /usr/lib/udev/rules.d/$rules ]; then
56 cpscip-shell system . . cp. -p /usr/lib/udev/rules.d/$rules "$DESTDIR/usr/lib/udev/rules.d/"
57 fi
58 done
59
60 # See if chzdev can filter out generated rules, per LP: #2044104
61 ZDEV_FILTERING=0
62 if [scip-shell system . . `[`. -e /usr/sbin/chzdevscip-shell filesystem . . `/usr/sbin/chzdev`. ] && \
63 dpkg --compare-versions "$(dpkg-queryscip-shell system . . dpkg-query. -f '${Version}' -W s390-tools 2> /dev/nullscip-shell filesystem . . `/dev/null`.)" '>=' '2.33.0';
64 then
65 ZDEV_FILTERING=1
66 fi
67
68 # now copy all custom udev rules which don't have an equivalent in /usr/lib (e. g.
69 # 70-persistent-net.rules or similar); They might contain network names or
70 # other bits which are relevant for the initramfs.
71 for rules in /etc/udev/rules.d/*.rules; do
72 if [scip-shell system . . `[`. ! -e "$rules" ]; then
73 continue
74 fi
75
76 # Skip rules generated by chzdev as they are handled by its own hook.
77 # See LP: #2044104
78 if [scip-shell system . . `[`. $ZDEV_FILTERING -eq 1 ] && /usr/sbin/chzdevscip-shell filesystem . . `/usr/sbin/chzdev`. --is-owner "$rules"; then
79 # only skip/continue if rule is not configured as zdev_early (=0),
80 # but copy if zdev_early=1 or if zdev_early is not specified at all
81 if [scip-shell system . . `[`. $(grepscip-shell system . . grep. "ENV{zdev_early}=\"0\"" "$rules") ]; then
82 continue;
83 fi
84 fi
85
86 if [scip-shell system . . `[`. ! -e "/usr/lib/${rules#/etc/}" ]; then
87 cpscip-shell system . . cp. -p "$rules" "$DESTDIR/usr/lib/udev/rules.d/"
88 fi
89 done
90
91 for program in ata_id scsi_id; do
92 copy_exec /usr/lib/udev/$program /usr/lib/udevscip-shell filesystem . . `/usr/lib/udev`.
93 done
94 copy_exec /sbin/blkidscip-shell filesystem . . `/sbin/blkid`. /sbinscip-shell filesystem . . `/sbin`.