diff options
Diffstat (limited to 'init.d')
-rw-r--r-- | init.d/Makefile.Linux | 4 | ||||
-rw-r--r-- | init.d/devfs.in | 36 | ||||
-rw-r--r-- | init.d/dmesg.in | 17 | ||||
-rw-r--r-- | init.d/fsck.in | 2 | ||||
-rw-r--r-- | init.d/procfs.in | 23 | ||||
-rw-r--r-- | init.d/sysfs.in | 63 |
6 files changed, 121 insertions, 24 deletions
diff --git a/init.d/Makefile.Linux b/init.d/Makefile.Linux index ae9e6ba4..be519c80 100644 --- a/init.d/Makefile.Linux +++ b/init.d/Makefile.Linux @@ -1,7 +1,7 @@ NET_LO= net.lo -SRCS+= hwclock.in consolefont.in keymaps.in modules.in mtab.in numlock.in \ - procfs.in termencoding.in +SRCS+= devfs.in dmesg.in hwclock.in consolefont.in keymaps.in modules.in \ + mtab.in numlock.in procfs.in sysfs.in termencoding.in .SUFFIXES: .Linux.in .Linux.in: diff --git a/init.d/devfs.in b/init.d/devfs.in new file mode 100644 index 00000000..2e140f0a --- /dev/null +++ b/init.d/devfs.in @@ -0,0 +1,36 @@ +#!@PREFIX@/sbin/runscript +# Copyright 2007-2008 Roy Marples <roy@marples.name> +# All rights reserved. Released under the 2-clause BSD license. + +description="Mount system critical filesystems in /dev." + +depend() { + use dev + keyword noprefix +} + +start() { + # Mount required stuff as user may not have then in /etc/fstab + for x in \ + "devpts /dev/pts 0755 ,gid=5,mode=0620 devpts" \ + "tmpfs /dev/shm 1777 ,nodev shm" \ + ; do + set -- ${x} + grep -Eq "[[:space:]]+$1$" /proc/filesystems || continue + mountinfo -q "$2" && continue + + if [ ! -d "$2" ]; then + mkdir -m "$3" -p "$2" >/dev/null 2>&1 || \ + ewarn "Could not create $2!" + fi + + if [ -d "$2" ]; then + ebegin "Mounting $2" + if ! fstabinfo --mount "$2"; then + mount -n -t "$1" -o noexec,nosuid"$4" "$5" "$2" + fi + eend $? + fi + done + return 0 +} diff --git a/init.d/dmesg.in b/init.d/dmesg.in new file mode 100644 index 00000000..6aad0e28 --- /dev/null +++ b/init.d/dmesg.in @@ -0,0 +1,17 @@ +#!@PREFIX@/sbin/runscript +# Copyright 2007-2008 Roy Marples <roy@marples.name> +# All rights reserved. Released under the 2-clause BSD license. + +description="Set the dmesg level for a cleaner boot" + +depend() +{ + before dev modules +} + +start() +{ + if [ -n "${dmesg_level}" ]; then + dmesg -n"${dmesg_level}" + fi +} diff --git a/init.d/fsck.in b/init.d/fsck.in index ee2acdcc..5f7099a6 100644 --- a/init.d/fsck.in +++ b/init.d/fsck.in @@ -8,7 +8,7 @@ _IFS=" depend() { - after clock modules + use dev clock modules keyword nojail noopenvz noprefix notimeout novserver } diff --git a/init.d/procfs.in b/init.d/procfs.in index 410a6e3b..b6dfbb62 100644 --- a/init.d/procfs.in +++ b/init.d/procfs.in @@ -6,6 +6,7 @@ description="Mounts misc filesystems in /proc." depend() { + use devfs need localmount keyword noopenvz noprefix novserver } @@ -39,7 +40,7 @@ start() # Setup Kernel Support for the NFS daemon status if [ -d /proc/fs/nfsd ] && ! mountinfo -q /proc/fs/nfsd; then if grep -qs nfsd /proc/filesystems; then - ebegin "Mounting nfsd filesystem" + ebegin "Mounting NFS filesystem" mount -t nfsd -o nodev,noexec,nosuid \ nfsd /proc/fs/nfsd eend $? @@ -56,26 +57,6 @@ start() fi fi - # Setup Kernel Support for securityfs - if [ -d /sys/kernel/security ] && ! mountinfo -q /sys/kernel/security; then - if grep -qs securityfs /proc/filesystems; then - ebegin "Mounting security filesystem" - mount -t securityfs -o nodev,noexec,nosuid \ - securityfs /sys/kernel/security - eend $? - fi - fi - - # Setup Kernel Support for debugfs - if [ -d /sys/kernel/debug ] && ! mountinfo -q /sys/kernel/debug; then - if grep -qs debugfs /proc/filesystems; then - ebegin "Mounting debug filesystem" - mount -t debugfs -o nodev,noexec,nosuid \ - debugfs /sys/kernel/debug - eend $? - fi - fi - # Setup Kernel Support for SELinux if [ -d /selinux ] && ! mountinfo -q /selinux; then if grep -qs selinuxfs /proc/filesystems; then diff --git a/init.d/sysfs.in b/init.d/sysfs.in new file mode 100644 index 00000000..e711aee4 --- /dev/null +++ b/init.d/sysfs.in @@ -0,0 +1,63 @@ +#!@PREFIX@/sbin/runscript +# Copyright 2007-2008 Roy Marples <roy@marples.name> +# All rights reserved. Released under the 2-clause BSD license. + +description="Mount the sys filesystem." + +depend() +{ + keyword noprefix +} + +mount_sys() +{ + grep -Eq "[[:space:]]+sysfs$" /proc/filesystems || return 1 + mountinfo -q /sys && return 0 + + if [ ! -d /sys ]; then + if ! mkdir -m 0755 /sys; then + ewarn "Could not create /sys!" + return 1 + fi + fi + + ebegin "Mounting /sys" + if ! fstabinfo --mount /sys; then + mount -n -t sysfs -o noexec,nosuid,nodev sysfs /sys + fi + eend $? +} + +mount_misc() +{ + # Setup Kernel Support for securityfs + if [ -d /sys/kernel/security ] && ! mountinfo -q /sys/kernel/security; then + if grep -qs securityfs /proc/filesystems; then + ebegin "Mounting security filesystem" + mount -t securityfs -o nodev,noexec,nosuid \ + securityfs /sys/kernel/security + eend $? + fi + fi + + # Setup Kernel Support for debugfs + if [ -d /sys/kernel/debug ] && ! mountinfo -q /sys/kernel/debug; then + if grep -qs debugfs /proc/filesystems; then + ebegin "Mounting debug filesystem" + mount -t debugfs -o nodev,noexec,nosuid \ + debugfs /sys/kernel/debug + eend $? + fi + fi +} + +start() +{ + local retval + mount_sys + retval=$? + if [ ${retval} -eq 0 ]; then + mount_misc + fi + return ${retval} +} |