~ubuntu-branches/ubuntu/karmic/cryptsetup/karmic

« back to all changes in this revision

Viewing changes to debian/initramfs/cryptroot-hook

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-06-14 23:28:51 UTC
  • Revision ID: james.westby@ubuntu.com-20080614232851-qejvx20e74d8t9wm
Tags: 2:1.0.6-2ubuntu1
* Merge new debian version. Remaining changes:
  - Add XSBC-Vcs-Bzr tag to indicate that this package is managed using
    bzr on launchpad.
  - debian/rules: cryptsetup is linked dynamically against libgcrypt and
    libgpg-error.
  - cryptdisks.functions: stop usplash on user input. LP #62751
  - Parse comments in lines not starting with '#', LP #185380
  - If the encrypted source device hasn't shown up yet, give it a
    little while to deal with removable devices. LP #164044
* Depend on race-free version of libdevmapper, thus making udevsettle
  call from cryptsetup binary unnecessary. Dropping patch
  debian/patches/06_run_udevsettle.patch
* remove patch from LP #73862, loading optimized modules has been solved
  in debian in another way.
* cryptdisk.functions: remove spurious call to load_optimized_module.
  LP: #239946
* bugfix: make regex work if keyfile has extended attributes. LP: #231339.
* remove patch in cryptdisks.functions for rexecing the script itself for
  ensuring that a tty is always available. (See LP #58794.) According to
  Scott, this is not necessary anymore.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
 
41
41
        # uswsusp
42
42
        if [ -e /etc/uswsusp.conf ]; then
43
 
                device=$(sed -rn 's/^resume device[[:space:]]*[:=][[:space:]]+// p' /etc/uswsusp.conf)
 
43
                device=$(sed -rn 's/^resume device[[:space:]]*[:=][[:space:]]*// p' /etc/uswsusp.conf)
44
44
                if [ -n "$device" ]; then
45
45
                        candidates="$candidates $device"
46
46
                fi
48
48
 
49
49
        # uswsusp - again...
50
50
        if [ -e /etc/suspend.conf ]; then
51
 
                device=$(sed -rn 's/^resume device[[:space:]]+[:=][[:space:]]+// p' /etc/suspend.conf)
 
51
                device=$(sed -rn 's/^resume device[[:space:]]*[:=][[:space:]]*// p' /etc/suspend.conf)
52
52
                if [ -n "$device" ]; then
53
53
                        candidates="$candidates $device"
54
54
                fi
218
218
                                ;;
219
219
                        keyscript=*)
220
220
                                opt=${opt#keyscript=}
221
 
                                if [ ! -x "$opt" ]; then
 
221
                                if [ ! -x "/lib/cryptsetup/scripts/$opt" ] && [ ! -x "$opt" ]; then
222
222
                                        echo "cryptsetup: WARNING: target $target has an invalid keyscript, skipped" >&2
223
223
                                        return 1
224
224
                                fi
225
225
                                KEYSCRIPT="$opt"
226
 
                                opt=$(basename "$opt")
227
 
                                OPTIONS="$OPTIONS,keyscript=/keyscripts/$opt"
 
226
                                OPTIONS="$OPTIONS,keyscript=/keyscripts/$(basename "$opt")"
228
227
                                ;;
229
228
                        tries=*)
230
229
                                OPTIONS="$OPTIONS,$opt"
264
263
        ivhash=$(echo "$value" | cut -d ":" -s -f2)
265
264
 
266
265
        if [ -n "$cipher" ]; then
267
 
                # Add assembly optimized module if it exists
268
 
                asm_module=`find "$MODULESDIR"/kernel/arch/ -name "$cipher"\*`
269
 
                if [ $asm_module ];then
270
 
                        echo `basename "$asm_module"|sed s/.ko//`
271
 
                else
272
 
                        echo "$cipher"
273
 
                fi
 
266
                echo "$cipher"
274
267
        else
275
268
                return 1
276
269
        fi
364
357
                        if [ ! -d "$DESTDIR/keyscripts" ]; then
365
358
                                mkdir "$DESTDIR/keyscripts"
366
359
                        fi
367
 
                        copy_exec "$KEYSCRIPT" /keyscripts
 
360
 
 
361
                        if [ -e "/lib/cryptsetup/scripts/$KEYSCRIPT" ]; then
 
362
                                copy_exec "/lib/cryptsetup/scripts/$KEYSCRIPT" /keyscripts
 
363
                        elif [ -e "$KEYSCRIPT" ]; then
 
364
                                copy_exec "$KEYSCRIPT" /keyscripts
 
365
                        else
 
366
                                echo "cryptsetup: WARNING: failed to find keyscript $KEYSCRIPT" >&2
 
367
                                continue
 
368
                        fi
368
369
                fi
369
370
 
370
371
                # Calculate needed modules
438
439
# Begin real processing
439
440
#
440
441
 
441
 
# Unless MODULES = "dep", we always add a basic subset of modules/tools
442
 
if [ "$MODULES" != "dep" ]; then
443
 
        for mod in dm_mod dm_crypt sha256 cbc; do
444
 
                manual_add_modules $mod
445
 
        done
446
 
 
447
 
        for mod in aes sha256 cbc; do
448
 
                add_crypto_modules $mod
449
 
        done
450
 
 
451
 
        copy_exec /sbin/cryptsetup /sbin
452
 
        copy_exec /sbin/dmsetup /sbin
453
 
fi
454
 
 
455
 
# We can't do anything without a config file
456
 
if [ ! -r /etc/crypttab ]; then
457
 
        exit 0
458
 
fi
459
 
 
460
 
# Find out which devices to add to the config file
461
 
rootdev=$(get_root_device)
462
 
if [ -z "$rootdev" ]; then
463
 
        echo "cryptsetup: WARNING: could not determine root device from /etc/fstab" >&2
464
 
fi
465
 
resumedevs=$(get_resume_devices)
466
 
if [ -z "$rootdev" ] && [ -z "$resumedevs" ]; then
467
 
        exit 0
 
442
setup="no"
 
443
rootdev=""
 
444
resumedevs=""
 
445
 
 
446
# Find the root and resume device(s)
 
447
if [ -r /etc/crypttab ]; then
 
448
        rootdev=$(get_root_device)
 
449
        if [ -z "$rootdev" ]; then
 
450
                echo "cryptsetup: WARNING: could not determine root device from /etc/fstab" >&2
 
451
        fi
 
452
        resumedevs=$(get_resume_devices)
468
453
fi
469
454
 
470
455
# Load the config opts and modules for each device
474
459
                continue
475
460
        fi
476
461
 
 
462
        setup="yes"
477
463
        for mod in $modules; do
478
464
                add_crypto_modules $mod
479
465
        done
480
466
done
481
467
 
482
 
# Prepare the initramfs
483
 
copy_exec /sbin/cryptsetup /sbin
484
 
copy_exec /sbin/dmsetup /sbin
485
 
copy_exec /lib/cryptsetup/askpass /lib/cryptsetup
486
 
 
487
 
# Done
 
468
# With large initramfs, we always add a basic subset of modules
 
469
if [ "$MODULES" != "dep" ]; then
 
470
        for mod in aes sha256 cbc; do
 
471
                add_crypto_modules $mod
 
472
        done
 
473
fi
 
474
 
 
475
# See if we need to add the basic components
 
476
if [ "$MODULES" != "dep" ] || [ "$setup" = "yes" ]; then
 
477
        for mod in dm_mod dm_crypt; do
 
478
                manual_add_modules $mod
 
479
        done
 
480
 
 
481
        copy_exec /sbin/cryptsetup
 
482
        copy_exec /sbin/dmsetup
 
483
        copy_exec /lib/cryptsetup/askpass
 
484
fi
 
485
 
488
486
exit 0