~siretart/cryptsetup/debian

« back to all changes in this revision

Viewing changes to debian/cryptdisks.functions

  • Committer: Reinhard Tartler
  • Date: 2008-08-06 13:15:04 UTC
  • Revision ID: siretart@tauware.de-20080806131504-lm6wr3syvblxmm4b
import cryptsetup_1.0.6-3.dsc

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
parse_opts () {
33
33
        local opts opt IFS PARAM VALUE
34
34
 
35
 
        opts="$1"
 
35
        # Strip comments - https://bugs.launchpad.net/bugs/185380
 
36
        opts=$(echo -n $1 | sed 's/ *#.*//')
36
37
        LOUD=""
37
38
        PARAMS=""
38
39
        CHECK=""
246
247
        OMODE=$(ls -l "$key" | sed 's/[[:space:]].*//;s/^.\{7\}//')
247
248
        GMODE=$(ls -l "$key" | sed 's/[[:space:]].*//;s/^.\{4\}\(.\{3\}\).*/\1/')
248
249
        GROUP=$(ls -l "$key" | sed 's/^.\{11\}[^[:space:]]* [^[:space:]]* \([^[:space:]]*\).*/\1/')
249
 
        OWNER=$( ls -l "$key" | sed 's/^.\{11\}[^[:space:]]* \([^[:space:]]*\).*/\1/')
 
250
        # regex needs to work if keyfile has xattrs - https://launchpad.net/bugs/231339
 
251
        OWNER=$(ls -l "$key" | sed 's/^.\{10\}[+]\?.[^[:space:]]* \([^[:space:]]*\).*/\1/')
250
252
 
251
253
        # LUKS requires a persistent key, /dev/*random is not supported
252
254
        if [ "$USELUKS" = "yes" ] && [ "$key" != "${key%random}" ]; then
455
457
        key=$3
456
458
        opts=$4
457
459
 
458
 
        # Ignore noauto devices
459
 
        if [ "$IGNORE" = "yes" ]; then
460
 
                device_msg "$dst" "ignored"
461
 
                continue
462
 
        fi
463
 
 
464
460
        # Make sure that all fields are present
465
461
        if [ -z "$dst" ]; then
466
462
                continue
476
472
                src="/dev/disk/by-label/${src#LABEL=}"
477
473
        fi
478
474
 
 
475
        # Do the preparatory steps
 
476
        if ! parse_opts "$opts"; then
 
477
                device_msg "$dst" "invalid opts"
 
478
                continue
 
479
        elif ! check_key; then
 
480
                device_msg "$dst" "invalid key"
 
481
                continue
 
482
        elif ! lo_setup; then
 
483
                device_msg "$dst" "loopback failed"
 
484
        fi
 
485
 
 
486
        # Ignore noauto devices
 
487
        if [ "$IGNORE" = "yes" ]; then
 
488
                device_msg "$dst" "ignored"
 
489
                continue
 
490
        fi
 
491
 
479
492
        # Make sure source device exists
480
493
        if [ ! -r "$src" ]; then
481
494
                if [ "$LOUD" = "yes" ]; then
490
503
                continue
491
504
        fi
492
505
 
493
 
        # All checks passed, do the preparatory steps
494
 
        if ! parse_opts "$opts"; then
495
 
                device_msg "$dst" "invalid opts"
496
 
                continue
497
 
        elif ! check_key; then
498
 
                device_msg "$dst" "invalid key"
499
 
                continue
500
 
        elif ! lo_setup; then
501
 
                device_msg "$dst" "loopback failed"
502
 
        fi
503
 
 
504
 
        # Do the real setup
 
506
        # All checks passed, do the real setup
505
507
        log_action_msg "$dst (starting)"
506
508
        result="ok"
507
509
        if [ "$USELUKS" = "yes" ]; then