--- 1.0.5-dmcrypt.rc 2010-01-26 20:27:34.000000000 -0500 +++ 1.0.5-dmcrypt.rc 2010-01-26 20:30:19.000000000 -0500 @@ -3,15 +3,23 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/sys-fs/cryptsetup/files/1.0.5-dmcrypt.rc,v 1.3 2008/02/01 12:38:44 flameeyes Exp $ +# Check for OpenRC/Baselayout 2 - see bug #270646 +is_openrc() { + [ -f /lib/librc.so -o -f /etc/init.d/sysfs -o -f /lib/rc/version ] +} + + depend() { before checkfs fsck - if [ -e /lib/librc.so ]; then - need device-mapper + # Necessary for services when using baselayout-2 + # but conflict for baselayout-1 + if is_openrc; then + need device-mapper fi } start() { - if [ ! -e /lib/librc.so ]; then + if ! is_openrc; then eerror "The ${myservice} init script is written for baselayout-2" eerror "Please do not use it with baselayout-1" return 1 @@ -21,7 +29,7 @@ } stop() { - if [ ! -e /lib/librc.so ]; then + if ! is_openrc; then return 0 fi