summaryrefslogtreecommitdiffstats
path: root/abs/core
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core')
-rw-r--r--abs/core/cryptsetup/PKGBUILD53
-rw-r--r--abs/core/cryptsetup/encrypt_hook131
-rw-r--r--abs/core/cryptsetup/encrypt_install10
3 files changed, 102 insertions, 92 deletions
diff --git a/abs/core/cryptsetup/PKGBUILD b/abs/core/cryptsetup/PKGBUILD
index ff5f83f..ceb826d 100644
--- a/abs/core/cryptsetup/PKGBUILD
+++ b/abs/core/cryptsetup/PKGBUILD
@@ -1,39 +1,36 @@
-# $Id: PKGBUILD 356 2008-04-18 22:56:27Z aaron $
-# Maintainer: Judd Vinet <jvinet@zeroflux.org>
+# $Id: PKGBUILD 85278 2010-07-11 10:36:02Z thomas $
+# Maintainer: Thomas Bächler <thomas@archlinux.org>
pkgname=cryptsetup
-pkgver=1.0.6
-pkgrel=10
+pkgver=1.1.3
+pkgrel=1
pkgdesc="Userspace setup tool for transparent encryption of block devices using the Linux 2.6 cryptoapi"
-arch=(i686 x86_64)
+arch=('i686' 'x86_64')
license=('GPL')
-url="http://luks.endorphin.org/dm-crypt"
+url="http://code.google.com/p/cryptsetup/"
groups=('base')
-depends=('device-mapper' 'libgcrypt' 'popt' 'e2fsprogs')
+depends=('device-mapper' 'libgcrypt' 'popt')
+conflicts=('mkinitcpio<0.5.99')
options=('!libtool' '!emptydirs')
-source=(http://luks.endorphin.org/source/cryptsetup-$pkgver.tar.bz2
+source=(http://cryptsetup.googlecode.com/files/${pkgname}-${pkgver}.tar.bz2
encrypt_hook
- encrypt_install
- luksOpen-status.patch)
-md5sums=('00d452eb7a76e39f5749545d48934a10'
- '40fee2419cd444cfb283c311f9555d2d'
- '24b76e9cb938bc3c8dcff396cbab28c7'
- 'd4be8d2059d5427c057be4de4e948887')
+ encrypt_install)
+sha256sums=('9c8e68a272f6d9cfb6cd65cc0743f4c44a2096c61f74e0602bf40208b5e69c0a'
+ '64601eae6fbf3e3afceccec5877557aa208a82497c33cc94ad0a686b4022b5dc'
+ '8e4920bb4b5ce96508aa0c42b9b07326b70daf630519f1aa1d8082bca709c12a')
build() {
- cd $startdir/src/$pkgname-$pkgver
- # suppress "Command successful" message on luksOpen
- patch -p1 -i $startdir/src/luksOpen-status.patch
- ./configure --prefix=/usr --disable-static
+ cd $srcdir/$pkgname-${pkgver}
+ ./configure --prefix=/usr --disable-static --sbindir=/sbin --libdir=/lib
make || return 1
- make DESTDIR=$startdir/pkg install
- # include a static cryptsetup binary for initrd setups
- make clean
- cd $startdir/src/$pkgname-$pkgver
- ./configure --prefix=/usr --enable-static
- make || return 1
- # include a static cryptsetup binary for initrd setups
- install -D -m755 src/cryptsetup $startdir/pkg/sbin/cryptsetup.static || return 1
+}
+
+package() {
+ cd $srcdir/$pkgname-${pkgver}
+ make DESTDIR=$pkgdir install || return 1
# install hook
- install -D -m644 $startdir/src/encrypt_hook $startdir/pkg/lib/initcpio/hooks/encrypt
- install -D -m644 $startdir/src/encrypt_install $startdir/pkg/lib/initcpio/install/encrypt
+ install -D -m644 $srcdir/encrypt_hook $pkgdir/lib/initcpio/hooks/encrypt
+ install -D -m644 $srcdir/encrypt_install $pkgdir/lib/initcpio/install/encrypt
+ # Fix pkgconfig location
+ install -d -m755 $pkgdir/usr/lib
+ mv $pkgdir/lib/pkgconfig $pkgdir/usr/lib/
}
diff --git a/abs/core/cryptsetup/encrypt_hook b/abs/core/cryptsetup/encrypt_hook
index 248f1f2..e84bc6e 100644
--- a/abs/core/cryptsetup/encrypt_hook
+++ b/abs/core/cryptsetup/encrypt_hook
@@ -5,23 +5,18 @@ run_hook ()
{
/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
- try=10
- echo "Waiting for ${ckdev} ..."
- while [ ! -b ${ckdev} -a ${try} -gt 0 ]; do
- sleep 1
- try=$((${try}-1))
- done
- if [ -b ${ckdev} ]; then
+ 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]*)
# Use a file on the device
@@ -42,54 +37,69 @@ run_hook ()
fi
if [ -n "${cryptdevice}" ]; then
- set -- $(/bin/replace "${cryptdevice}" ':'); cryptdev="$1"; cryptname="$2";
+ DEPRECATED_CRYPT=0
+ cryptdev="$(echo "${cryptdevice}" | cut -d: -f1)"
+ cryptname="$(echo "${cryptdevice}" | cut -d: -f2)"
else
+ DEPRECATED_CRYPT=1
cryptdev="${root}"
cryptname="root"
fi
- if /bin/cryptsetup isLuks ${cryptdev} >/dev/null 2>&1; then
- 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
- dopassphrase=0
- else
- echo "Invalid keyfile. Reverting to passphrase."
+ warn_deprecated() {
+ echo "The syntax 'root=${root}' where '${root}' is an encrypted volume is deprecated"
+ echo "Use 'cryptdevice=${root}:root root=/dev/mapper/root' instead."
+ }
+
+ if poll_device "${cryptdev}" ${rootdelay}; 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 /sbin/cryptsetup --key-file ${ckeyfile} luksOpen ${cryptdev} ${cryptname} ${CSQUIET}; then
+ dopassphrase=0
+ else
+ echo "Invalid keyfile. Reverting to passphrase."
+ fi
fi
- fi
- # Ask for a passphrase
- if [ ${dopassphrase} -gt 0 ]; then
- echo ""
- echo "A password is required to access the ${cryptname} volume:"
+ # Ask for a passphrase
+ if [ ${dopassphrase} -gt 0 ]; then
+ echo ""
+ 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
- sleep 2;
- done
- fi
- if [ -e "/dev/mapper/${cryptname}" ]; then
- if [ "${cryptname}" = "root" ]; then
- export root="/dev/mapper/root"
+ #loop until we get a real password
+ while ! eval /sbin/cryptsetup luksOpen ${cryptdev} ${cryptname} ${CSQUIET}; do
+ sleep 2;
+ done
fi
- else
- err "Password succeeded, but ${cryptname} creation failed, aborting..."
- exit 1
- fi
- elif [ "x${crypto}" != "x" ]; then
- do_oldcrypto ()
- {
+ if [ -e "/dev/mapper/${cryptname}" ]; then
+ if [ ${DEPRECATED_CRYPT} -eq 1 ]; then
+ export root="/dev/mapper/root"
+ fi
+ else
+ err "Password succeeded, but ${cryptname} creation failed, aborting..."
+ exit 1
+ fi
+ elif [ -n "${crypto}" ]; then
+ [ ${DEPRECATED_CRYPT} -eq 1 ] && warn_deprecated
+ msg "Non-LUKS encrypted device found..."
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})\""
+ 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
@@ -98,25 +108,24 @@ run_hook ()
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 0 ]; then
- err "Non-LUKS device decryption failed. verify format: "
- err " crypto=hash:cipher:keysize:offset:skip"
- exit 1
- fi
- if [ -e "/dev/mapper/${cryptname}" ]; then
- if [ "${cryptname}" = "root" ]; then
- export root="/dev/mapper/root"
+ if [ $? -ne 0 ]; then
+ err "Non-LUKS device decryption failed. verify format: "
+ err " crypto=hash:cipher:keysize:offset:skip"
+ exit 1
+ fi
+ if [ -e "/dev/mapper/${cryptname}" ]; then
+ if [ ${DEPRECATED_CRYPT} -eq 1 ]; then
+ export root="/dev/mapper/root"
+ fi
+ else
+ err "Password succeeded, but ${cryptname} creation failed, aborting..."
+ exit 1
fi
else
- err "Password succeeded, but ${cryptname} creation failed, aborting..."
- exit 1
+ 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
}
diff --git a/abs/core/cryptsetup/encrypt_install b/abs/core/cryptsetup/encrypt_install
index 28cfa3f..9446e68 100644
--- a/abs/core/cryptsetup/encrypt_install
+++ b/abs/core/cryptsetup/encrypt_install
@@ -7,11 +7,15 @@ install ()
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 ()