diff options
author | Olivier Blin <oblin@mandriva.org> | 2006-11-07 08:28:00 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.org> | 2006-11-07 08:28:00 +0000 |
commit | d3821bca17816eed538a8e6185536aae48c491ad (patch) | |
tree | 007b436dceb299715a071c12b64bffc4320092c0 /scripts | |
parent | a0af42541e8c155c4ee85786ba4d501838074703 (diff) | |
download | bootsplash-d3821bca17816eed538a8e6185536aae48c491ad.tar bootsplash-d3821bca17816eed538a8e6185536aae48c491ad.tar.gz bootsplash-d3821bca17816eed538a8e6185536aae48c491ad.tar.bz2 bootsplash-d3821bca17816eed538a8e6185536aae48c491ad.tar.xz bootsplash-d3821bca17816eed538a8e6185536aae48c491ad.zip |
skip theme removal if an argument is given and is not current theme
Diffstat (limited to 'scripts')
-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 |