[arch-commits] Commit in cryptsetup/trunk (PKGBUILD encrypt_hook encrypt_install)
Thomas Bächler
thomas at archlinux.org
Fri Feb 5 22:53:48 UTC 2010
Date: Friday, February 5, 2010 @ 17:53:48
Author: thomas
Revision: 67245
Prepare for mkinitcpio 0.6
Modified:
cryptsetup/trunk/PKGBUILD
cryptsetup/trunk/encrypt_hook
cryptsetup/trunk/encrypt_install
-----------------+
PKGBUILD | 12 ++++-----
encrypt_hook | 70 +++++++++++++++++++++++++++---------------------------
encrypt_install | 10 +++++--
3 files changed, 49 insertions(+), 43 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2010-02-05 22:51:54 UTC (rev 67244)
+++ PKGBUILD 2010-02-05 22:53:48 UTC (rev 67245)
@@ -2,24 +2,24 @@
# Maintainer: Thomas Bächler <thomas at archlinux.org>
pkgname=cryptsetup
pkgver=1.1.0
-pkgrel=1
+pkgrel=2
pkgdesc="Userspace setup tool for transparent encryption of block devices using the Linux 2.6 cryptoapi"
arch=(i686 x86_64)
license=('GPL')
url="http://code.google.com/p/cryptsetup/"
groups=('base')
depends=('device-mapper' 'libgcrypt' 'popt' 'e2fsprogs')
-conflicts=('mkinitcpio<0.5.24.99')
+conflicts=('mkinitcpio<0.5.99')
options=('!libtool' '!emptydirs')
source=(http://cryptsetup.googlecode.com/files/${pkgname}-${pkgver}.tar.bz2
encrypt_hook
encrypt_install)
sha256sums=('b343fa6bf3c48b633e68da25e44aebd6a32a3dc21c10604acd6faa04e41f58f3'
- 'b2a8ee13156b7962b48186c97080421336fd3b9641a7711b89bcc49ab73dc62a'
- 'fa76c48065e26109592431867f468721c360d481dcb0bdc0adc49e750171faa2')
+ '64601eae6fbf3e3afceccec5877557aa208a82497c33cc94ad0a686b4022b5dc'
+ '8e4920bb4b5ce96508aa0c42b9b07326b70daf630519f1aa1d8082bca709c12a')
md5sums=('8177f1833f4d6aaacc5812046d2010b6'
- '6bdb1b83539453d403335aed1a579a5c'
- '24b76e9cb938bc3c8dcff396cbab28c7')
+ '1b25c0aca2cfd0306dd70de1888cb5b8'
+ '69af34d82690ce8204ce2d249c24be7a')
build() {
cd $srcdir/$pkgname-${pkgver}
Modified: encrypt_hook
===================================================================
--- encrypt_hook 2010-02-05 22:51:54 UTC (rev 67244)
+++ encrypt_hook 2010-02-05 22:53:48 UTC (rev 67245)
@@ -5,16 +5,17 @@
{
/sbin/modprobe -a -q dm-crypt >/dev/null 2>&1
if [ -e "/sys/class/misc/device-mapper" ]; then
- if [ ! -c "/dev/mapper/control" ]; then
- read dev_t < /sys/class/misc/device-mapper/dev
- /bin/mknod "/dev/mapper/control" c $(/bin/replace "${dev_t}" ':')
+ if [ ! -e "/dev/mapper/control" ]; then
+ /bin/mknod "/dev/mapper/control" c $(cat /sys/class/misc/device-mapper/dev | sed 's|:| |')
fi
[ "${quiet}" = "y" ] && CSQUIET=">/dev/null"
# Get keyfile if specified
ckeyfile="/crypto_keyfile.bin"
if [ "x${cryptkey}" != "x" ]; then
- set -- $(/bin/replace "${cryptkey}" ':'); ckdev=$1; ckarg1=$2; ckarg2=$3
+ ckdev="$(echo "${cryptkey}" | cut -d: -f1)"
+ ckarg1="$(echo "${cryptkey}" | cut -d: -f2)"
+ ckarg2="$(echo "${cryptkey}" | cut -d: -f3)"
if poll_device "${ckdev}" ${rootdelay}; then
case ${ckarg1} in
*[!0-9]*)
@@ -37,7 +38,8 @@
if [ -n "${cryptdevice}" ]; then
DEPRECATED_CRYPT=0
- set -- $(/bin/replace "${cryptdevice}" ':'); cryptdev="$1"; cryptname="$2";
+ cryptdev="$(echo "${cryptdevice}" | cut -d: -f1)"
+ cryptname="$(echo "${cryptdevice}" | cut -d: -f2)"
else
DEPRECATED_CRYPT=1
cryptdev="${root}"
@@ -50,12 +52,12 @@
}
if poll_device "${cryptdev}" ${rootdelay}; then
- if /bin/cryptsetup isLuks ${cryptdev} >/dev/null 2>&1; then
+ if /sbin/cryptsetup isLuks ${cryptdev} >/dev/null 2>&1; then
[ ${DEPRECATED_CRYPT} -eq 1 ] && warn_deprecated
dopassphrase=1
# If keyfile exists, try to use that
if [ -f ${ckeyfile} ]; then
- if eval /bin/cryptsetup --key-file ${ckeyfile} luksOpen ${cryptdev} ${cryptname} ${CSQUIET}; then
+ if eval /sbin/cryptsetup --key-file ${ckeyfile} luksOpen ${cryptdev} ${cryptname} ${CSQUIET}; then
dopassphrase=0
else
echo "Invalid keyfile. Reverting to passphrase."
@@ -67,7 +69,7 @@
echo "A password is required to access the ${cryptname} volume:"
#loop until we get a real password
- while ! eval /bin/cryptsetup luksOpen ${cryptdev} ${cryptname} ${CSQUIET}; do
+ while ! eval /sbin/cryptsetup luksOpen ${cryptdev} ${cryptname} ${CSQUIET}; do
sleep 2;
done
fi
@@ -79,33 +81,33 @@
err "Password succeeded, but ${cryptname} creation failed, aborting..."
exit 1
fi
- elif [ "x${crypto}" != "x" ]; then
+ elif [ -n "${crypto}" ]; then
[ ${DEPRECATED_CRYPT} -eq 1 ] && warn_deprecated
- do_oldcrypto ()
- {
- if [ $# -ne 5 ]; then
- err "Verify parameter format: crypto=hash:cipher:keysize:offset:skip"
- err "Non-LUKS decryption not attempted..."
- return 1
- fi
- exe="/bin/cryptsetup create ${cryptname} ${cryptdev}"
- [ "x$(eval echo ${1})" != "x" ] && exe="${exe} --hash \"$(eval echo ${1})\""
- [ "x$(eval echo ${2})" != "x" ] && exe="${exe} --cipher \"$(eval echo ${2})\""
- [ "x$(eval echo ${3})" != "x" ] && exe="${exe} --key-size \"$(eval echo ${3})\""
- [ "x$(eval echo ${4})" != "x" ] && exe="${exe} --offset \"$(eval echo ${4})\""
- [ "x$(eval echo ${5})" != "x" ] && exe="${exe} --skip \"$(eval echo ${5})\""
- if [ -f ${ckeyfile} ]; then
- exe="${exe} --key-file ${ckeyfile}"
- else
- exe="${exe} --verify-passphrase"
- echo ""
- echo "A password is required to access the ${cryptname} volume:"
- fi
- eval "${exe} ${CSQUIET}"
- }
-
msg "Non-LUKS encrypted device found..."
- do_oldcrypto $(/bin/replace -q "${crypto}" ':')
+ if [ $# -ne 5 ]; then
+ err "Verify parameter format: crypto=hash:cipher:keysize:offset:skip"
+ err "Non-LUKS decryption not attempted..."
+ return 1
+ fi
+ exe="/sbin/cryptsetup create ${cryptname} ${cryptdev}"
+ tmp=$(echo "${crypto}" | cut -d: -f1)
+ [ -n "${tmp}" ] && exe="${exe} --hash \"${tmp}\""
+ tmp=$(echo "${crypto}" | cut -d: -f2)
+ [ -n "${tmp}" ] && exe="${exe} --cipher \"${tmp}\""
+ tmp=$(echo "${crypto}" | cut -d: -f3)
+ [ -n "${tmp}" ] && exe="${exe} --key-size \"${tmp}\""
+ tmp=$(echo "${crypto}" | cut -d: -f4)
+ [ -n "${tmp}" ] && exe="${exe} --offset \"${tmp}\""
+ tmp=$(echo "${crypto}" | cut -d: -f5)
+ [ -n "${tmp}" ] && exe="${exe} --skip \"${tmp}\""
+ if [ -f ${ckeyfile} ]; then
+ exe="${exe} --key-file ${ckeyfile}"
+ else
+ exe="${exe} --verify-passphrase"
+ echo ""
+ echo "A password is required to access the ${cryptname} volume:"
+ fi
+ eval "${exe} ${CSQUIET}"
if [ $? -ne 0 ]; then
err "Non-LUKS device decryption failed. verify format: "
@@ -124,6 +126,6 @@
err "Failed to open encryption mapping: The device ${cryptdev} is not a LUKS volume and the crypto= paramater was not specified."
fi
fi
- nuke ${ckeyfile}
+ rm -f ${ckeyfile}
fi
}
Modified: encrypt_install
===================================================================
--- encrypt_install 2010-02-05 22:51:54 UTC (rev 67244)
+++ encrypt_install 2010-02-05 22:53:48 UTC (rev 67245)
@@ -7,11 +7,15 @@
else
MODULES=" dm-crypt ${CRYPTO_MODULES} "
fi
- BINARIES=""
- add_dir "/dev/mapper"
- add_file "/sbin/cryptsetup.static" "/bin/cryptsetup"
FILES=""
SCRIPT="encrypt"
+ add_dir "/dev/mapper"
+ [ -f "/sbin/cryptsetup" ] && add_binary "/sbin/cryptsetup" "/sbin/cryptsetup"
+ [ -f "/usr/sbin/cryptsetup" ] && add_binary "/usr/sbin/cryptsetup" "/sbin/cryptsetup"
+ add_binary "/sbin/dmsetup"
+ add_file "/lib/udev/rules.d/10-dm.rules"
+ add_file "/lib/udev/rules.d/13-dm-disk.rules"
+ add_file "/lib/udev/rules.d/95-dm-notify.rules"
}
help ()
More information about the arch-commits
mailing list