diff options
-rw-r--r-- | scripts/remove-theme | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/scripts/remove-theme b/scripts/remove-theme index 728c810..7bfe9e5 100644 --- a/scripts/remove-theme +++ b/scripts/remove-theme @@ -7,6 +7,16 @@ sysconfig=/etc/sysconfig/bootsplash +function get_current_theme () { + local opt= theme= + while read opt ;do + [[ $opt != THEME=* ]] && continue + theme=${opt##*=} + done < $sysconfig + #[[ -z $theme ]] && theme="Mandriva" + echo $theme +} + function remove_theme () { tmpfile=$(mktemp /tmp/.bootsplash.XXXXXXX) cp -f $sysconfig $tmpfile && rm -f $sysconfig @@ -36,11 +46,20 @@ function update_boot () { fi } -if [ "$1" = Mandrakelinux ]; then +theme_to_remove=$1 +if [ "$theme_to_remove" = Mandrakelinux ]; then # in case we are upgrading mandrakelinux-theme to mandriva-theme # "remove-theme Mandrakelinux" will be called thinking there is no theme anymore grep -qi "THEME=Mandriva" $sysconfig && exit 0 fi -remove_theme -update_boot + +current_theme=$(get_current_theme) +if [ -z "$theme_to_remove" -o "$theme_to_remove" = "$current_theme" ]; then + echo Removing $current_theme theme + remove_theme + update_boot +else + echo $theme_to_remove is not current theme, skipping + exit 0 +fi |