aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2006-11-07 08:28:00 +0000
committerOlivier Blin <oblin@mandriva.org>2006-11-07 08:28:00 +0000
commitd3821bca17816eed538a8e6185536aae48c491ad (patch)
tree007b436dceb299715a071c12b64bffc4320092c0 /scripts
parenta0af42541e8c155c4ee85786ba4d501838074703 (diff)
downloadbootsplash-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-theme25
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