summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-01-12 23:36:42 +0000
committerMike Frysinger <vapier@gentoo.org>2011-01-12 23:36:42 +0000
commit4dc5f20975ec79734f2d67bf4015c89075ab2e2c (patch)
treefb6bd22f8ce74ff0163bb32f4b1a3b6fa8b23e4f /sys-fs/cryptsetup/files
parentInitial commit, ebuild by Leo, Jean-Baptiste Rouault and Vadim Fint, bug 159684 (diff)
downloadgentoo-2-4dc5f20975ec79734f2d67bf4015c89075ab2e2c.tar.gz
gentoo-2-4dc5f20975ec79734f2d67bf4015c89075ab2e2c.tar.bz2
gentoo-2-4dc5f20975ec79734f2d67bf4015c89075ab2e2c.zip
Push out updated addon to fix baselayout-2 support #350399 by Martin Kolleck.
(Portage version: 2.2.0_alpha13/cvs/Linux x86_64, RepoMan options: --force)
Diffstat (limited to 'sys-fs/cryptsetup/files')
-rw-r--r--sys-fs/cryptsetup/files/1.1.3-dm-crypt-start.sh41
-rw-r--r--sys-fs/cryptsetup/files/1.1.3-dm-crypt-stop.sh20
2 files changed, 34 insertions, 27 deletions
diff --git a/sys-fs/cryptsetup/files/1.1.3-dm-crypt-start.sh b/sys-fs/cryptsetup/files/1.1.3-dm-crypt-start.sh
index 536f3dfaa944..c78f0bcaedaf 100644
--- a/sys-fs/cryptsetup/files/1.1.3-dm-crypt-start.sh
+++ b/sys-fs/cryptsetup/files/1.1.3-dm-crypt-start.sh
@@ -1,20 +1,19 @@
# /lib/rcscripts/addons/dm-crypt-start.sh
-# For backwards compatability with baselayout < 1.13.0 #174256
-if [[ -z ${SVCNAME} ]] ; then
- case ${myservice} in
- ""|checkfs|localmount) SVCNAME=dmcrypt ;;
- *) SVCNAME=${myservice} ;;
- esac
-fi
-
-dm_crypt_execute_checkfs() {
- dm_crypt_execute_dmcrypt
-}
-
-dm_crypt_execute_volumes() {
- dm_crypt_execute_dmcrypt
-}
+# For backwards compatibility with baselayout < 1.13.0 #174256
+: ${SVCNAME:=${myservice}}
+
+# We might be hooked into init.d scripts (ala baselayout-1), or we might
+# be a standalone dmcrypt script. We support multiple dmcrypt instances,
+# but they must start with "dmcrypt." to be detected that way. It keeps
+# our lives much simpler with this multiplexed arrangement.
+execute_hook="dm_crypt_execute_dmcrypt"
+conf_file="dmcrypt"
+case ${SVCNAME} in
+ localmount) execute_hook="dm_crypt_execute_localmount" ;;
+ dmcrypt.*) conf_file="${SVCNAME}" ;;
+esac
+conf_file="/etc/conf.d/${conf_file}"
# Setup mappings for an individual target/swap
# Note: This relies on variables localized in the main body below.
@@ -260,7 +259,7 @@ do
esac
done
-if [[ -f /etc/conf.d/${SVCNAME} ]] && [[ -x /sbin/cryptsetup ]] ; then
+if [[ -f ${conf_file} ]] && [[ -x /sbin/cryptsetup ]] ; then
ebegin "Setting up dm-crypt mappings"
while read -u 3 targetline ; do
@@ -271,7 +270,7 @@ if [[ -f /etc/conf.d/${SVCNAME} ]] && [[ -x /sbin/cryptsetup ]] ; then
case ${targetline} in
target=*|swap=*)
# If we have a target queued up, then execute it
- dm_crypt_execute_${SVCNAME%.*}
+ ${execute_hook}
# Prepare for the next target/swap by resetting variables
unset gpg_options key loop_file target options pre_mount post_mount source swap remdev
@@ -290,16 +289,16 @@ if [[ -f /etc/conf.d/${SVCNAME} ]] && [[ -x /sbin/cryptsetup ]] ; then
;;
*)
- ewarn "Skipping invalid line in /etc/conf.d/${SVCNAME}: ${targetline}"
+ ewarn "Skipping invalid line in ${conf_file}: ${targetline}"
;;
esac
- # Queue this setting for the next call to dm_crypt_execute_${SVCNAME%.*}
+ # Queue this setting for the next call to dm_crypt_execute_xxx
eval "${targetline}"
- done 3< /etc/conf.d/${SVCNAME}
+ done 3< ${conf_file}
# If we have a target queued up, then execute it
- dm_crypt_execute_${SVCNAME%.*}
+ ${execute_hook}
ewend ${cryptfs_status} "Failed to setup dm-crypt devices"
fi
diff --git a/sys-fs/cryptsetup/files/1.1.3-dm-crypt-stop.sh b/sys-fs/cryptsetup/files/1.1.3-dm-crypt-stop.sh
index 138688bced2e..548269c0ae3b 100644
--- a/sys-fs/cryptsetup/files/1.1.3-dm-crypt-stop.sh
+++ b/sys-fs/cryptsetup/files/1.1.3-dm-crypt-stop.sh
@@ -1,15 +1,23 @@
# /lib/rcscripts/addons/dm-crypt-stop.sh
-# Fix for baselayout-1.12.10 (bug 174256)
+# For backwards compatibility with baselayout < 1.13.0 #174256
: ${SVCNAME:=${myservice}}
+# See notes in dm-crypt-start.sh
+execute_hook="dm_crypt_execute_dmcrypt"
+conf_file="dmcrypt"
+case ${SVCNAME} in
+ dmcrypt.*) conf_file="${SVCNAME}" ;;
+esac
+conf_file="/etc/conf.d/${conf_file}"
+
# Try to remove any dm-crypt mappings
csetup=/sbin/cryptsetup
-if [ -f /etc/conf.d/${SVCNAME} ] && [ -x "$csetup" ]
+if [ -f ${conf_file} ] && [ -x "$csetup" ]
then
einfo "Removing dm-crypt mappings"
- /bin/egrep "^(target|swap)" /etc/conf.d/${SVCNAME} | \
+ /bin/egrep "^(target|swap)" ${conf_file} | \
while read targetline
do
target=
@@ -18,16 +26,16 @@ then
eval ${targetline}
[ -n "${swap}" ] && target=${swap}
- [ -z "${target}" ] && ewarn "Invalid line in /etc/conf.d/${SVCNAME}: ${targetline}"
+ [ -z "${target}" ] && ewarn "Invalid line in ${conf_file}: ${targetline}"
ebegin "Removing dm-crypt mapping for: ${target}"
${csetup} remove ${target}
eend $? "Failed to remove dm-crypt mapping for: ${target}"
done
- if [[ -n $(/bin/egrep -e "^(source=)./dev/loop*" /etc/conf.d/${SVCNAME}) ]] ; then
+ if [[ -n $(/bin/egrep -e "^(source=)./dev/loop*" ${conf_file}) ]] ; then
einfo "Taking down any dm-crypt loop devices"
- /bin/egrep -e "^(source)" /etc/conf.d/${SVCNAME} | while read sourceline
+ /bin/egrep -e "^(source)" ${conf_file} | while read sourceline
do
source=
eval ${sourceline}