Merge pull request #32449 from DaanDeMeyer/mkosi

Various mkosi fixes
This commit is contained in:
Daan De Meyer
2024-04-24 12:11:11 +02:00
committed by GitHub
10 changed files with 20 additions and 7 deletions

View File

@@ -71,7 +71,7 @@ jobs:
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
- uses: systemd/mkosi@8cbde8a4ed20a078ad5c70fe38c0dd2294a68bb1
- uses: systemd/mkosi@11b112094e659d50cdb25f67829857cfefb69e6d
# Freeing up disk space with rm -rf can take multiple minutes. Since we don't need the extra free space
# immediately, we remove the files in the background. However, we first move them to a different location

View File

@@ -10,6 +10,7 @@ ExtraTrees=
Packages=
acl
attr
bash-completion
coreutils
diffutils
@@ -29,6 +30,7 @@ Packages=
mtools
nano
nftables
nvme-cli
openssl
python3
qrencode

View File

@@ -36,6 +36,7 @@ Packages=
pkgconf
polkit
procps-ng
psmisc
quota-tools
sbsigntools
shadow

View File

@@ -58,6 +58,7 @@ Packages=
passwd
policykit-1
procps
psmisc
quota
sbsigntool
tzdata

View File

@@ -53,6 +53,7 @@ Packages=
pam
patterns-base-minimal_base
procps4
psmisc
python3-pefile
quota
rpm-build

View File

@@ -64,6 +64,7 @@ def main():
"""
[Unit]
SuccessAction=exit
SuccessActionExitStatus=123
FailureAction=exit
"""
)
@@ -87,7 +88,9 @@ def main():
f"systemd.extra-unit.emergency-exit.service={shlex.quote(EMERGENCY_EXIT_SERVICE)}",
'--credential',
f"systemd.unit-dropin.emergency.target={shlex.quote(EMERGENCY_EXIT_DROPIN)}",
'--kernel-command-line-extra=systemd.mask=serial-getty@.service',
'--kernel-command-line-extra=systemd.mask=serial-getty@.service systemd.show_status=no systemd.crash_shell=0 systemd.crash_reboot',
# Custom firmware variables allow bypassing the EFI auto-enrollment reboot so we only reboot on crash
'--qemu-firmware-variables=custom',
]
if not sys.stderr.isatty()
else []
@@ -103,12 +106,13 @@ def main():
]),
*args.mkosi_args,
'qemu',
*(['-no-reboot'] if not sys.stderr.isatty() else [])
]
try:
subprocess.run(cmd, check=True)
except subprocess.CalledProcessError as e:
if e.returncode != 77 and journal_file:
result = subprocess.run(cmd)
# Return code 123 is the expected success code
if result.returncode != (0 if sys.stderr.isatty() else 123):
if result.returncode != 77 and journal_file:
cmd = [
'journalctl',
'--no-hostname',
@@ -119,7 +123,7 @@ def main():
]
print("Test failed, relevant logs can be viewed with: \n\n"
f"{shlex.join(str(a) for a in cmd)}\n", file=sys.stderr)
exit(e.returncode)
exit(result.returncode or 1)
# Do not keep journal files for tests that don't fail.
if journal_file:

View File

@@ -8,6 +8,7 @@ set -o pipefail
# shellcheck source=test/units/util.sh
. "$(dirname "$0")"/util.sh
# Needed to write units to /usr/lib/systemd/system to test /etc and /run overrides.
maybe_mount_usr_overlay
trap 'maybe_umount_usr_overlay' EXIT

View File

@@ -18,6 +18,7 @@ at_exit() {
return 0
}
# Needed for /usr/lib/systemd/system/$UNIT_NAME to test overrides in /etc and /run
maybe_mount_usr_overlay
trap at_exit EXIT

View File

@@ -6,6 +6,7 @@ set -o pipefail
# shellcheck source=test/units/util.sh
. "$(dirname "$0")"/util.sh
# Needed to create mount.mytmpfs helper
maybe_mount_usr_overlay
trap 'maybe_umount_usr_overlay' EXIT

View File

@@ -9,6 +9,7 @@ set -o pipefail
# shellcheck source=test/units/util.sh
. "$(dirname "$0")"/util.sh
# Needed to generate test locales in /usr/lib
maybe_mount_usr_overlay
trap 'maybe_umount_usr_overlay' EXIT