-
Notifications
You must be signed in to change notification settings - Fork 397
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
01bootetc: introduce module for updating dracut etc
This provides support for updating '/etc/' in the initramfs using 'bootetc=<DEVICE>'. If the device has the path '/initrd-etc', then the tree is copied into the initramfs. The purpose of bootetc is to aide immutable operating systems like Fedora and Red Hat CoreOS that ship static initrds with a path for user-provided configuration. Example use cases include udev rules, iSCSI and multipath configuration, fips and Network Manager configurations.
- Loading branch information
Ben Howard
committed
Apr 17, 2020
1 parent
25c7a13
commit b4af464
Showing
8 changed files
with
124 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[Unit] | ||
Description=Update initramfs etc | ||
Before=iscsi.service iscsid.service lvm2-activation-early.service | ||
Wants=systemd-udev-trigger.service systemd-udev-settle.service local-fs-pre.target | ||
After=systemd-udev-trigger.service systemd-udev-settle.service | ||
Before=local-fs-pre.target dracut-initqueue.service | ||
|
||
DefaultDependencies=no | ||
Conflicts=shutdown.target | ||
|
||
ConditionKernelCommandLine=bootetc | ||
ConditionPathExists=!/run/bootetc.done | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/sbin/boot-etc | ||
ExecStart=/usr/bin/touch /run/bootetc.done | ||
|
||
[Install] | ||
WantedBy=sysinit.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/sh | ||
. /lib/dracut-lib.sh | ||
|
||
bootetc=$(getarg bootetc=) | ||
if [ "${bootetc}x" == "x" ]; then | ||
exit 0 | ||
fi | ||
|
||
mount_boot bootetc | ||
if [ -d /boot/initrd-etc ] && [ ! -f /run/bootetc.done ]; then | ||
info "bootetc: Updating initramfs etc from ${bootetc}/initrd-etc" | ||
copytree /boot/initrd-etc /etc | ||
touch /run/bootetc.done | ||
|
||
if [ -z "$DRACUT_SYSTEMD" ]; then | ||
systemctl try-restart dracut-cmdline.service | ||
systemctl try-restart systemd-udev-trigger.service | ||
fi | ||
fi | ||
|
||
umount /boot >/dev/null 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
# called by dracut | ||
check() { | ||
return 0 | ||
} | ||
|
||
# called by dracut | ||
depends() { | ||
return 0 | ||
} | ||
|
||
# called by dracut | ||
install() { | ||
inst_simple "$moddir/boot-etc.sh" "/sbin/boot-etc" | ||
|
||
if dracut_module_included "systemd"; then | ||
inst_simple "${moddir}/boot-etc.service" "${systemdsystemunitdir}/boot-etc.service" | ||
systemctl -q --root "$initdir" enable boot-etc.service | ||
else | ||
inst_hook pre-trigger 01 "$moddir/boot-etc.sh" | ||
fi | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters