head	1.7;
access;
symbols
	RELENG_6_4_0_RELEASE:1.6.2.1
	RELENG_6_4:1.6.2.1.0.10
	RELENG_6_4_BP:1.6.2.1
	RELENG_6_3_0_RELEASE:1.6.2.1
	RELENG_6_3:1.6.2.1.0.8
	RELENG_6_3_BP:1.6.2.1
	RELENG_6_2_0_RELEASE:1.6.2.1
	RELENG_6_2:1.6.2.1.0.6
	RELENG_6_2_BP:1.6.2.1
	RELENG_5_5_0_RELEASE:1.4.2.2
	RELENG_5_5:1.4.2.2.0.6
	RELENG_5_5_BP:1.4.2.2
	RELENG_6_1_0_RELEASE:1.6.2.1
	RELENG_6_1:1.6.2.1.0.4
	RELENG_6_1_BP:1.6.2.1
	RELENG_6_0_0_RELEASE:1.6.2.1
	RELENG_6_0:1.6.2.1.0.2
	RELENG_6_0_BP:1.6.2.1
	RELENG_6:1.6.0.2
	RELENG_6_BP:1.6
	RELENG_5_4_0_RELEASE:1.4.2.2
	RELENG_5_4:1.4.2.2.0.4
	RELENG_5_4_BP:1.4.2.2
	RELENG_5_3_0_RELEASE:1.4.2.2
	RELENG_5_3:1.4.2.2.0.2
	RELENG_5_3_BP:1.4.2.2
	RELENG_5:1.4.0.2
	RELENG_5_BP:1.4;
locks; strict;
comment	@# @;


1.7
date	2005.08.05.21.23.08;	author pjd;	state dead;
branches;
next	1.6;

1.6
date	2004.10.07.13.55.25;	author mtm;	state Exp;
branches
	1.6.2.1;
next	1.5;

1.5
date	2004.08.18.21.54.40;	author thomas;	state Exp;
branches;
next	1.4;

1.4
date	2004.03.08.12.25.05;	author pjd;	state Exp;
branches
	1.4.2.1;
next	1.3;

1.3
date	2004.02.05.21.40.37;	author des;	state Exp;
branches;
next	1.2;

1.2
date	2004.02.04.15.53.49;	author des;	state Exp;
branches;
next	1.1;

1.1
date	2004.02.03.11.26.08;	author des;	state Exp;
branches;
next	;

1.4.2.1
date	2004.09.06.20.55.03;	author thomas;	state Exp;
branches;
next	1.4.2.2;

1.4.2.2
date	2004.10.10.09.50.53;	author mtm;	state Exp;
branches;
next	;

1.6.2.1
date	2005.08.16.09.04.55;	author pjd;	state dead;
branches;
next	;


desc
@@


1.7
log
@gbde_swap has been repo-copied to encswap.

Repo-copy made by:	markm
@
text
@#!/bin/sh
#
# $FreeBSD: src/etc/rc.d/gbde_swap,v 1.6 2004/10/07 13:55:25 mtm Exp $
#

# PROVIDE: disks
# REQUIRE: initrandom
# KEYWORD: nojail

. /etc/rc.subr

name="gbde_swap"
start_cmd="gbde_swap_attach"
stop_cmd="gbde_swap_detach"

gbde_swap_attach()
{
	while read device mountpoint type options rest ; do
		case ":${device}:${type}:${options}" in
		:#*)
			continue
			;;
		*.bde:swap:sw)
			;;
		*)
			continue
			;;
		esac
		passphrase=`dd if=/dev/random count=1 2>/dev/null | md5 -q`
		device="${device%.bde}"
		gbde init "${device}" -P "${passphrase}" || return 1
		gbde attach "${device}" -p "${passphrase}" || return 1
	done < /etc/fstab
}

gbde_swap_detach()
{
	while read device mountpoint type options rest ; do
		case ":${device}:${type}:${options}" in
		:#*)
			continue
			;;
		*.bde:swap:sw)
			;;
		*)
			continue
			;;
		esac
		device="${device%.bde}"
		gbde detach "${device}"
	done < /etc/fstab
}

load_rc_config $name
run_rc_command "$1"
@


1.6
log
@Remove the requirement for the FreeBSD keyword as it no longer
makes any sense.

Discussed with: dougb, brooks
MFC after: 3 days
@
text
@d3 1
a3 1
# $FreeBSD$
@


1.6.2.1
log
@MFC: Remove gbde_swap script and introduce encswap script, which knows how to
     encrypt swap partitions using both: gbde and geli.

Approved by:	re (kensmith)
@
text
@d3 1
a3 1
# $FreeBSD: src/etc/rc.d/gbde_swap,v 1.6 2004/10/07 13:55:25 mtm Exp $
@


1.5
log
@Skip entries for GBDE swap devices if they are commented out in /etc/fstab.

Reviewed by:	des
@
text
@d8 1
a8 1
# KEYWORD: FreeBSD nojail
@


1.4
log
@Mark scripts as not usable inside a jail by adding keyword 'nojail'.

Some suggestions from:	rwatson, Ruben de Groot <mail25@@bzerk.org>
@
text
@a17 1
	cat /etc/fstab |
d19 4
a22 1
		case "${device}:${type}:${options}" in
d33 1
a33 1
	done
a37 1
	cat /etc/fstab |
d39 4
a42 1
		case "${device}:${type}:${options}" in
d51 1
a51 1
	done
@


1.4.2.1
log
@MFC to RELENG_5 rev. 1.5:
Skip entries for GBDE swap devices if they are commented out in /etc/fstab.

Approved by:	re (scottl)
@
text
@d18 1
d20 1
a20 4
		case ":${device}:${type}:${options}" in
		:#*)
			continue
			;;
d31 1
a31 1
	done < /etc/fstab
d36 1
d38 1
a38 4
		case ":${device}:${type}:${options}" in
		:#*)
			continue
			;;
d47 1
a47 1
	done < /etc/fstab
@


1.4.2.2
log
@RCS file: /home/ncvs/src/etc/rc,v
----------------------------
revision 1.335
date: 2004/10/08 14:23:49;  author: mtm;  state: Exp;  lines: +0 -1
Remove an unused variable.

Submitted by: Pawel Worach <pawel.worach@@telia.com>
----------------------------
revision 1.334
date: 2004/10/07 13:55:25;  author: mtm;  state: Exp;  lines: +1 -1
Remove the requirement for the FreeBSD keyword as it no longer
makes any sense.

Discussed with: dougb, brooks
MFC after: 3 days
=============================================================================
RCS file: /home/ncvs/src/etc/rc.d/nsswitch,v
----------------------------
revision 1.4
date: 2004/09/16 17:03:12;  author: keramida;  state: Exp;  lines: +1 -1
Fix requirement of `network' to `NETWORK' because the former isn't
provided by any rc.d script.

Approved by:	mtm
=============================================================================
RCS file: /home/ncvs/src/etc/rc.d/pflog,v
----------------------------
revision 1.3
date: 2004/09/16 17:04:20;  author: keramida;  state: Exp;  lines: +1 -1
We don't have any providers of `beforenetlkm' in FreeBSD.  Remove the
dependency to it from our rc.d scripts.

Approved by:	mtm
=============================================================================

Approved by: re/scottl
@
text
@d8 1
a8 1
# KEYWORD: nojail
@


1.3
log
@Require initrandom rather than random, since random requires
mountcritlocal, which requires disks, which gbde_swap provides.

Noticed by:	brooks
@
text
@d8 1
a8 1
# KEYWORD: FreeBSD
@


1.2
log
@We don't really need a lockfile, and most likely can't create one at
this point.
@
text
@d7 1
a7 1
# REQUIRE: random
@


1.1
log
@Add support for initializing swap devices with random one-shot keys.  Note
that the keys are currently generated by computing the MD5 checksum of 512
bytes read from /dev/random, and are passed to gbde on the command line.

Sponsored by:	Teleplan AS
@
text
@d29 2
a30 5
		lockfile="/var/run/${device##*/}.lock"
		gbde init "${device}" -L "${lockfile}" -P "${passphrase}" ||
			return 1
		gbde attach "${device}" -l "${lockfile}" -p "${passphrase}" ||
			return 1
@

