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

ostree-grub-generator: allow adding custom scripts to grub.cfg #3162

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
13 changes: 13 additions & 0 deletions src/boot/grub2/ostree-grub-generator
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ script=$(basename ${0})
# Atomically safe location where to generete grub.cfg when executing system upgrade.
new_grub2_cfg=${2}
entries_path=$(dirname $new_grub2_cfg)/entries
custom_scripts="/etc/ostree.d"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like it should be e.g. /etc/ostree-grub.d or so.


read_config()
{
Expand Down Expand Up @@ -105,10 +106,22 @@ timeout=10
EOF
}

populate_custom_section()
{
if [ -d "$custom_scripts" ]; then
for script in $(ls -v $custom_scripts/*); do
echo -e "\n### BEGIN ${script} ###" >> ${new_grub2_cfg}
cat ${script} >> ${new_grub2_cfg}
echo -e "\n### END ${script} ###\n" >> ${new_grub2_cfg}
done
fi
}

generate_grub2_cfg()
{
populate_warning
populate_header
populate_custom_section
populate_menu
}

Expand Down
Loading