~siretart/cryptsetup/debian

« back to all changes in this revision

Viewing changes to debian/initramfs/cryptroot-hook

  • Committer: Reinhard Tartler
  • Date: 2008-06-13 19:35:34 UTC
  • Revision ID: siretart@tauware.de-20080613193534-oeqhbxi7r0q4lk51
import cryptsetup_1.0.6-2.dsc

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
66
66
 
67
67
        # initramfs-tools
68
68
        if [ -e /etc/initramfs-tools/conf.d/resume ]; then
69
 
                device=$(sed -rn 's/^RESUME[[:space:]]+=[[:space:]]+// p' /etc/initramfs-tools/conf.d/resume)
 
69
                device=$(sed -rn 's/^RESUME[[:space:]]*=[[:space:]]*// p' /etc/initramfs-tools/conf.d/resume)
70
70
                if [ -n "$device" ]; then
71
71
                        candidates="$candidates $device"
72
72
                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"
358
357
                        if [ ! -d "$DESTDIR/keyscripts" ]; then
359
358
                                mkdir "$DESTDIR/keyscripts"
360
359
                        fi
361
 
                        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
362
369
                fi
363
370
 
364
371
                # Calculate needed modules
432
439
# Begin real processing
433
440
#
434
441
 
435
 
# Unless MODULES = "dep", we always add a basic subset of modules/tools
436
 
if [ "$MODULES" != "dep" ]; then
437
 
        for mod in dm_mod dm_crypt; do
438
 
                manual_add_modules $mod
439
 
        done
440
 
 
441
 
        for mod in aes sha256 cbc; do
442
 
                add_crypto_modules $mod
443
 
        done
444
 
 
445
 
        copy_exec /sbin/cryptsetup /sbin
446
 
        copy_exec /sbin/dmsetup /sbin
447
 
fi
448
 
 
449
 
# We can't do anything without a config file
450
 
if [ ! -r /etc/crypttab ]; then
451
 
        exit 0
452
 
fi
453
 
 
454
 
# Find out which devices to add to the config file
455
 
rootdev=$(get_root_device)
456
 
if [ -z "$rootdev" ]; then
457
 
        echo "cryptsetup: WARNING: could not determine root device from /etc/fstab" >&2
458
 
fi
459
 
resumedevs=$(get_resume_devices)
460
 
if [ -z "$rootdev" ] && [ -z "$resumedevs" ]; then
461
 
        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)
462
453
fi
463
454
 
464
455
# Load the config opts and modules for each device
468
459
                continue
469
460
        fi
470
461
 
 
462
        setup="yes"
471
463
        for mod in $modules; do
472
464
                add_crypto_modules $mod
473
465
        done
474
466
done
475
467
 
476
 
# Prepare the initramfs
477
 
copy_exec /sbin/cryptsetup /sbin
478
 
copy_exec /sbin/dmsetup /sbin
479
 
copy_exec /lib/cryptsetup/askpass /lib/cryptsetup
480
 
 
481
 
# 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
 
482
486
exit 0