@ -371,31 +371,46 @@ remove() {
# Check for root access and proceed if it is present
# Check for root access and proceed if it is present
if [ " $UID " -eq " $ROOT_UID " ] ; then
if [ " $UID " -eq " $ROOT_UID " ] ; then
echo -e "\n Checking for the existence of themes directory..."
echo -e "\n Checking for the existence of themes directory..."
if [ [ -d " ${ THEME_DIR } / ${ theme } " ] ] ; then
if [ [ -d " ${ THEME_DIR } / ${ theme } " ] ] ; then
rm -rf " ${ THEME_DIR } / ${ theme } "
rm -rf " ${ THEME_DIR } / ${ theme } "
else
else
prompt -e " \n ${ theme } grub theme not exist!"
prompt -e " \n Specified ${ theme } theme does not exist!"
exit 0
exit 0
fi
fi
# Backup grub config
local grub_config_location = ""
if [ [ -f "/etc/default/grub.bak" ] ] ; then
if [ [ -f "/etc/default/grub" ] ] ; then
rm -rf /etc/default/grub && mv /etc/default/grub.bak /etc/default/grub
grub_config_location = "/etc/default/grub"
elif [ [ -f "/etc/default/grub.d/kali-themes.cfg" ] ] ; then
grub_config_location = "/etc/default/grub.d/kali-themes.cfg"
else
else
prompt -e "\n grub.bak not exist!"
exit 0
fi
# For Kali linux
prompt -e "\nCannot find grub config file in default locations!"
if [ [ -f "/etc/default/grub.d/kali-themes.cfg.bak" ] ] ; then
prompt -e "\nPlease inform the developers by opening an issue on github."
rm -rf /etc/default/grub.d/kali-themes.cfg && mv /etc/default/grub.d/kali-themes.cfg.bak /etc/default/grub.d/kali-themes.cfg
prompt -e "\nExiting..."
exit 1
fi
fi
# Update grub config
local current_theme = "" # Declaration and assignment should be done seperately ==> https://github.com/koalaman/shellcheck/wiki/SC2155
prompt -s "\n Resetting grub theme...\n"
current_theme = " $( grep 'GRUB_THEME=' $grub_config_location | grep -v \# ) "
if [ [ -n " $current_theme " ] ] ; then
# Backup with --in-place option to grub.bak within the same directory; then remove the current theme.
sed --in-place= '.bak' " s| $current_theme |#GRUB_THEME=| " " $grub_config_location "
updating_grub
# Update grub config
prompt -s "\n Resetting grub theme...\n"
updating_grub
else
prompt -e "\nNo active theme found."
prompt -e "\nExiting..."
exit 1
fi
else
else
#Check if password is cached (if cache timestamp not expired yet)
#Check if password is cached (if cache timestamp not expired yet)