mirror of
https://github.com/ostreedev/ostree.git
synced 2024-12-21 13:34:34 +03:00
ostree-grub-generator: allow adding custom scripts to grub.cfg
This changes allow us to customize grub.cfg without manually editing it. Now, whatever files found under /etc/ostree.d are added (in alphabetical order) between the cfg header and its menuentries, allowing to add custom logic to the bootloader in a non intrusive way. Signed-off-by: Eduardo Ferreira <eduardo.barbosa@toradex.com>
This commit is contained in:
parent
da89214065
commit
c9260ffc55
@ -25,6 +25,7 @@ script=$(basename ${0})
|
|||||||
# Atomically safe location where to generete grub.cfg when executing system upgrade.
|
# Atomically safe location where to generete grub.cfg when executing system upgrade.
|
||||||
new_grub2_cfg=${2}
|
new_grub2_cfg=${2}
|
||||||
entries_path=$(dirname $new_grub2_cfg)/entries
|
entries_path=$(dirname $new_grub2_cfg)/entries
|
||||||
|
custom_scripts="/etc/ostree.d"
|
||||||
|
|
||||||
read_config()
|
read_config()
|
||||||
{
|
{
|
||||||
@ -105,10 +106,22 @@ timeout=10
|
|||||||
EOF
|
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()
|
generate_grub2_cfg()
|
||||||
{
|
{
|
||||||
populate_warning
|
populate_warning
|
||||||
populate_header
|
populate_header
|
||||||
|
populate_custom_section
|
||||||
populate_menu
|
populate_menu
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user