systemd/debian/extra/initramfs-tools/scripts/init-bottom/udev
Benjamin Drung 7abfa8dc77 Fix shellcheck issues in initramfs-tools scripts
initramfs-tools will use shellcheck on its own code and will probably
ship a shellcheck autopkgtest that checks its hooks and script
directory. That's how the shellcheck issues in systemd's initramfs-tools
scripts were found.

```
shellcheck -e SC1091 $(find debian/extra/initramfs-tools/ -type f)
```
2019-01-12 20:36:33 +01:00

30 lines
612 B
Bash
Executable File

#!/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
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