~siretart/cryptsetup/debian

« back to all changes in this revision

Viewing changes to debian/initramfs/cryptroot-script

  • Committer: Reinhard Tartler
  • Date: 2008-06-13 19:34:53 UTC
  • Revision ID: siretart@tauware.de-20080613193453-ywl35m67ce8pzvp3
import cryptsetup_1.0.6-1.dsc

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
{
8
8
        # Make sure that cryptroot is run last in local-top
9
9
        for req in /scripts/local-top/*; do
10
 
                script=$(basename $req)
 
10
                script=${req##*/}
11
11
                if [ $script != cryptroot ]; then
12
12
                        echo $script
13
13
                fi
43
43
        cryptlvm=""
44
44
        cryptkeyscript=""
45
45
        cryptkey="" # This is only used as an argument to an eventual keyscript
 
46
        crypttries=3
46
47
 
47
48
        local IFS=" ,"
48
49
        for x in $cryptopts; do
78
79
                                cryptkey=${x#key=}
79
80
                        fi
80
81
                        ;;
 
82
                tries=*)
 
83
                        crypttries="${x#tries=}"
 
84
                        case "$crypttries" in
 
85
                          *[![:digit:].]*)
 
86
                                crypttries=3
 
87
                                ;;
 
88
                        esac
 
89
                        ;;
81
90
                esac
82
91
        done
83
92
 
159
168
                activate_evms $cryptsource
160
169
        fi
161
170
        # Wait for udev to be ready, see https://launchpad.net/bugs/85640
162
 
        if [ -x /sbin/udevsettle ]; then
 
171
        if [ -x /sbin/udevadm ]; then
 
172
                /sbin/udevadm settle --timeout=30
 
173
        elif [ -x /sbin/udevsettle ]; then
163
174
                /sbin/udevsettle --timeout=30
164
175
        fi
165
176
 
170
181
 
171
182
        # Prepare commands
172
183
        if /sbin/cryptsetup isLuks $cryptsource > /dev/null 2>&1; then
173
 
                cryptcreate="/sbin/cryptsetup luksOpen $cryptsource $crypttarget"
 
184
                cryptcreate="/sbin/cryptsetup -T 1 luksOpen $cryptsource $crypttarget"
174
185
        else
175
 
                cryptcreate="/sbin/cryptsetup -c $cryptcipher -s $cryptsize -h $crypthash create $crypttarget $cryptsource"
 
186
                cryptcreate="/sbin/cryptsetup -T 1 -c $cryptcipher -s $cryptsize -h $crypthash create $crypttarget $cryptsource"
176
187
        fi
177
188
        cryptremove="/sbin/cryptsetup remove $crypttarget"
178
189
        NEWROOT="/dev/mapper/$crypttarget"
179
190
 
180
191
        # Try to get a satisfactory password three times
181
192
        count=0
182
 
        while [ $count -lt 3 ]; do
 
193
        while [ $crypttries -le 0 ] || [ $count -lt $crypttries ]; do
183
194
                count=$(( $count + 1 ))
184
195
 
185
196
                if [ -n "$cryptkeyscript" ]; then