diff options
Diffstat (limited to 'packages/slugos-init/files/functions')
-rw-r--r-- | packages/slugos-init/files/functions | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/packages/slugos-init/files/functions b/packages/slugos-init/files/functions index 18f4009ee7..5b6b40b091 100644 --- a/packages/slugos-init/files/functions +++ b/packages/slugos-init/files/functions @@ -173,6 +173,7 @@ checkmount(){ # basic test for init (the kernel will try to load this) # but require a shell in bin/sh too test \( -d "$1/mnt" \) -a \ + \( -d "$1/dev" \) -a \ \( -x "$1/bin/sh" -o -h "$1/bin/sh" \) -a \ \( -x "$1/usr/sbin/chroot" -o -h "$1/usr/sbin/chroot" -o \ -x "$1/sbin/chroot" -o -h "$1/sbin/chroot" \) -a \ @@ -181,6 +182,18 @@ checkmount(){ -x "$1/bin/init" -o -h "$1/bin/init" \) } # +# minimaldevnodes "mountpoint" +# tests an already mounted mountpoint to see if a very minimal +# set of devices exists or can be created in dev, and returns +# failure if not. This is required for booting to an nfsroot +# with an empty dev directory, as commonly occurs when the rootfs +# is created from a tar.gz image. This is also required for mdev. +minimaldevnodes(){ + [ -c "$1/dev/console" ] || mknod -m 600 "$1/dev/console" c 5 1 || return 1 + [ -c "$1/dev/null" ] || mknod -m 666 "$1/dev/null" c 1 3 || return 1 + return 0 +} +# # swivel "new root" "old root" # NOTE: the arguments must be paths relative to /, bad things # will happen if the arguments themselves start with / |