File isopatch.sh of Package kde-live
#! /bin/sh
set -ex
location=$1
iso_dir=${location#iso:}
iso_bootlogo=${iso_dir}/boot/*/loader/bootlogo
grubcfg=${iso_dir}/boot/grub2/grub.cfg
efi_grubcfg=${iso_dir}/EFI/BOOT/grub.cfg
# default language
#if [ $(arch) != aarch64 ]; then
#gfxboot --default-language ru_RU -a ${iso_bootlogo}
#fi
if [ $(arch) != i686 ]; then
sed -i '0,/\$linux/s/\(quiet\)/\1 lang=$lang/' ${grubcfg}
sed -i '/set default/s/$/\nif [ ! "$lang" ]; then lang=ru_RU; fi/' ${grubcfg}
sed -i '/set default/s/$/\nset lang=\$lang/' ${grubcfg}
sed -i 's/"Failsafe/\$"Failsafe/' ${grubcfg}
sed -i 's/"Mediacheck/\$"Mediacheck/' ${grubcfg}
sed -i 's/"Boot from/\$"Boot from/' ${grubcfg}
sed -i 's/\(Loading kernel...\)/\$"\1"/' ${grubcfg}
sed -i 's/\(Loading initrd...\)/\$"\1"/' ${grubcfg}
#sed -i 's/\(gfxmode\).*/\1=1280x1024/' ${grubcfg}
theme_openSUSE=${iso_dir}/boot/grub2/themes/openSUSE/theme.txt
#sed -i 's/Command Line/Командная строка/' ${theme_openSUSE}
#sed -i 's/Edit Entry/Изменить запись/' ${theme_openSUSE}
#sed -i 's/" font/ F2: Выбрать язык" font/' ${theme_openSUSE}
sed -i 's/" font/ F2: Change language" font/' ${theme_openSUSE}
sed -i '/desktop-color/s/$/\ndesktop-image: "back.png"/' ${theme_openSUSE}
cat >> ${grubcfg} <<-EOF
loadfont (\$root)/boot/grub2/themes/openSUSE/DejaVuSans-Bold14.pf2
loadfont (\$root)/boot/grub2/themes/openSUSE/DejaVuSans10.pf2
loadfont (\$root)/boot/grub2/themes/openSUSE/DejaVuSans12.pf2
loadfont (\$root)/boot/grub2/themes/openSUSE/ascii.pf2
submenu \$"Change language ..." --hotkey 'f2' --id 'lang' {
insmod regexp
for langstr in \$"Russian=ru_RU" "English=en_US"; do
regexp -s 1:langname -s 2:langcode '(.*)=(.*)' "\$langstr"
menuentry "\${langname}" "\$langcode" {
lang="\$2"
export lang
configfile (\$root)/boot/grub2/grub.cfg
}
done
menuentry \$"Return to the Main menu" {
configfile (\$root)/boot/grub2/grub.cfg
}
}
EOF
fi