From 4deac71ab4ae4702dfe45549f095362b584c45c0 Mon Sep 17 00:00:00 2001 From: Michael Mugnai Date: Sun, 9 Jul 2023 22:02:34 +0200 Subject: [PATCH] improve grub.bak existance check --- install.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 2bae89c..e6bfb19 100755 --- a/install.sh +++ b/install.sh @@ -136,9 +136,17 @@ install() { prompt -i "\n Setting ${theme} as default..." # Backup grub config - if [[ ! -f "/etc/default/grub.bak" ]]; then - cp -an /etc/default/grub /etc/default/grub.bak - fi + if [[ -f /etc/default/grub.bak ]]; then + echo -ne "\n${b_CWAR}File '/etc/default/grub.bak' already exists. Remove it? [yN]${CDEF}" + read choice + if [ "$choice" = 'y' ]; then + cp -a /etc/default/grub /etc/default/grub.bak + else + echo -ne "\n${b_CWAR}Skipping to save a backup configuration in '/etc/default/grub.bak'${CDEF}" + fi + else + cp -a /etc/default/grub /etc/default/grub.bak + fi # Fedora workaround to fix the missing unicode.pf2 file (tested on fedora 34): https://bugzilla.redhat.com/show_bug.cgi?id=1739762 # This occurs when we add a theme on grub2 with Fedora.