-
Notifications
You must be signed in to change notification settings - Fork 363
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
network: start dnsconfd in initramfs #6200
base: rhel-10
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -305,6 +305,7 @@ parse_kickstart() { | |
unset CMDLINE # re-read the commandline | ||
. /tmp/ks.info # save the parsed kickstart | ||
[ -e "$parsed_kickstart" ] && cp "$parsed_kickstart" /run/install/ks.cfg | ||
start_dnsconfd "The certificates may have been imported." | ||
} | ||
|
||
# print a list of net devices that dracut says are set up. | ||
|
@@ -384,6 +385,10 @@ run_kickstart() { | |
udevadm trigger --action=change --subsystem-match=block | ||
fi | ||
|
||
if [ "$do_net" ]; then | ||
start_dnsconfd "The network may have become required" | ||
fi | ||
|
||
# net: re-run online hooks | ||
if [ "$do_net" ]; then | ||
# If NetworkManager is used in initramfs | ||
|
@@ -452,3 +457,42 @@ wait_for_disks() { | |
DISKS_WAIT_RETRIES=$((DISKS_WAIT_DELAY * 2)) | ||
echo "[ \"\$main_loop\" -ge \"$DISKS_WAIT_RETRIES\" ]" > "$finished_hook" | ||
} | ||
|
||
# This script should start dnsconfd if all required conditions to run it are met | ||
start_dnsconfd() { | ||
|
||
local reason="$1" | ||
local start="yes" | ||
|
||
echo "Attempting to start dnsconfd. Reason: ${reason}" | ||
|
||
# dnsconfd is explicitly required by kernel boot option | ||
dns_backend=$(getarg rd.net.dns-backend=) | ||
if [ "${dns_backend}" != "dnsconfd" ]; then | ||
echo "Attempting to start dnsconfd. Not starting because not required by kernel boot option." | ||
start="no" | ||
fi | ||
|
||
# Network is required in initramfs | ||
getargbool 0 rd.neednet && neednet=1 | ||
if [ ! -e "/tmp/net.ifaces" ] && [ "${neednet}" != "1" ]; then | ||
echo "Attempting to start dnsconfd. Not starting because network is not required (yet)." | ||
start="no" | ||
fi | ||
|
||
# It is not possible certificates for dnsconfd will be imported after start by kickstart | ||
kickstart="$(getarg inst.ks=)" | ||
# If kickstart has not been parsed yet && is reqiured by boot options | ||
if [ ! -e /run/install/ks.cfg ] && ([ -n "$kickstart" ] || getargbool 0 inst.ks); then | ||
echo "Attempting to start dnsconfd. Not starting because certificates can be imported via kickstart later." | ||
start="no" | ||
fi | ||
|
||
if [ "${start}" == "yes" ]; then | ||
echo "Attempting to start dnsconfd. Starting." | ||
systemctl start --no-block unbound.service | ||
return 0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't we want to have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we'd care more about the information 'should the service be started now?'. The return value is not needed anywhere anyway. I think at this point it is just too early complicate the things by figuring stable expected return values. |
||
else | ||
return 1 | ||
fi | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/sh | ||
# Attempt to start dnsconfd after boot options are parsed. | ||
# The script needs to be run only after boot options are parsed, | ||
# (parse-anaconda-* cmdline hooks are finished). | ||
# There are also other attempts to start dnsconfd with start_dnsconfd | ||
# called after parsing kickstart, see anaconda-lib. | ||
|
||
. /lib/anaconda-lib.sh | ||
start_dnsconfd "Anaconda boot options have been parsed" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can just write it starting as this shouldn't be just an attempt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted make easier matching the message to the previous related log message
Attempting to start dnsconfd. Reason: ${reason}
when looking at the log.