tmp revision 153026
121308Sache#!/bin/sh 221308Sache# 321308Sache# Copyright (c) 1999 Matt Dillon 421308Sache# All rights reserved. 521308Sache# 621308Sache# Redistribution and use in source and binary forms, with or without 721308Sache# modification, are permitted provided that the following conditions 821308Sache# are met: 921308Sache# 1. Redistributions of source code must retain the above copyright 1058310Sache# notice, this list of conditions and the following disclaimer. 1121308Sache# 2. Redistributions in binary form must reproduce the above copyright 1221308Sache# notice, this list of conditions and the following disclaimer in the 1321308Sache# documentation and/or other materials provided with the distribution. 1421308Sache# 1521308Sache# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1621308Sache# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1721308Sache# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1821308Sache# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1921308Sache# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2021308Sache# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2158310Sache# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2221308Sache# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2321308Sache# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2421308Sache# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2521308Sache# SUCH DAMAGE. 2621308Sache# 2721308Sache# $FreeBSD: head/etc/rc.d/tmp 153026 2005-12-02 19:54:57Z dougb $ 2821308Sache# 2921308Sache 3021308Sache# PROVIDE: tmp 3121308Sache# REQUIRE: mountcritlocal 3221308Sache# BEFORE: mountcritremote 3321308Sache 3421308Sache. /etc/rc.subr 35119610Sache 3621308Sachename="tmp" 3735486Sache 3835486Sacheload_rc_config $name 3935486Sache 4021308Sache# If we do not have a writable /tmp, create a memory 4121308Sache# filesystem for /tmp. If /tmp is a symlink (e.g. to /var/tmp, 4221308Sache# then it should already be writable). 4321308Sache# 4421308Sachecase "${tmpmfs}" in 4521308Sache[Yy][Ee][Ss]) 4621308Sache mount_md ${tmpsize} /tmp "${tmpmfs_flags}" 4721308Sache chmod 01777 /tmp 4821308Sache ;; 4921308Sache[Nn][Oo]) 50119610Sache ;; 51119610Sache*) 5221308Sache if (/bin/mkdir -p /tmp/.diskless 2> /dev/null); then 5321308Sache rmdir /tmp/.diskless 5421308Sache else 5521308Sache if [ -h /tmp ]; then 5621308Sache echo "*** /tmp is a symlink to a non-writable area!" 5721308Sache echo "dropping into shell, ^D to continue anyway." 5821308Sache /bin/sh 5921308Sache else 6021308Sache mount_md ${tmpsize} /tmp "${tmpmfs_flags}" 6121308Sache chmod 01777 /tmp 6221308Sache fi 6321308Sache fi 6475406Sache ;; 6521308Sacheesac 6621308Sache