Skip to content

Commit

Permalink
WIP: dracut/30ignition: Add mount stage and drop OSTree-specific bits
Browse files Browse the repository at this point in the history
Add support for the new Ignition `mount` and `umount` stages. The
`mount` stage runs *after* the `disks` stage and
`initrd-root-fs.target`, since we need to be able to mount under
`/sysroot`, but *before* the `files` stage, which will of course drop
files under those mounts.

Combined with coreos/fedora-coreos-config#70,
this allows us to drop all OSTree-specific bits and no longer rely on
`ostree-prepare-root.service` to mount `/var` for us.
  • Loading branch information
jlebon committed Mar 21, 2019
1 parent 367f85a commit f9144af
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 39 deletions.
20 changes: 0 additions & 20 deletions dracut/30ignition/ignition-ask-var-mount.service

This file was deleted.

20 changes: 3 additions & 17 deletions dracut/30ignition/ignition-files.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,13 @@ Before=ignition-complete.target
OnFailure=emergency.target
OnFailureJobMode=isolate

# Ignition files stage starts after /sysroot is mounted.
Requires=initrd-root-fs.target
After=initrd-root-fs.target

# Run after ignition-setup has run because ignition-setup
# may copy in new/different ignition configs for us to consume.
After=ignition-setup.service

# Make sure root filesystem is mounted read-write
After=ignition-remount-sysroot.service
# We need all the filesystems already mounted.
Requires=ignition-mount.service
After=ignition-mount.service

# Run before initrd-parse-etc so that we can drop files it then picks up.
Before=initrd-parse-etc.service

# Network may be required to fetch userdata content.
After=network.target

# This is guaranteed through After=initrd-root-fs.target but just to
# be explicit we'll add an After=ignition-disks.service here.
After=ignition-disks.service

[Service]
Type=oneshot
EnvironmentFile=/run/ignition.env
Expand Down
23 changes: 23 additions & 0 deletions dracut/30ignition/ignition-mount.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[Unit]
Description=Ignition (mount)
DefaultDependencies=false
OnFailure=emergency.target
OnFailureJobMode=isolate

# Make sure the final /sysroot is ready first, since we're mounting under there
Requires=initrd-root-fs.target
After=initrd-root-fs.target

# Make sure root filesystem is remounted read-write if needed
After=ignition-remount-sysroot.service

# This is guaranteed through After=initrd-root-fs.target but just to
# be explicit.
After=ignition-disks.service

[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/run/ignition.env
ExecStart=/usr/bin/ignition --root=/sysroot --platform=${PLATFORM_ID} --stage=mount --log-to-stdout
ExecStop=/usr/bin/ignition --root=/sysroot --platform=${PLATFORM_ID} --stage=umount --log-to-stdout
2 changes: 1 addition & 1 deletion dracut/30ignition/ignition-setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
set -eu
set -euo pipefail

copy_file_if_exists() {
src="${1}"; dst="${2}"
Expand Down
2 changes: 1 addition & 1 deletion dracut/30ignition/module-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ install() {

install_ignition_unit ignition-setup.service
install_ignition_unit ignition-disks.service
install_ignition_unit ignition-mount.service
install_ignition_unit ignition-files.service
install_ignition_unit ignition-ask-var-mount.service
install_ignition_unit ignition-remount-sysroot.service
}

Expand Down

0 comments on commit f9144af

Please sign in to comment.