vapier 15/04/12 22:04:22 Modified: 1.0.6-dmcrypt.confd 1.5.1-dmcrypt.rc Log: Allow loopbacks to be allocated dynamically from a free one #282626 by Zeev Tarantov. (Portage version: 2.2.18/cvs/Linux x86_64, signed Manifest commit with key D2E96200)
Revision Changes Path 1.8 sys-fs/cryptsetup/files/1.0.6-dmcrypt.confd file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-fs/cryptsetup/files/1.0.6-dmcrypt.confd?rev=1.8&view=markup plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-fs/cryptsetup/files/1.0.6-dmcrypt.confd?rev=1.8&content-type=text/plain diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-fs/cryptsetup/files/1.0.6-dmcrypt.confd?r1=1.7&r2=1.8 Index: 1.0.6-dmcrypt.confd =================================================================== RCS file: /var/cvsroot/gentoo-x86/sys-fs/cryptsetup/files/1.0.6-dmcrypt.confd,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- 1.0.6-dmcrypt.confd 12 Apr 2015 21:44:38 -0000 1.7 +++ 1.0.6-dmcrypt.confd 12 Apr 2015 22:04:22 -0000 1.8 @@ -42,6 +42,8 @@ # gpg_options='<opts>' == Default are --quiet --decrypt # options='<opts>' == cryptsetup, for LUKS you can only use --readonly # loop_file='<file>' == Loopback file. +# Note: If you omit $source, then a free loopback will +# be looked up automatically. # pre_mount='cmds' == commands to execute before mounting partition. # post_mount='cmds' == commands to execute after mounting partition. #----------- 1.9 sys-fs/cryptsetup/files/1.5.1-dmcrypt.rc file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-fs/cryptsetup/files/1.5.1-dmcrypt.rc?rev=1.9&view=markup plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-fs/cryptsetup/files/1.5.1-dmcrypt.rc?rev=1.9&content-type=text/plain diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-fs/cryptsetup/files/1.5.1-dmcrypt.rc?r1=1.8&r2=1.9 Index: 1.5.1-dmcrypt.rc =================================================================== RCS file: /var/cvsroot/gentoo-x86/sys-fs/cryptsetup/files/1.5.1-dmcrypt.rc,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- 1.5.1-dmcrypt.rc 12 Apr 2015 21:44:38 -0000 1.8 +++ 1.5.1-dmcrypt.rc 12 Apr 2015 22:04:22 -0000 1.9 @@ -1,7 +1,7 @@ #!/sbin/runscript # Copyright 1999-2015 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-fs/cryptsetup/files/1.5.1-dmcrypt.rc,v 1.8 2015/04/12 21:44:38 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-fs/cryptsetup/files/1.5.1-dmcrypt.rc,v 1.9 2015/04/12 22:04:22 vapier Exp $ depend() { before checkfs fsck @@ -24,6 +24,24 @@ dm_crypt_execute() { local dev ret mode foo + if [ -z "${target}" -a -z "${swap}" ] ; then + return + fi + + # Handle automatic look up of the source path. + if [ -z "${source}" -a -n "${loop_file}" ] ; then + source=$(losetup --show -f "${loop_file}") + fi + case ${source} in + *=*) + source=$(blkid -l -t "${source}" -o device) + ;; + esac + if [ -z "${source}" ] || [ ! -e "${source}" ] ; then + ewarn "source \"${source}\" for ${target} missing, skipping..." + return + fi + if [ -n "${target}" ] ; then # let user set options, otherwise leave empty : ${options:=' '} @@ -37,17 +55,6 @@ # suspend2 users should have initramfs's init handling their swap partition either way. : ${options:='-c aes -h sha1 -d /dev/urandom'} : ${pre_mount:='mkswap ${dev}'} - else - return - fi - case ${source} in - *=*) - source=$(blkid -l -t "${source}" -o device) - ;; - esac - if [ -z "${source}" ] || [ ! -e "${source}" ] ; then - ewarn "source \"${source}\" for ${target} missing, skipping..." - return fi if [ -n "${loop_file}" ] ; then