From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org)
	by finch.gentoo.org with esmtp (Exim 4.77)
	(envelope-from <gentoo-commits+bounces-485959-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1SqU6K-0002kq-1W
	for garchives@archives.gentoo.org; Sun, 15 Jul 2012 19:03:28 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 5F5CAE0747;
	Sun, 15 Jul 2012 19:03:15 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	by pigeon.gentoo.org (Postfix) with ESMTP id 2BB62E0747
	for <gentoo-commits@lists.gentoo.org>; Sun, 15 Jul 2012 19:03:15 +0000 (UTC)
Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163])
	(using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 903661B4155
	for <gentoo-commits@lists.gentoo.org>; Sun, 15 Jul 2012 19:03:14 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by hornbill.gentoo.org (Postfix) with ESMTP id 533B7E5434
	for <gentoo-commits@lists.gentoo.org>; Sun, 15 Jul 2012 19:03:13 +0000 (UTC)
From: "William Hubbs" <williamh@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" <williamh@gentoo.org>
Message-ID: <1342378677.0730ac61e8e674c5751ff8fa3857184326a40460.WilliamH@OpenRC>
Subject: [gentoo-commits] proj/openrc:master commit in: init.d/
X-VCS-Repository: proj/openrc
X-VCS-Files: init.d/Makefile init.d/encswap.in
X-VCS-Directories: init.d/
X-VCS-Committer: WilliamH
X-VCS-Committer-Name: William Hubbs
X-VCS-Revision: 0730ac61e8e674c5751ff8fa3857184326a40460
X-VCS-Branch: master
Date: Sun, 15 Jul 2012 19:03:13 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: quoted-printable
X-Archives-Salt: e113446f-1c69-438a-8a22-1f6df74d922f
X-Archives-Hash: 81c74de1ab0065160e9ac9ad7bfcc08d

commit:     0730ac61e8e674c5751ff8fa3857184326a40460
Author:     Richard Yao <ryao <AT> cs <DOT> stonybrook <DOT> edu>
AuthorDate: Sun Jul 15 12:47:00 2012 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sun Jul 15 18:57:57 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=3Dproj/openrc.git;a=3D=
commit;h=3D0730ac61

Import encswap init script from FreeBSD

The FreeBSD encswap init script has been adapted to function in OpenRC. I=
t
should function identically to its FreeBSD counterpart.

---
 init.d/Makefile   |    4 ++--
 init.d/encswap.in |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/init.d/Makefile b/init.d/Makefile
index a34ee90..d192749 100644
--- a/init.d/Makefile
+++ b/init.d/Makefile
@@ -22,8 +22,8 @@ NET_LO-FreeBSD=3D	net.lo0
 SRCS-FreeBSD=3D	hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabl=
ed.in \
 		rpcbind.in savecore.in syslogd.in
 # These are FreeBSD specific
-SRCS-FreeBSD+=3D	adjkerntz.in devd.in dumpon.in ipfw.in mixer.in nscd.in=
 \
-		powerd.in syscons.in
+SRCS-FreeBSD+=3D	adjkerntz.in devd.in dumpon.in encswap.in ipfw.in \
+		mixer.in nscd.in powerd.in syscons.in
=20
 NET_LO-Linux=3D	net.lo
 SRCS-Linux=3D	devfs.in dmesg.in hwclock.in consolefont.in keymaps.in \

diff --git a/init.d/encswap.in b/init.d/encswap.in
new file mode 100644
index 0000000..a03fe58
--- /dev/null
+++ b/init.d/encswap.in
@@ -0,0 +1,46 @@
+#!@PREFIX@/sbin/runscript
+# Copyright 1992-2012 FreeBSD Project
+# Released under the 2-clause BSD license
+# $Header: $
+
+depend() {
+	before swap
+}
+
+start() {
+	while read device mountpoint type options rest ; do
+		case ":${device}:${type}:${options}" in
+		:#*)
+			continue
+			;;
+		*.bde:swap:sw)
+			passphrase=3D`dd if=3D/dev/random count=3D1 2>/dev/null | md5 -q`
+			device=3D"${device%.bde}"
+			gbde init "${device}" -P "${passphrase}" || return 1
+			gbde attach "${device}" -p "${passphrase}" || return 1
+			;;
+		*.eli:swap:sw)
+			device=3D"${device%.eli}"
+			geli onetime ${geli_swap_flags} "${device}" || return 1
+			;;
+		esac
+	done < /etc/fstab
+}
+
+stop() {
+	while read device mountpoint type options rest ; do
+		case ":${device}:${type}:${options}" in
+		:#*)
+			continue
+			;;
+		*.bde:swap:sw)
+			device=3D"${device%.bde}"
+			gbde detach "${device}"
+			;;
+		*.eli:swap:sw)
+			# Nothing here, because geli swap devices should be
+			# created with the auto-detach-on-last-close option.
+			;;
+		esac
+	done < /etc/fstab
+}