diff options
author | P. J. McDermott <pjm@nac.net> | 2013-08-13 13:21:48 (EDT) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2013-08-13 13:21:48 (EDT) |
commit | eb940d9544353c7852767474ae8d4e91ccb51cf2 (patch) | |
tree | 14bb3f5fa4654759568d77cbcb68bf0757be38ab | |
parent | bbf7b58a13ce329d8306f84ca7711bf73c7a1248 (diff) |
/etc/init.d/mounttmpfs: New script.
-rw-r--r-- | scripts | 1 | ||||
-rw-r--r-- | src.etc/init.d/mounttmpfs | 47 |
2 files changed, 48 insertions, 0 deletions
@@ -4,6 +4,7 @@ KLOGD klogd S30 K80 MDEV mdev S02 K98 FEATURE_MOUNT_FSTAB mountall S10 FEATURE_MOUNT_FLAGS mountkernfs S01 K99 +FEATURE_MOUNT_FLAGS mounttmpfs S03 K97 IFUPDOWN networking S20 K90 SYSLOGD syslog S30 K80 TELNETD telnetd S40 K70 diff --git a/src.etc/init.d/mounttmpfs b/src.etc/init.d/mounttmpfs new file mode 100644 index 0000000..a4025d7 --- /dev/null +++ b/src.etc/init.d/mounttmpfs @@ -0,0 +1,47 @@ +#!/bin/sh + +start() +{ + printf 'Mounting temporary file systems... ' + + if ! mount | grep -F ' /run ' >dev/null 2>&1; then + mount -t tmpfs -o nodev,noexec,nosuid,mode=0755 tmpfs /run + fi + + [ -d /run/lock ] || mkdir -m 1777 /run/lock + [ -d /run/shm ] || mkdir -m 1777 /run/shm + + if ! mount | grep -F ' /tmp ' >dev/null 2>&1; then + mount -t tmpfs -o nodev,nosuid,mode=1777 tmpfs /tmp + fi + + printf 'done.\n' +} + +stop() +{ + printf 'Unmounting temporary file systems... ' + + if mount | grep -F ' /run ' >dev/null 2>&1; then + umount /run + fi + + if mount | grep -F ' /tmp ' >dev/null 2>&1; then + umount /run + fi + + printf 'done.\n' +} + +case "${1}" in + start) + start + ;; + stop) + stop + ;; + *) + printf 'Usage: %s {start|stop}\n' "${0}" >&2 + exit 1 + ;; +esac |