| 1 | #!/bin/sh -e |
| 2 | |
| 3 | PREREQS="" |
| 4 | |
| 5 | prereqs() { echo "$PREREQS"; } |
| 6 | |
| 7 | case "$1" in |
| 8 | prereqs) |
| 9 | prereqs |
| 10 | exit 0 |
| 11 | ;; |
| 12 | esac |
| 13 | |
| 14 | # Stop udevd, we'll miss a few events while we run init, but we catch up |
| 15 | # Wait for current workers to stop (at most for a minute to avoid deadlocks) |
| 16 | # otherwise there will be lock files left under /run/ (see: #1056564) |
| 17 | udevadm settle --timeout=60 |
| 18 | udevadm control --exit |
| 19 | |
| 20 | # move the /dev tmpfs to the rootfs; fall back to util-linux mount that does |
| 21 | # not understand -o move |
| 22 | mount -n -o move /dev "${rootmnt:?}/dev" || mount -n --move /dev "${rootmnt}/dev" |
| 23 | |
| 24 | # create a temporary symlink to the final /dev for other initramfs scripts |
| 25 | if command -v nuke >/dev/null; then |
| 26 | nuke /dev |
| 27 | else |
| 28 | # shellcheck disable=SC2114 |
| 29 | rm -rf /dev |
| 30 | fi |
| 31 | ln -s "${rootmnt}/dev" /dev |