From efcd1998a25c7c1c2666d2f2a12f820905a679c6 Mon Sep 17 00:00:00 2001 From: mfgbhatti Date: Sun, 20 Feb 2022 20:15:10 +0000 Subject: [PATCH] grub themes from Top-5-Bootloader-Themes --- 3-post-setup.sh | 41 ++++++++++++++++++++++++----------------- startup.sh | 18 ++++++++++++++++++ 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/3-post-setup.sh b/3-post-setup.sh index 6814baa..fa21915 100755 --- a/3-post-setup.sh +++ b/3-post-setup.sh @@ -12,26 +12,33 @@ else exit 0 fi +install_grub_theme() { + if [[ "$GRUBTHEME" =~ "None" ]]; then + echo "No grub theme selected. Skipping..." + else + echo -e "Installing $GRUBTHEME Grub theme..." + git clone https://github.com/ChrisTitusTech/Top-5-Bootloader-Themes tmp + echo -e "Creating the theme directory..." + mkdir -p "$THEMEDIR"/"$GRUBTHEME" + echo -e "Copying the theme..." + cd "$HOME"/tmp/themes || exit 0 + cp -a "$GRUBTHEME"/* "$THEMEDIR"/"$GRUBTHEME" + echo -e "Backing up Grub config..." + cp -an /etc/default/grub /etc/default/grub.bak + echo -e "Setting the theme as the default..." + grep "GRUB_THEME=" /etc/default/grub >/dev/null 2>&1 && sed -i '/GRUB_THEME=/d' /etc/default/grub + echo "GRUB_THEME=\"$THEMEDIR/$GRUBTHEME/theme.txt\"" >>/etc/default/grub + echo -e "Updating grub..." + grub-mkconfig -o /boot/grub/grub.cfg + echo -e "All set!" + fi +} + + logo title "Post Install and cleaning" if [[ "$LAYOUT" -eq 1 || "$BOOTLOADER" =~ "grub" ]]; then - echo -e "Installing CyberRe Grub theme..." - THEME_DIR="/boot/grub/themes" - THEME_NAME=CyberRe - echo -e "Creating the theme directory..." - mkdir -p "${THEME_DIR}/${THEME_NAME}" - echo -e "Copying the theme..." - cd "$HOME"/ArchTitus || exit 0 - cp -a ${THEME_NAME}/* ${THEME_DIR}/${THEME_NAME} - echo -e "Backing up Grub config..." - cp -an /etc/default/grub /etc/default/grub.bak - echo -e "Setting the theme as the default..." - grep "GRUB_THEME=" /etc/default/grub >/dev/null 2>&1 && sed -i '/GRUB_THEME=/d' /etc/default/grub - echo "GRUB_THEME=\"${THEME_DIR}/${THEME_NAME}/theme.txt\"" >>/etc/default/grub - echo -e "Updating grub..." - grub-mkconfig -o /boot/grub/grub.cfg - echo -e "All set!" - + install_grub_theme fi if [[ "$LAYOUT" -eq 1 || "$DESKTOP" =~ "lxqt" ]]; then diff --git a/startup.sh b/startup.sh index 3c2d30d..3cff961 100644 --- a/startup.sh +++ b/startup.sh @@ -503,6 +503,23 @@ set_aur_helper() { done } +set_grub_theme() { + title "Choose your preferred GRUB theme" + SELECTION=("CyberRe" "Cyberpunk" "Shodan" "Vimix" "fallout" "None") + PS3="$PROMPT" + select OPT in "${SELECTION[@]}"; do + if elements_present "$OPT" "${SELECTION[@]}"; then + set_option "GRUBTHEME" "${OPT}" + set_option "THEMEDIR" "/boot/grub/themes" + break + else + invalid_option + set_grub_theme + break + fi + done +} + set_bootloader() { title "Select your bootloader" SELECTION=("Default (GRUB)" "Systemd" "UEFI" "None") @@ -513,6 +530,7 @@ set_bootloader() { if elements_present "$OPT" "${SELECTION[@]}"; then if [[ "$OPT" == "Default (GRUB)" ]]; then set_option "BOOTLOADER" "grub" + set_grub_theme break else set_option "BOOTLOADER" "${OPT,,}"