forked from rhinstaller/kickstart-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautopart-luks-1.ks.in
52 lines (38 loc) · 1.08 KB
/
autopart-luks-1.ks.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#test name: autopart-luks-1
%ksappend repos/default.ks
network --bootproto=dhcp
bootloader --timeout=1
zerombr
clearpart --all --initlabel
# Test LUKS 1.
autopart --type=lvm --encrypted --passphrase="passphrase" --luks-version=luks1
keyboard us
lang en
timezone America/New_York
rootpw qweqwe
shutdown
%packages
%end
%post
# Set the crypted device.
crypted="/dev/vda2"
# Check if the type of /dev/vda2 is crypto_LUKS.
type="$(blkid -o value -s TYPE ${crypted})"
if [[ "$type" != "crypto_LUKS" ]] ; then
echo "*** unexpected type ${type} of ${crypted}" > /root/RESULT
exit 1
fi
# Check if the LUKS version of /dev/vda2 is luks1.
result="$(cryptsetup luksDump ${crypted} | awk '{ if ($1 == "Version:") print $2; }' )"
if [[ "$result" != "1" ]] ; then
echo "*** unexpected LUKS version for ${crypted}: ${result}" > /root/RESULT
exit 1
fi
# Try to use the passphrase.
echo "passphrase" | cryptsetup luksOpen --test-passphrase "${crypted}"
if [[ $? != 0 ]] ; then
echo "*** cannot open ${crypted} with the passphrase" > /root/RESULT
exit 1
fi
echo 'SUCCESS' > /root/RESULT
%end