aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makemodule.am2
-rw-r--r--scripts/devfs.sh.in21
-rw-r--r--scripts/trymount.sh.in7
3 files changed, 30 insertions, 0 deletions
diff --git a/scripts/Makemodule.am b/scripts/Makemodule.am
new file mode 100644
index 0000000..e6de18d
--- /dev/null
+++ b/scripts/Makemodule.am
@@ -0,0 +1,2 @@
+scriptdir = @SCRIPTDIR@
+script_SCRIPTS = scripts/devfs.sh scripts/trymount.sh
diff --git a/scripts/devfs.sh.in b/scripts/devfs.sh.in
new file mode 100644
index 0000000..a39d3ea
--- /dev/null
+++ b/scripts/devfs.sh.in
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+@SBINPATH@/mount -t devtmpfs none /dev
+
+[ -c /dev/console ] || @SBINPATH@/mknod -m 600 /dev/console c 5 1
+[ -c /dev/tty ] || @SBINPATH@/mknod -m 666 /dev/tty c 5 0
+[ -c /dev/null ] || @SBINPATH@/mknod -m 666 /dev/null c 1 3
+[ -c /dev/kmsg ] || @SBINPATH@/mknod -m 660 /dev/kmsg c 1 11
+[ -e /dev/fd ] || @BINPATH@/ln -snf /proc/self/fd /dev/fd
+[ -e /dev/stdin ] || @BINPATH@/ln -snf /proc/self/fd/0 /dev/stdin
+[ -e /dev/stdout ] || @BINPATH@/ln -snf /proc/self/fd/1 /dev/stdout
+[ -e /dev/stderr ] || @BINPATH@/ln -snf /proc/self/fd/2 /dev/stderr
+[ -e /proc/kcore ] && @BINPATH@/ln -snf /proc/kcore /dev/core
+
+@BINPATH@/mkdir -p /dev/mqueue -m 1777
+@BINPATH@/mkdir -p /dev/pts -m 0755
+@BINPATH@/mkdir -p /dev/shm -m 1777
+
+@SCRIPTDIR@/trymount.sh "/dev/mqueue" "mqueue" "noexec,nosuid,nodev"
+@SCRIPTDIR@/trymount.sh "/dev/pts" "devpts" "noexec,nosuid,gid=5,mode=0620"
+@SCRIPTDIR@/trymount.sh "/dev/shm" "tmpfs" "noexec,nosuid,nodev,mode=1777"
diff --git a/scripts/trymount.sh.in b/scripts/trymount.sh.in
new file mode 100644
index 0000000..a382792
--- /dev/null
+++ b/scripts/trymount.sh.in
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+if [ -d "$1" ]; then
+ if @BINPATH@/grep -qsE "[[:space:]]+$2$" "/proc/filesystems"; then
+ mount -n -t "$2" -o "$3" "$2" "$1"
+ fi
+fi