1
0
mirror of https://github.com/coreos/fedora-coreos-config.git synced 2026-02-05 09:45:30 +01:00

tree: import changes from testing-devel at 05ca467530

This commit is contained in:
CoreOS Bot
2022-08-03 18:11:44 +00:00
parent 38cf685ac3
commit 6e0bb69c4d
4 changed files with 30 additions and 0 deletions

View File

@@ -6,13 +6,37 @@ import stat
import subprocess
import yaml
INITRD_SERVICES_WITHOUT_BEFORE = {
# Depended on by other services
'coreos-livepxe-rootfs.service',
}
validated=0
def openat(dirfd, name, mode='r'):
def opener(path, flags):
return os.open(path, flags, dir_fd=dirfd)
return open(name, mode, opener=opener)
def validate_initrd_service(rootfd, name):
with openat(rootfd, name) as fh:
if ([l for l in fh.readlines() if l.startswith('Before=')] or
name in INITRD_SERVICES_WITHOUT_BEFORE):
global validated
validated += 1
else:
raise Exception(
f'{name} has no Before= and may race with switch-root'
)
def validate_shell(rootfd, name):
subprocess.check_call(['bash', '-n', name], preexec_fn=lambda: os.fchdir(rootfd))
global validated
validated +=1
for root, dirs, files, rootfd in os.fwalk('.'):
# Skip .git
if '.git' in dirs:
@@ -26,6 +50,8 @@ for root, dirs, files, rootfd in os.fwalk('.'):
elif name.endswith('.sh'):
validate_shell(rootfd, name)
continue
elif 'dracut/modules.d' in root and name.endswith('.service'):
validate_initrd_service(rootfd, name)
stbuf = os.lstat(name, dir_fd=rootfd)
if not stat.S_ISREG(stbuf.st_mode):
continue

View File

@@ -6,6 +6,8 @@ ConditionKernelCommandLine=ostree
ConditionPathExists=!/run/ostree-live
After=ignition-ostree-growfs.service
After=ostree-prepare-root.service
# Allow Ignition config to blank out the warning
Before=ignition-files.service
[Service]
Type=oneshot

View File

@@ -5,6 +5,7 @@
Description=CoreOS: Touch /run/agetty.reload
Documentation=https://bugzilla.redhat.com/show_bug.cgi?id=1932053
DefaultDependencies=false
Before=initrd.target
[Service]
Type=oneshot

View File

@@ -7,6 +7,7 @@ ConditionVirtualization=|qemu
Requires=systemd-journald.service
After=systemd-journald.service
After=basic.target
Before=initrd.target
[Service]
Type=oneshot