This repository has been archived by the owner on Aug 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dracut/30ignition: Reboot the system after ignition if kargs.d exists
As mentioned in https://github.com/coreos/ignition-dracut/issues/81#issuecomment-494888494, this change adds a service that checks for the presence of `/etc/ostree/kargs.d` and redeploys then reboots the system if it exists. Closes: #81
- Loading branch information
Allen Bai
committed
Jun 27, 2019
1 parent
df88988
commit 2fac5c8
Showing
3 changed files
with
32 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[Unit] | ||
Description=Reboot after Ignition to apply kargs | ||
Documentation=https://github.com/coreos/ignition-dracut | ||
DefaultDependencies=false | ||
Before=ignition-complete.target | ||
|
||
# Make sure user configs have kargs files | ||
After=ignition-files.service | ||
|
||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=yes | ||
ExecStart=/usr/sbin/ignition-apply-kargs |
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,15 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
# Checks if kernel argument directory exists, | ||
# then redeploy and reboot the system if it exists | ||
reboot_if_kargs_dir_exists() { | ||
local REFSPEC=( $(ostree refs --repo /sysroot/ostree/repo) ) | ||
if [ -d /sysroot/etc/ostree/kargs.d ] | ||
then | ||
ostree admin deploy REFSPEC | ||
exec systemctl reboot | ||
fi | ||
} | ||
|
||
reboot_if_kargs_dir_exists |
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