forked from latchset/luksmeta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-luksmeta
executable file
·52 lines (38 loc) · 1.5 KB
/
test-luksmeta
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
#!/bin/bash -x
trap 'exit' ERR
export tmp=`mktemp /tmp/luksmeta.XXXXXXXXXX`
function onexit() {
rm -f $tmp
}
trap 'onexit' EXIT
truncate -s 4M $tmp
echo -n foo | cryptsetup luksFormat --type luks1 $tmp -
! ./luksmeta test -d $tmp
./luksmeta init -f -d $tmp
./luksmeta test -d $tmp
./luksmeta init -f -d $tmp
for slot in `seq 0 7`; do
test "`./luksmeta show -s $slot -d $tmp`" == ""
echo hi | ./luksmeta save -s $slot -u 23149359-1b61-4803-b818-774ab730fbec -d $tmp
test "`./luksmeta show -s $slot -d $tmp`" == "23149359-1b61-4803-b818-774ab730fbec"
test "`./luksmeta load -s $slot -d $tmp`" == "hi"
test "`./luksmeta load -s $slot -u 23149359-1b61-4803-b818-774ab730fbec -d $tmp`" == "hi"
! ./luksmeta load -s $slot -u 23149359-1b61-4803-b818-774ab730fbed -d $tmp
! ./luksmeta wipe -f -s $slot -u 23149359-1b61-4803-b818-774ab730fbed -d $tmp
./luksmeta wipe -f -s $slot -u 23149359-1b61-4803-b818-774ab730fbec -d $tmp
! ./luksmeta load -s $slot -d $tmp
echo hi | ./luksmeta save -s $slot -u 23149359-1b61-4803-b818-774ab730fbec -d $tmp
./luksmeta wipe -f -s $slot -d $tmp
! ./luksmeta load -s $slot -d $tmp
done
# Test nuking
./luksmeta test -d $tmp
./luksmeta init -f -d $tmp
./luksmeta nuke -f -d $tmp
! ./luksmeta test -d $tmp
# Test implicit nuking
./luksmeta init -f -d $tmp
echo hi | ./luksmeta save -s 0 -u 23149359-1b61-4803-b818-774ab730fbec -d $tmp
test "`./luksmeta load -s 0 -d $tmp`" == "hi"
./luksmeta init -n -f -d $tmp
! ./luksmeta load -s 0 -d $tmp