]>
Commit | Line | Data |
---|---|---|
e7cbe5cb LB |
1 | #!/usr/bin/env bash |
2 | # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- | |
3 | # ex: ts=8 sw=4 sts=4 et filetype=sh | |
4 | set -e | |
5 | TEST_DESCRIPTION="test systemd-dissect" | |
6 | IMAGE_NAME="dissect" | |
7 | TEST_NO_NSPAWN=1 | |
8 | ||
9 | . $TEST_BASE_DIR/test-functions | |
10 | ||
11 | command -v mksquashfs >/dev/null 2>&1 || exit 0 | |
12 | command -v veritysetup >/dev/null 2>&1 || exit 0 | |
a5f1d665 | 13 | command -v sfdisk >/dev/null 2>&1 || exit 0 |
e7cbe5cb LB |
14 | |
15 | # Need loop devices for systemd-dissect | |
16 | test_create_image() { | |
17 | create_empty_image_rootdir | |
18 | ||
19 | # Create what will eventually be our root filesystem onto an overlay | |
20 | # If some pieces are missing from the host, skip rather than fail | |
21 | ( | |
22 | LOG_LEVEL=5 | |
23 | setup_basic_environment | |
24 | mask_supporting_services | |
25 | ||
26 | instmods loop =block | |
27 | instmods squashfs =squashfs | |
28 | instmods dm_verity =md | |
69398734 | 29 | install_dmevent |
e7cbe5cb | 30 | generate_module_dependencies |
a5f1d665 LB |
31 | inst_binary sfdisk |
32 | inst_binary losetup | |
0f5d24a8 LB |
33 | |
34 | BASICTOOLS=( | |
35 | bash | |
36 | cat | |
18d73705 | 37 | mount |
0f5d24a8 LB |
38 | ) |
39 | oldinitdir=$initdir | |
40 | export initdir=$TESTDIR/minimal | |
41 | mkdir -p $initdir | |
42 | setup_basic_dirs | |
43 | install_basic_tools | |
44 | inst /usr/lib/os-release | |
45 | ln -s ../usr/lib/os-release $initdir/etc/os-release | |
46 | echo MARKER=1 >> $initdir/usr/lib/os-release | |
47 | mksquashfs $initdir $oldinitdir/usr/share/minimal.raw | |
48 | veritysetup format $oldinitdir/usr/share/minimal.raw $oldinitdir/usr/share/minimal.verity | grep '^Root hash:' | cut -f2 | tr -d '\n' > $oldinitdir/usr/share/minimal.roothash | |
49 | export initdir=$oldinitdir | |
e7cbe5cb LB |
50 | ) |
51 | } | |
52 | ||
53 | do_test "$@" 50 |