From nobody@FreeBSD.org  Sun Jul  7 09:12:53 2002
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 1A6C437B400
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  7 Jul 2002 09:12:53 -0700 (PDT)
Received: from www.freebsd.org (www.FreeBSD.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id D3E9743E09
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  7 Jul 2002 09:12:52 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.4/8.12.4) with ESMTP id g67GCqOT069454
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 7 Jul 2002 09:12:52 -0700 (PDT)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.4/8.12.4/Submit) id g67GCqso069453;
	Sun, 7 Jul 2002 09:12:52 -0700 (PDT)
Message-Id: <200207071612.g67GCqso069453@www.freebsd.org>
Date: Sun, 7 Jul 2002 09:12:52 -0700 (PDT)
From: walkpad <walkpad@hotmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: using swapfile as /tmp
X-Send-Pr-Version: www-1.0

>Number:         40298
>Category:       conf
>Synopsis:       [patch] /etc/rc: using swapfile as /tmp
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          wish
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jul 07 09:20:01 PDT 2002
>Closed-Date:    Wed May 17 16:30:41 GMT 2006
>Last-Modified:  Wed May 17 16:30:41 GMT 2006
>Originator:     walkpad
>Release:        4.6-STABLE
>Organization:
personal
>Environment:
4.6-STABLE

>Description:
the following patch allows using swapfile as /tmp.
It can be applied to 4-STABLE and not to 5-current.

>How-To-Repeat:

>Fix:
$ diff /etc/rc.dist /etc/rc 
282,285c282,308
< 	if [ -w "${swapfile}" -a -c /dev/vn0b ]; then
< 		echo "Adding ${swapfile} as additional swap"
< 		vnconfig -e /dev/vn0b ${swapfile} swap
< 	fi
---
> 	case ${swapfile_as_tmp} in
> 	[Yy][Ee][Ss])
> 		if [ -w "${swapfile}" -a -c /dev/vn0 -a -c /dev/vn0b ]; then
> 			echo "Adding ${swapfile} as additional swap"
> 			vnconfig -e -s labels /dev/vn0 ${swapfile}
> 			disklabel -r -w vn0 auto
> 			if T=`mktemp /tmp/_vn0.XXXXX`; then
> 				disklabel -r vn0 > "$T"
> 				echo ' b: 100% 0 swap' >> "$T"
> 				disklabel -R vn0 "$T"
> 				swapon /dev/vn0b
> 				rm -f "$T"
> 				echo "Mounting ${swapfile} as /tmp"
> 				mount_mfs /dev/vn0b /tmp 2>/dev/null
> 			else
> 				vnconfig -u vn0
> 				vnconfig -e /dev/vn0b ${swapfile} swap
> 			fi
> 		fi
> 		;;
> 	*)
> 		if [ -w "${swapfile}" -a -c /dev/vn0b ]; then
> 			echo "Adding ${swapfile} as additional swap"
> 			vnconfig -e /dev/vn0b ${swapfile} swap
> 		fi
> 		;;
> 	esac

diff /etc/defaults/rc.conf.dist /etc/defaults/rc.conf
22a23
> swapfile_as_tmp="NO"	# Set to YES to use swapfile as /tmp.

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: matteo 
State-Changed-When: Wed May 17 16:29:00 UTC 2006 
State-Changed-Why:  
This is actually possible using tmpmfs* entries in rc.conf 


http://www.freebsd.org/cgi/query-pr.cgi?pr=40298 
>Unformatted:
