diff --git a/README.md b/README.md index 8eca603..10d4900 100644 --- a/README.md +++ b/README.md @@ -17,12 +17,6 @@ This repo holds custom dracut modules required by Flatcar Container Linux -## Running tests - -``` -./test -``` - ## Code of Conduct In the interest of promoting a fair, diverse, and open community, Kinvolk uses its [Code of Conduct](https://github.com/kinvolk/contribution/blob/master/CODE_OF_CONDUCT.md) for all its projects and events. diff --git a/dracut/51diskless-generator/diskless-generator b/dracut/51diskless-generator/diskless-generator index d45bf8c..83a82af 100755 --- a/dracut/51diskless-generator/diskless-generator +++ b/dracut/51diskless-generator/diskless-generator @@ -43,8 +43,8 @@ if [[ -z "${usr}" && -f /usr.squashfs ]]; then [Unit] Before=initrd-root-fs.target -Wants=remount-sysroot.service -After=remount-sysroot.service +Wants=ignition-remount-sysroot.service +After=ignition-remount-sysroot.service # Make sure the loop device nodes are available Wants=systemd-tmpfiles-setup-dev-early.service After=systemd-tmpfiles-setup-dev-early.service diff --git a/dracut/51diskless-generator/module-setup.sh b/dracut/51diskless-generator/module-setup.sh index 85820ba..9426c80 100755 --- a/dracut/51diskless-generator/module-setup.sh +++ b/dracut/51diskless-generator/module-setup.sh @@ -4,7 +4,6 @@ depends() { echo systemd - echo usr-generator } install() { diff --git a/dracut/51usr-fsck-generator/module-setup.sh b/dracut/51usr-fsck-generator/module-setup.sh deleted file mode 100755 index 5253359..0000000 --- a/dracut/51usr-fsck-generator/module-setup.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -depends() { - echo systemd -} - -install() { - inst_multiple tr - inst_simple "$moddir/usr-fsck-generator" \ - "$systemdutildir/system-generators/usr-fsck-generator" -} diff --git a/dracut/51usr-fsck-generator/testsuite.sh b/dracut/51usr-fsck-generator/testsuite.sh deleted file mode 100755 index cf73a15..0000000 --- a/dracut/51usr-fsck-generator/testsuite.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash - -moddir=$(dirname "$0") -failed=0 - -run_test() { - local cmdline="$1" - local checkfunc="$2" - local unitdir=$(mktemp -d) - trap "rm -rf '${unitdir}'" EXIT - - echo "Starting test ${checkfunc}" - export USR_FSCK_GENERATOR_CMDLINE="${cmdline}" - if ! "${moddir}/usr-fsck-generator" "${unitdir}"; then - echo "FAILED ${checkfunc}" - failed=$((failed + 1)) - elif ! "${checkfunc}" "${unitdir}"; then - echo "FAILED ${checkfunc}" - failed=$((failed + 1)) - else - echo "PASSED ${checkfunc}" - fi - - rm -rf "${unitdir}" - trap - EXIT -} - -test_noop() { - if [[ -e "$1"/* ]]; then - echo "$1 not empty" - return 1 - fi -} -run_test "nothing" test_noop -run_test "usr=nothing" test_noop -run_test "mount.usr=nothing" test_noop -run_test "usr=nothing mount.usr=nothing" test_noop - - -test_simple() { - [[ -e $1/systemd-fsck@foo-bar-baz.service.d/disable.conf ]] - return $? -} -run_test "usr=/foo/bar/baz" test_simple -run_test "mount.usr=/foo/bar/baz" test_simple -run_test "usr=bar mount.usr=/foo/bar/baz" test_simple -run_test "usr=foo mount.usr=bar usr=baz mount.usr=/foo/bar/baz usr=bleh" test_simple - - -test_label() { - [[ -e $1/systemd-fsck@dev-disk-by\\x2dlabel-foo.service.d/disable.conf ]] - return $? -} -run_test "mount.usr=LABEL=foo" test_label - - -test_uuid() { - [[ -e $1/systemd-fsck@dev-disk-by\\x2duuid-a123.service.d/disable.conf ]] - return $? -} -run_test "mount.usr=UUID=A123" test_uuid - - -test_partuuid() { - [[ -e $1/systemd-fsck@dev-disk-by\\x2dpartuuid-a123.service.d/disable.conf ]] - return $? -} -run_test "mount.usr=PARTUUID=A123" test_partuuid - - -test_partlabel() { - [[ -e $1/systemd-fsck@dev-disk-by\\x2dpartlabel-foo.service.d/disable.conf ]] - return $? -} -run_test "mount.usr=PARTLABEL=foo" test_partlabel - - -if [[ "${failed}" -ne 0 ]]; then - echo "${failed} test(s) failed!" - exit 1 -fi diff --git a/dracut/51usr-fsck-generator/usr-fsck-generator b/dracut/51usr-fsck-generator/usr-fsck-generator deleted file mode 100755 index 100069e..0000000 --- a/dracut/51usr-fsck-generator/usr-fsck-generator +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -# This script adds a drop-in which disables systemd-fsck for the /usr -# partition. Cases: -# -# 1. /usr is backed by dm-verity and is read-only. fsck.ext4 would fail -# and print a confusing error to the journal. -# -# 2. The /usr filesystem is configured for verity but the bootloader is -# too old to enable it. fsck.ext4 would fail because of the read-only -# compat flags that prevent writing to the filesystem, and print a -# confusing error to the journal. -# -# 3. Neither #1 or #2 are true because this is a dev image. This case -# is not trivial to detect and not actually important. - -set -e - -UNIT_DIR="${1:-/tmp}" - -# env var for testing -if [[ -n "${USR_FSCK_GENERATOR_CMDLINE}" ]]; then - cmdline=( ${USR_FSCK_GENERATOR_CMDLINE} ) -else - cmdline=( $("${dropin_dir}/disable.conf" < "$initdir/etc/systemd/system/systemd-fsck-usr.service" <"${UNIT_DIR}/sysusr-usr.mount.d/10-norecovery.conf" <"${UNIT_DIR}/sysroot-usr.mount" <" - exit 1 -fi - -if ! mountpoint -q "$mp"; then - exit 0 -fi - -tries=5 -while true; do - umount "$mp" ||: - # Apparently umount may return failure when it actually succeeded - if ! mountpoint -q "$mp"; then - exit 0 - fi - - tries=$(( $tries - 1 )) - if [[ $tries = 0 ]]; then - echo "Giving up." >&2 - exit 1 - fi - - echo "Couldn't unmount $mp; retrying..." >&2 - sleep 1 -done diff --git a/dracut/53ignition/sysroot-boot.service b/dracut/53ignition/sysroot-boot.service deleted file mode 100644 index 9d8fb6c..0000000 --- a/dracut/53ignition/sysroot-boot.service +++ /dev/null @@ -1,25 +0,0 @@ -[Unit] -Description=/sysroot/boot -DefaultDependencies=false - -BindsTo=dev-disk-by\x2dlabel-EFI\x2dSYSTEM.device -After=dev-disk-by\x2dlabel-EFI\x2dSYSTEM.device - -RequiresMountsFor=/sysroot - -# Creates mountpoint -Requires=initrd-setup-root.service -After=initrd-setup-root.service - -# This is to make sure that /sysroot/boot is unmounted before we start -# switching root in initrd-switch-root.target. -Before=initrd-switch-root.target - -Conflicts=dracut-emergency.service emergency.service emergency.target -Conflicts=initrd-switch-root.target umount.target - -[Service] -Type=oneshot -RemainAfterExit=true -ExecStart=/usr/bin/mount /dev/disk/by-label/EFI-SYSTEM /sysroot/boot -ExecStop=/usr/sbin/retry-umount /sysroot/boot diff --git a/test b/test deleted file mode 100755 index 3bbb841..0000000 --- a/test +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -set -e - -./dracut/10usr-generator/testsuite.sh