Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
feat: add the ability to (un)hide the GRUB screen
Browse files Browse the repository at this point in the history
  • Loading branch information
c0deplayer committed Jan 26, 2024
1 parent 81d67e1 commit 4a2c132
Showing 1 changed file with 43 additions and 1 deletion.
44 changes: 43 additions & 1 deletion config/files/usr/share/ublue-os/just/60-custom.just
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,46 @@ install-pdm:
curl -sSL https://pdm-project.org/install-pdm.py.sha256 | sha256sum -c -
HOMEDIR=$( getent passwd "$USER" | cut -d: -f6 )
python3 install-pdm.py --path "${HOMEDIR}/pdm"
rm install-pdm.py
rm install-pdm.py
# Configure GRUB screen with various options
configure-grub ACTION="prompt":
#!/usr/bin/env bash
bold=$(tput bold)
normal=$(tput sgr0)
OPTION={{ ACTION }}
if [ "$OPTION" == "prompt" ]; then
echo "${bold}Configuring GRUB${normal}"
echo 'GRUB hiding option can be useful for making boot-times faster.'
echo 'Hide or Unhide GRUB? Press ESC to exit.'
OPTION=$(ugum choose "Unhide (Default)" Hide)
elif [ "$OPTION" == "help" ]; then
echo "Usage: ujust configure-grub <option>"
echo " <option>: Specify the quick option - 'hide' or 'unhide'"
echo " Use 'hide' to hide GRUB boot screen."
echo " Use 'unhide' to revert to defaults."
exit 0
fi
if [ "${OPTION,,}" == "hide" ]; then
sudo sed -i 's/GRUB_TIMEOUT=5/GRUB_TIMEOUT=0/g' /etc/default/grub
output=$(echo 'GRUB_TIMEOUT_STYLE=hidden' | sudo tee -a /etc/default/grub 2>&1) || echo "$output" && false
output=$(echo 'GRUB_HIDDEN_TIMEOUT=1' | sudo tee -a /etc/default/grub 2>&1) || echo "$output" && false
if [ -d /sys/firmware/efi ]; then
output=$(sudo grub2-mkconfig -o /etc/grub2-efi.cfg 2>&1) || echo "$output" && false
echo 'Hide UEFI GRUB logs during boot setting applied.'
else
output=$(sudo grub2-mkconfig -o /etc/grub2.cfg 2>&1) || echo "$output" && false
echo 'Hide BIOS GRUB logs during boot setting applied.'
fi
elif [ "$OPTION" == "Unhide (Default)" ] || [ "${OPTION,,}" == "unhide" ]; then
sudo sed -i '/GRUB_HIDDEN_TIMEOUT=1/d' /etc/default/grub
sudo sed -i '/GRUB_TIMEOUT_STYLE=hidden/d' /etc/default/grub
sudo sed -i 's/GRUB_TIMEOUT=0/GRUB_TIMEOUT=5/g' /etc/default/grub
if [ -d /sys/firmware/efi ]; then
output=$(sudo grub2-mkconfig -o /etc/grub2-efi.cfg 2>&1) || echo "$output" && false
echo 'Reverted setting "UEFI GRUB logs during boot" to defaults.'
else
output=$(sudo grub2-mkconfig -o /etc/grub2.cfg 2>&1) || echo "$output" && false
echo 'Reverted setting "BIOS GRUB logs during boot" to defaults.'
fi
fi

0 comments on commit 4a2c132

Please sign in to comment.