summaryrefslogtreecommitdiffstats
path: root/debian/extra/initramfs-tools/scripts/init-bottom/udev
blob: cb114b7e044638ede02ce655fd7fd54ae70b9f7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh -e

PREREQS=""

prereqs() { echo "$PREREQS"; }

case "$1" in
    prereqs)
    prereqs
    exit 0
    ;;
esac

# Stop udevd, we'll miss a few events while we run init, but we catch up
# Wait for current workers to stop (at most for a minute to avoid deadlocks)
# otherwise there will be lock files left under /run/ (see: #1056564)
udevadm settle --timeout=60
udevadm control --exit

# move the /dev tmpfs to the rootfs; fall back to util-linux mount that does
# not understand -o move
mount -n -o move /dev "${rootmnt:?}/dev" || mount -n --move /dev "${rootmnt}/dev"

# create a temporary symlink to the final /dev for other initramfs scripts
if command -v nuke >/dev/null; then
    nuke /dev
else
    # shellcheck disable=SC2114
    rm -rf /dev
fi
ln -s "${rootmnt}/dev" /dev