aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-04-06 18:40:09 +0200
committerDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-04-07 01:33:58 +0200
commit4f4a377d7acb555193566db3ee459adc19e2e6a5 (patch)
treea5b334c458c48864b469dcd60ae9a4aa35ea3739 /scripts
parent212d3022e7dc9117351c09d9154d2360fe1eb91f (diff)
Add VFS setup scripts
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
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