Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dracut: add afterburn dracut module #224

Merged
merged 1 commit into from
Jun 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions dracut/30afterburn/afterburn-hostname.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[Unit]
Description=Afterburn Hostname
# Azure needs to fetch the hostname in the initramfs
ConditionKernelCommandLine=|ignition.platform.id=azure

# We order this service after sysroot has been mounted
# but before ignition-files stage has run, so ignition can
# overwrite the configured hostname with e.g. a static one
# Also order after ignition-remount-sysroot just for
# safety for systems that mount /sysroot ro
After=initrd-root-fs.target
Before=ignition-files.service
lucab marked this conversation as resolved.
Show resolved Hide resolved

lucab marked this conversation as resolved.
Show resolved Hide resolved
OnFailure=emergency.target
OnFailureJobMode=isolate

[Service]
ExecStart=/usr/bin/afterburn --cmdline --hostname=/sysroot/etc/hostname
Type=oneshot
24 changes: 24 additions & 0 deletions dracut/30afterburn/module-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

check() {
return 0
}

depends() {
echo systemd network
}

install() {
inst_multiple afterburn

inst_simple "$moddir/afterburn-hostname.service" \
"$systemdutildir/system/afterburn-hostname.service"

# We want the afterburn-hostname to be firstboot only, so Ignition-provided
# hostname changes do not get overwritten on subsequent boots

mkdir -p "$initdir/$systemdsystemunitdir/ignition-complete.target.requires"
ln -s "../afterburn-hostname.service" "$initdir/$systemdsystemunitdir/ignition-complete.target.requires/afterburn-hostname.service"
}