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: clean up /boot/ignition when done #1246

Closed
wants to merge 2 commits into from
Closed
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
23 changes: 23 additions & 0 deletions dracut/30ignition/ignition-cleanup-boot.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[Unit]
Description=Ignition (clean up /boot)
Documentation=https://github.com/coreos/ignition
ConditionPathExists=/etc/initrd-release
DefaultDependencies=false
Before=ignition-complete.target

Requires=dev-disk-by\x2dlabel-boot.device
After=dev-disk-by\x2dlabel-boot.device

OnFailure=emergency.target
OnFailureJobMode=isolate

# Stage order: setup -> fetch-offline [-> fetch] [-> kargs] -> disks -> mount -> files.
After=ignition-files.service

[Service]
Type=oneshot
RemainAfterExit=yes
# The MountFlags=slave is so the umount of /boot is guaranteed to happen
# /boot will only be mounted for the lifetime of the unit.
MountFlags=slave
ExecStart=/usr/sbin/ignition-cleanup-boot
12 changes: 12 additions & 0 deletions dracut/30ignition/ignition-cleanup-boot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -euo pipefail

# Clean up the user embedded config read by ignition-setup-user.service, and
# also anything else that might have been placed under $bootmnt/ignition.
# Note that we mount /boot but we don't unmount it because we are run in a
# systemd unit with MountFlags=slave so it is unmounted for us.
bootmnt=/mnt/boot_partition
mkdir -p $bootmnt
mount /dev/disk/by-label/boot $bootmnt
rm -rf "${bootmnt}/ignition"
1 change: 0 additions & 1 deletion dracut/30ignition/ignition-fetch-offline.service
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ After=basic.target
# Stage order: setup -> fetch-offline [-> fetch] [-> kargs] -> disks -> mount -> files.
# We run after the setup stage has run because it may copy in new/different
# ignition configs for us to consume.
After=ignition-setup-base.service
After=ignition-setup-user.service
Before=ignition-fetch.service

Expand Down
5 changes: 4 additions & 1 deletion dracut/30ignition/module-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ install() {
inst_script "$moddir/ignition-setup-user.sh" \
"/usr/sbin/ignition-setup-user"

inst_script "$moddir/ignition-cleanup-boot.sh" \
"/usr/sbin/ignition-cleanup-boot"

inst_script "$moddir/ignition-kargs-helper.sh" \
"/usr/sbin/ignition-kargs-helper"

Expand Down Expand Up @@ -92,8 +95,8 @@ install() {
install_ignition_unit ignition-files.service

# units only started when we have a boot disk
# path generated by systemd-escape --path /dev/disk/by-label/root
install_ignition_unit ignition-remount-sysroot.service ignition-diskful.target
install_ignition_unit ignition-cleanup-boot.service ignition-diskful.target

# needed for openstack config drive support
inst_rules 60-cdrom_id.rules
Expand Down