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

BLS: only write /etc/kernel/cmdline if writable #106

Merged
merged 2 commits into from
Aug 17, 2022
Merged
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
17 changes: 7 additions & 10 deletions util/grub.d/10_linux.in
Original file line number Diff line number Diff line change
@@ -161,16 +161,13 @@ update_bls_cmdline()
local cmdline="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
local -a files=($(get_sorted_bls))

if [[ ! -f /etc/kernel/cmdline ]] ||
[[ /etc/kernel/cmdline -ot /etc/default/grub ]]; then
# anaconda has the correct information to create this during install;
# afterward, grubby will take care of syncing on updates. If the user
# has modified /etc/default/grub, try to cope.
if [[ ! "$cmdline" =~ "rhgb quiet" ]]; then
# ensure these only show up once
cmdline="$cmdline rhgb quiet"
fi
echo "$cmdline" > /etc/kernel/cmdline
if [ -w /etc/kernel ] &&
[[ ! -f /etc/kernel/cmdline ||
/etc/kernel/cmdline -ot /etc/default/grub ]]; then
# anaconda has the correct information to create this during install;
# afterward, grubby will take care of syncing on updates. If the user
# has modified /etc/default/grub, try to cope.
echo "$cmdline" > /etc/kernel/cmdline
fi

for bls in "${files[@]}"; do