fix: the old background reappears for a few seconds

Add replacing or appending "GRUB_BACKGROUND" surpport for file "/etc/default/grub" to fix "the old background reappears for a few seconds" bug.
This commit is contained in:
hotime 2023-08-01 18:55:38 +08:00 committed by GitHub
parent 9c673d5a34
commit cd5fee4582
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -181,6 +181,14 @@ install() {
echo "GRUB_THEME=\"${THEME_DIR}/${theme}/theme.txt\"" >> /etc/default/grub
fi
if grep "GRUB_BACKGROUND=" /etc/default/grub 2>&1 >/dev/null; then
#Replace GRUB_BACKGROUND
sed -i "s|.*GRUB_BACKGROUND=.*|GRUB_BACKGROUND=\"${THEME_DIR}/${theme}/background.jpg\"|" /etc/default/grub
else
#Append GRUB_BACKGROUND
echo "GRUB_BACKGROUND=\"${THEME_DIR}/${theme}/background.jpg\"" >> /etc/default/grub
fi
# Make sure the right resolution for grub is set
if [[ ${screen} == '1080p' ]]; then
gfxmode="GRUB_GFXMODE=1920x1080,auto"