2020-05-29 19:51:20 +03:00
#!/usr/bin/env bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
set -e
TEST_DESCRIPTION = "test systemd-dissect"
IMAGE_NAME = "dissect"
TEST_NO_NSPAWN = 1
. $TEST_BASE_DIR /test-functions
command -v mksquashfs >/dev/null 2>& 1 || exit 0
command -v veritysetup >/dev/null 2>& 1 || exit 0
2020-07-10 18:01:15 +03:00
command -v sfdisk >/dev/null 2>& 1 || exit 0
2020-05-29 19:51:20 +03:00
# Need loop devices for systemd-dissect
2021-01-07 00:42:28 +03:00
test_append_files( ) {
2020-05-29 19:51:20 +03:00
(
instmods loop = block
instmods squashfs = squashfs
instmods dm_verity = md
2020-07-10 12:30:33 +03:00
install_dmevent
2020-05-29 19:51:20 +03:00
generate_module_dependencies
2020-07-10 18:01:15 +03:00
inst_binary losetup
2020-07-15 19:17:31 +03:00
BASICTOOLS = (
bash
cat
2020-06-29 15:19:31 +03:00
mount
2020-07-15 19:17:31 +03:00
)
oldinitdir = $initdir
export initdir = $TESTDIR /minimal
2020-10-16 15:20:45 +03:00
mkdir -p $initdir /usr/lib $initdir /etc
2020-07-15 19:17:31 +03:00
setup_basic_dirs
install_basic_tools
2020-08-27 12:59:45 +03:00
cp $os_release $initdir /usr/lib/os-release
2020-07-15 19:17:31 +03:00
ln -s ../usr/lib/os-release $initdir /etc/os-release
echo MARKER = 1 >> $initdir /usr/lib/os-release
mksquashfs $initdir $oldinitdir /usr/share/minimal.raw
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
export initdir = $oldinitdir
2020-05-29 19:51:20 +03:00
)
}
do_test " $@ " 50