[arch-commits] Commit in cryptsetup/trunk (PKGBUILD encrypt_hook)

Thomas Bächler thomas at archlinux.org
Sun Oct 30 19:08:05 EDT 2011


    Date: Sunday, October 30, 2011 @ 19:08:05
  Author: thomas
Revision: 141488

upgpkg: cryptsetup 1.4.0-1

upstream update + add --allow-discards support to the encrypt hook

Modified:
  cryptsetup/trunk/PKGBUILD
  cryptsetup/trunk/encrypt_hook

--------------+
 PKGBUILD     |   11 +++++------
 encrypt_hook |   22 +++++++++++++++++++---
 2 files changed, 24 insertions(+), 9 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2011-10-30 22:51:16 UTC (rev 141487)
+++ PKGBUILD	2011-10-30 23:08:05 UTC (rev 141488)
@@ -1,9 +1,9 @@
 # $Id$
 # Maintainer: Thomas Bächler <thomas at archlinux.org>
 pkgname=cryptsetup
-pkgver=1.3.1
-pkgrel=2
-pkgdesc="Userspace setup tool for transparent encryption of block devices using the Linux 2.6 cryptoapi"
+pkgver=1.4.0
+pkgrel=1
+pkgdesc="Userspace setup tool for transparent encryption of block devices using dm-crypt"
 arch=(i686 x86_64)
 license=('GPL')
 url="http://code.google.com/p/cryptsetup/"
@@ -14,10 +14,9 @@
 source=(http://cryptsetup.googlecode.com/files/${pkgname}-${pkgver}.tar.bz2
         encrypt_hook
 	encrypt_install)
-sha256sums=('7ceb18a0c91fa1546077b41b93463dd2ec9d7f83e6fd93757fb84cc608206a6a'
-            'b8269d358363eb8d67d1ffa1469068e454a89154636283bcc3edc6486b7fff4e'
+sha256sums=('96d682853c8019cfeae0b21250cd2d00af42e46251807e8dbda2ff8427c2e9ed'
+            '811bbea1337106ad811731c746d73ee81039bad00aef52398e3a377ad0766757'
             'd4380195351b70abf8fcb3cd19461879c55a7a07e4915d1f0365b295b112a573')
-
 build() {
   cd $srcdir/$pkgname-${pkgver}
   ./configure --prefix=/usr --disable-static --sbindir=/sbin --libdir=/lib

Modified: encrypt_hook
===================================================================
--- encrypt_hook	2011-10-30 22:51:16 UTC (rev 141487)
+++ encrypt_hook	2011-10-30 23:08:05 UTC (rev 141488)
@@ -41,6 +41,7 @@
             DEPRECATED_CRYPT=0
             cryptdev="$(echo "${cryptdevice}" | cut -d: -f1)"
             cryptname="$(echo "${cryptdevice}" | cut -d: -f2)"
+            cryptoptions="$(echo "${cryptdevice}" | cut -d: -f3)"
         else
             DEPRECATED_CRYPT=1
             cryptdev="${root}"
@@ -52,13 +53,28 @@
             echo "Use 'cryptdevice=${root}:root root=/dev/mapper/root' instead."
         }
 
+        OLDIFS="${IFS}"
+        IFS=","
+        for cryptopt in ${cryptoptions}; do
+            case ${cryptopt} in
+                allow-discards)
+                    echo "Enabling TRIM/discard support."
+                    cryptargs="${cryptargs} --allow-discards"
+                    ;;
+                *)
+                    echo "Encryption option '${cryptopt}' not known, ignoring." >&2
+                    ;;
+            esac
+        done
+        IFS="${OLDIFS}"
+
         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
+                    if eval /sbin/cryptsetup --key-file ${ckeyfile} luksOpen ${cryptdev} ${cryptname} ${cryptargs} ${CSQUIET}; then
                         dopassphrase=0
                     else
                         echo "Invalid keyfile. Reverting to passphrase."
@@ -70,7 +86,7 @@
                     echo "A password is required to access the ${cryptname} volume:"
 
                     #loop until we get a real password
-                    while ! eval /sbin/cryptsetup luksOpen ${cryptdev} ${cryptname} ${CSQUIET}; do
+                    while ! eval /sbin/cryptsetup luksOpen ${cryptdev} ${cryptname} ${cryptargs} ${CSQUIET}; do
                         sleep 2;
                     done
                 fi
@@ -90,7 +106,7 @@
                     err "Non-LUKS decryption not attempted..."
                     return 1
                 fi
-                exe="/sbin/cryptsetup create ${cryptname} ${cryptdev}"
+                exe="/sbin/cryptsetup create ${cryptname} ${cryptdev} ${cryptargs}"
                 tmp=$(echo "${crypto}" | cut -d: -f1)
                 [ -n "${tmp}" ] && exe="${exe} --hash \"${tmp}\""
                 tmp=$(echo "${crypto}" | cut -d: -f2)



More information about the arch-commits mailing list