summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Villavicencio <the_paya@gentoo.org>2010-04-04 21:04:19 +0000
committerJavier Villavicencio <the_paya@gentoo.org>2010-04-04 21:04:19 +0000
commit1344e3d382e995534c46915b7cbf51ea1ccef9d8 (patch)
tree5163d05aea8a560649495619988fd08e198e19d7 /sys-freebsd/freebsd-cddl
parentSet SUPPORT_PYTHON_ABIS. (diff)
downloadgentoo-2-1344e3d382e995534c46915b7cbf51ea1ccef9d8.tar.gz
gentoo-2-1344e3d382e995534c46915b7cbf51ea1ccef9d8.tar.bz2
gentoo-2-1344e3d382e995534c46915b7cbf51ea1ccef9d8.zip
New init.d script to start zfs volumes and swap.
(Portage version: 2.2_rc67/cvs/FreeBSD i386)
Diffstat (limited to 'sys-freebsd/freebsd-cddl')
-rw-r--r--sys-freebsd/freebsd-cddl/ChangeLog6
-rwxr-xr-xsys-freebsd/freebsd-cddl/files/zvol.initd47
-rw-r--r--sys-freebsd/freebsd-cddl/freebsd-cddl-8.0.ebuild8
3 files changed, 59 insertions, 2 deletions
diff --git a/sys-freebsd/freebsd-cddl/ChangeLog b/sys-freebsd/freebsd-cddl/ChangeLog
index a032eea9a669..f11fb5d6beef 100644
--- a/sys-freebsd/freebsd-cddl/ChangeLog
+++ b/sys-freebsd/freebsd-cddl/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for sys-freebsd/freebsd-cddl
# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-cddl/ChangeLog,v 1.9 2010/03/19 11:50:41 aballier Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-cddl/ChangeLog,v 1.10 2010/04/04 21:04:18 the_paya Exp $
+
+ 04 Apr 2010; Javier Villavicencio <the_paya@gentoo.org>
+ freebsd-cddl-8.0.ebuild, +files/zvol.initd:
+ Add script to initialize zfs volumes and activate swap when required.
*freebsd-cddl-8.0 (19 Mar 2010)
diff --git a/sys-freebsd/freebsd-cddl/files/zvol.initd b/sys-freebsd/freebsd-cddl/files/zvol.initd
new file mode 100755
index 000000000000..31c85cc273db
--- /dev/null
+++ b/sys-freebsd/freebsd-cddl/files/zvol.initd
@@ -0,0 +1,47 @@
+#!/sbin/runscript
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-cddl/files/zvol.initd,v 1.1 2010/04/04 21:04:19 the_paya Exp $
+
+depend() {
+ need hostid
+ before fsck
+}
+
+start() {
+ einfo "Starting zfs volumes..."
+ zfs volinit
+ eend $?
+ # Enable swap on ZVOLs that have org.freebsd:swap=on.
+ zfs list -H -o org.freebsd:swap,name -t volume | \
+ while read state name; do
+ case "${state}" in
+ [oO][nN])
+ einfo "Enabling swap on zvol ${name}"
+ swapon /dev/zvol/${name}
+ eend $?
+ ;;
+ esac
+ done
+}
+
+stop() {
+ # Disable what we had enabled before.
+ zfs list -H -o org.freebsd:swap,name -t volume | \
+ while read state name; do
+ case "${state}" in
+ [oO][nN])
+ einfo "Disabling swap on zvol ${name}"
+ swapoff /dev/zvol/${name}
+ eend $?
+ ;;
+ esac
+ done
+ einfo "Stopping zfs volumes..."
+ zfs volfini
+ eend $?
+}
+
+restart() {
+
+}
diff --git a/sys-freebsd/freebsd-cddl/freebsd-cddl-8.0.ebuild b/sys-freebsd/freebsd-cddl/freebsd-cddl-8.0.ebuild
index 5ba1ed32ce44..b8d52a60d30b 100644
--- a/sys-freebsd/freebsd-cddl/freebsd-cddl-8.0.ebuild
+++ b/sys-freebsd/freebsd-cddl/freebsd-cddl-8.0.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-cddl/freebsd-cddl-8.0.ebuild,v 1.1 2010/03/19 11:50:41 aballier Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-cddl/freebsd-cddl-8.0.ebuild,v 1.2 2010/04/04 21:04:18 the_paya Exp $
inherit bsdmk freebsd flag-o-matic eutils
@@ -41,3 +41,9 @@ src_unpack() {
# Link in include headers.
ln -s "/usr/include" "${WORKDIR}/include" || die "Symlinking /usr/include.."
}
+
+src_install() {
+ freebsd_src_install
+ # Install zfs volinit script.
+ newinitd "${FILESDIR}"/zvol.initd zvol
+}