#!/bin/sh start() { printf 'Mounting temporary file systems... ' if ! mount | grep -Fq ' /run '; 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 -Fq ' /tmp '; then mount -t tmpfs -o nodev,nosuid,mode=1777 tmpfs /tmp fi printf 'done.\n' } stop() { printf 'Unmounting temporary file systems... ' if mount | grep -Fq ' /run '; then umount /run fi if mount | grep -Fq ' /tmp '; 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