| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
# Test 'fscrypt setup'. |
| 4 |
|
| 5 |
cd "$(dirname "$0")" |
| 6 |
. common.sh |
| 7 |
|
| 8 |
# global setup |
| 9 |
|
| 10 |
_print_header "fscrypt setup creates fscrypt.conf" |
| 11 |
rm -f "$FSCRYPT_CONF" |
| 12 |
fscrypt setup --time=1ms |
| 13 |
|
| 14 |
_print_header "fscrypt setup creates fscrypt.conf and /.fscrypt" |
| 15 |
_rm_metadata "$MNT_ROOT" |
| 16 |
rm -f "$FSCRYPT_CONF" |
| 17 |
echo y | fscrypt setup --time=1ms |
| 18 |
[ -e "$MNT_ROOT/.fscrypt" ] |
| 19 |
|
| 20 |
_print_header "fscrypt setup when fscrypt.conf already exists (cancel)" |
| 21 |
_expect_failure "echo | fscrypt setup --time=1ms" |
| 22 |
|
| 23 |
_print_header "fscrypt setup when fscrypt.conf already exists (cancel 2)" |
| 24 |
_expect_failure "echo N | fscrypt setup --time=1ms" |
| 25 |
|
| 26 |
_print_header "fscrypt setup when fscrypt.conf already exists (accept)" |
| 27 |
echo y | fscrypt setup --time=1ms |
| 28 |
|
| 29 |
_print_header "fscrypt setup --quiet when fscrypt.conf already exists" |
| 30 |
_expect_failure "fscrypt setup --quiet --time=1ms" |
| 31 |
|
| 32 |
_print_header "fscrypt setup --quiet --force when fscrypt.conf already exists" |
| 33 |
fscrypt setup --quiet --force --time=1ms |
| 34 |
|
| 35 |
|
| 36 |
# filesystem setup |
| 37 |
|
| 38 |
_print_header "fscrypt setup filesystem" |
| 39 |
_rm_metadata "$MNT" |
| 40 |
echo y | fscrypt setup "$MNT" |
| 41 |
[ -e "$MNT/.fscrypt" ] |
| 42 |
|
| 43 |
_print_header "fscrypt setup filesystem (already set up)" |
| 44 |
_expect_failure "fscrypt setup '$MNT'" |
| 45 |
|
| 46 |
_print_header "no config file" |
| 47 |
rm -f "$FSCRYPT_CONF" |
| 48 |
_expect_failure "fscrypt setup '$MNT'" |
| 49 |
|
| 50 |
_print_header "bad config file" |
| 51 |
echo bad > "$FSCRYPT_CONF" |
| 52 |
_expect_failure "fscrypt setup '$MNT'" |