1
0
mirror of https://github.com/systemd/systemd synced 2026-04-10 17:15:03 +02:00

Compare commits

..

No commits in common. "40676ce6f83561e68b56296e40f5d7b440a06f93" and "ea5e55b3112205194cfb6302710e989158d95b1d" have entirely different histories.

14 changed files with 144 additions and 222 deletions

View File

@ -17,11 +17,6 @@ on:
permissions: permissions:
contents: read contents: read
env:
# Enable debug logging in systemd, but keep udev's log level to info,
# since it's _very_ verbose in the QEMU task
KERNEL_CMDLINE: "systemd.unit=mkosi-check-and-shutdown.service !quiet systemd.log_level=debug systemd.log_target=console udev.log_level=info systemd.default_standard_output=journal+console"
jobs: jobs:
ci: ci:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
@ -62,19 +57,13 @@ jobs:
systemd-nspawn --version systemd-nspawn --version
- name: Build ${{ matrix.distro }} - name: Build ${{ matrix.distro }}
run: ./.github/workflows/run_mkosi.sh --build-environment=CI_BUILD=1 --kernel-command-line "${{ env.KERNEL_CMDLINE }}" build run: sudo python3 -m mkosi build
- name: Show ${{ matrix.distro }} image summary - name: Show ${{ matrix.distro }} image summary
run: ./.github/workflows/run_mkosi.sh summary run: sudo python3 -m mkosi summary
- name: Boot ${{ matrix.distro }} systemd-nspawn - name: Boot ${{ matrix.distro }} systemd-nspawn
run: ./.github/workflows/run_mkosi.sh boot ${{ env.KERNEL_CMDLINE }} run: sudo ./.github/workflows/test_mkosi_boot.py python3 -m mkosi boot
- name: Check ${{ matrix.distro }} systemd-nspawn
run: ./.github/workflows/run_mkosi.sh shell bash -c "[[ -e /testok ]] || { cat /failed-services; exit 1; }"
- name: Boot ${{ matrix.distro }} QEMU - name: Boot ${{ matrix.distro }} QEMU
run: ./.github/workflows/run_mkosi.sh qemu run: sudo ./.github/workflows/test_mkosi_boot.py python3 -m mkosi qemu
- name: Check ${{ matrix.distro }} QEMU
run: ./.github/workflows/run_mkosi.sh shell bash -c "[[ -e /testok ]] || { cat /failed-services; exit 1; }"

View File

@ -1,30 +0,0 @@
#!/bin/bash
# SPDX-License-Identifier: LGPL-2.1-or-later
# shellcheck disable=SC2064
set -eu
set -o pipefail
EC=0
TEMPFILE="$(mktemp)"
trap "rm -f '$TEMPFILE'" EXIT
for ((i = 0; i < 5; i++)); do
EC=0
(sudo python3 -m mkosi "$@") |& tee "$TEMPFILE" || EC=$?
if [[ $EC -eq 0 ]]; then
# The command passed - let's return immediatelly
break
fi
if ! grep -E "Failed to dissect image .+: Connection timed out" "$TEMPFILE"; then
# The command failed for other reason than the dissect-related timeout -
# let's exit with the same EC
exit $EC
fi
# The command failed due to the dissect-related timeout - let's try again
sleep 1
done
exit $EC

26
.github/workflows/test_mkosi_boot.py vendored Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: LGPL-2.1-or-later
import pexpect
import re
import sys
def run() -> None:
p = pexpect.spawnu(" ".join(sys.argv[1:]), logfile=sys.stdout, timeout=300)
# distro-independent root prompt
p.expect(re.compile("~[^#]{0,3}#"))
p.sendline("systemctl poweroff")
p.expect(pexpect.EOF)
try:
run()
except pexpect.EOF:
print("UNEXPECTED EOF")
sys.exit(1)
except pexpect.TIMEOUT:
print("TIMED OUT")
sys.exit(1)

View File

@ -110,12 +110,3 @@ if [ -n "$IMAGE_VERSION" ] ; then
cat /tmp/os-release.tmp > "$DESTDIR"/usr/lib/os-release cat /tmp/os-release.tmp > "$DESTDIR"/usr/lib/os-release
rm /tmp/os-release.tmp rm /tmp/os-release.tmp
fi fi
# If $CI_BUILD is set, copy over the CI service which executes a service check
# after boot and then shuts down the machine
if [ -n "$CI_BUILD" ]; then
mkdir -p "$DESTDIR/usr/lib/systemd/system"
cp -v "$SRCDIR/test/mkosi-check-and-shutdown.service" "$DESTDIR/usr/lib/systemd/system/mkosi-check-and-shutdown.service"
cp -v "$SRCDIR/test/mkosi-check-and-shutdown.sh" "$DESTDIR/usr/lib/systemd/mkosi-check-and-shutdown.sh"
chmod +x "$DESTDIR/usr/lib/systemd/mkosi-check-and-shutdown.sh"
fi

View File

@ -23,7 +23,6 @@ BuildPackages=
libcryptsetup-devel libcryptsetup-devel
libcurl-devel libcurl-devel
libgcrypt-devel libgcrypt-devel
libgnutls-devel
libkmod-devel libkmod-devel
liblz4-devel liblz4-devel
libmicrohttpd-devel libmicrohttpd-devel
@ -36,8 +35,8 @@ BuildPackages=
pciutils-devel pciutils-devel
pcre-devel pcre-devel
python3 python3
python3-Jinja2
python3-lxml python3-lxml
python3-Jinja2
qrencode-devel qrencode-devel
system-user-nobody system-user-nobody
systemd-sysvinit systemd-sysvinit
@ -62,7 +61,6 @@ Packages=
libcrypt1 libcrypt1
libcryptsetup12 libcryptsetup12
libgcrypt20 libgcrypt20
libgnutls30
libkmod2 libkmod2
liblz4-1 liblz4-1
libmount1 libmount1

View File

@ -4,13 +4,3 @@
if [ "$1" = "final" ] && command -v bootctl > /dev/null; then if [ "$1" = "final" ] && command -v bootctl > /dev/null; then
bootctl install bootctl install
fi fi
# Temporary workaround until https://github.com/openSUSE/suse-module-tools/commit/158643414ddb8d8208016a5f03a4484d58944d7a
# gets into OpenSUSE repos
if [ "$1" = "final" ] && grep -q openSUSE /etc/os-release; then
if [ -e "/usr/lib/systemd/system/boot-sysctl.service" ] && \
! grep -F -q 'ConditionPathExists=/boot/sysctl.conf' "/usr/lib/systemd/system/boot-sysctl.service"; then
mkdir -p "/etc/systemd/system/boot-sysctl.service.d/"
printf '[Unit]\nConditionPathExists=/boot/sysctl.conf-%%v' >"/etc/systemd/system/boot-sysctl.service.d/99-temporary-workaround.conf"
fi
fi

View File

@ -194,12 +194,6 @@ const char* const systemd_features =
/* other stuff that doesn't fit above */ /* other stuff that doesn't fit above */
#if BPF_FRAMEWORK
" +BPF_FRAMEWORK"
#else
" -BPF_FRAMEWORK"
#endif
#if HAVE_XKBCOMMON #if HAVE_XKBCOMMON
" +XKBCOMMON" " +XKBCOMMON"
#else #else

View File

@ -1,9 +1,6 @@
# SPDX-License-Identifier: LGPL-2.1+ # SPDX-License-Identifier: LGPL-2.1+
if conf.get('BPF_FRAMEWORK') != 1 if conf.get('BPF_FRAMEWORK') == 1
subdir_done()
endif
clang_flags = [ clang_flags = [
'-Wno-compare-distinct-pointer-types', '-Wno-compare-distinct-pointer-types',
'-O2', '-O2',
@ -61,3 +58,4 @@ skel_h_cmd = [
's', 's',
'@INPUT@' '@INPUT@'
] ]
endif

View File

@ -1,9 +1,6 @@
# SPDX-License-Identifier: LGPL-2.1-or-later # SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('BPF_FRAMEWORK') != 1 if conf.get('BPF_FRAMEWORK') == 1
subdir_done()
endif
restrict_fs_bpf_o_unstripped = custom_target( restrict_fs_bpf_o_unstripped = custom_target(
'restrict-fs.bpf.unstripped.o', 'restrict-fs.bpf.unstripped.o',
input : 'restrict-fs.bpf.c', input : 'restrict-fs.bpf.c',
@ -22,3 +19,4 @@ restrict_fs_skel_h = custom_target(
output : 'restrict-fs.skel.h', output : 'restrict-fs.skel.h',
command : skel_h_cmd, command : skel_h_cmd,
capture : true) capture : true)
endif

View File

@ -1,9 +1,6 @@
# SPDX-License-Identifier: LGPL-2.1-or-later # SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('BPF_FRAMEWORK') != 1 if conf.get('BPF_FRAMEWORK') == 1
subdir_done()
endif
restrict_ifaces_bpf_o_unstripped = custom_target( restrict_ifaces_bpf_o_unstripped = custom_target(
'restrict-ifaces.bpf.unstripped.o', 'restrict-ifaces.bpf.unstripped.o',
input : 'restrict-ifaces.bpf.c', input : 'restrict-ifaces.bpf.c',
@ -22,3 +19,4 @@ restrict_ifaces_skel_h = custom_target(
output : 'restrict-ifaces.skel.h', output : 'restrict-ifaces.skel.h',
command : skel_h_cmd, command : skel_h_cmd,
capture : true) capture : true)
endif

View File

@ -1,9 +1,6 @@
# SPDX-License-Identifier: LGPL-2.1-or-later # SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('BPF_FRAMEWORK') != 1 if conf.get('BPF_FRAMEWORK') == 1
subdir_done()
endif
socket_bind_bpf_o_unstripped = custom_target( socket_bind_bpf_o_unstripped = custom_target(
'socket-bind.bpf.unstripped.o', 'socket-bind.bpf.unstripped.o',
input : 'socket-bind.bpf.c', input : 'socket-bind.bpf.c',
@ -22,3 +19,4 @@ socket_bind_skel_h = custom_target(
output : 'socket-bind.skel.h', output : 'socket-bind.skel.h',
command : skel_h_cmd, command : skel_h_cmd,
capture : true) capture : true)
endif

View File

@ -1,14 +0,0 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Unit]
Description=Check if any service failed and then shutdown the machine
After=multi-user.target network-online.target
Requires=multi-user.target
Wants=systemd-resolved.service systemd-networkd.service network-online.target
OnFailure=poweroff.target
OnFailureJobMode=replace-irreversibly
[Service]
Type=oneshot
ExecStartPre=-rm -f /failed-services
ExecStart=/usr/lib/systemd/mkosi-check-and-shutdown.sh
ExecStartPost=systemctl poweroff --no-block

View File

@ -1,9 +0,0 @@
#!/bin/bash -eux
# SPDX-License-Identifier: LGPL-2.1-or-later
systemctl --failed --no-legend | tee /failed-services
# Exit with non-zero EC if the /failed-services file is not empty (we have -e set)
[[ ! -s /failed-services ]]
: >/testok

View File

@ -36,7 +36,7 @@ teardown() {
KERNEL_VERSION="$(uname -r)" KERNEL_VERSION="$(uname -r)"
KERNEL_MAJOR="${KERNEL_VERSION%%.*}" KERNEL_MAJOR="${KERNEL_VERSION%%.*}"
KERNEL_MINOR="${KERNEL_VERSION#"$KERNEL_MAJOR".}" KERNEL_MINOR="${KERNEL_VERSION#$KERNEL_MAJOR.}"
KERNEL_MINOR="${KERNEL_MINOR%%.*}" KERNEL_MINOR="${KERNEL_MINOR%%.*}"
MAJOR_REQUIRED=5 MAJOR_REQUIRED=5
@ -47,11 +47,6 @@ if [[ "$KERNEL_MAJOR" -lt $MAJOR_REQUIRED || ("$KERNEL_MAJOR" -eq $MAJOR_REQUIRE
exit 0 exit 0
fi fi
if systemctl --version | grep -q -F "-BPF_FRAMEWORK"; then
echo "bpf-framework is disabled" >>/skipped
exit 0
fi
trap teardown EXIT trap teardown EXIT
setup setup