aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/remove-theme
blob: 14636c1016bcda6e02dde3c6b779c1e1fc247efc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/sh
# -*- Mode: shell-script -*-
# Copyright (C) 2003 by Florent Villard <warly@mandrakesoft.com>
# Redistribution of this file is permitted under the terms of the GNU 
# Public License (GPL)
#

sysconfig=/etc/sysconfig/bootsplash

function remove_theme () {
    tmpfile=$(mktemp /tmp/.bootsplash.XXXXXXX)
    cp -f $sysconfig $tmpfile && rm -f $sysconfig
    ok=
    while read line;do
	if [[ $line == THEME=* ]];then 
	    echo "THEME=" >> $sysconfig
	    ok=yes
	    continue;
	fi
	echo $line >> $sysconfig
    done < $tmpfile
    if [[ -z $ok ]];then
	echo "THEME=$toswitch" >> $sysconfig
    fi
    rm -f $tmpfile
    rm -f /etc/bootsplash/current
}

function update_boot () {
    pushd /boot &> /dev/null
    if [[ -x /usr/share/loader/make-initrd ]]; then 
        /usr/share/loader/make-initrd -n &> /dev/null 
        if [[ -x /usr/sbin/detectloader ]]; then 
            LOADER=$(/usr/sbin/detectloader -q) 
	    if [[ $LOADER = "LILO" ]] && [[ -x /sbin/lilo ]];then 
                /sbin/lilo >/dev/null 2>/dev/null 
	    fi   
	    if [[ $LOADER = "YABOOT" ]] && [[ -x /sbin/ybin ]];then 
	        /sbin/ybin >/dev/null 2>/dev/null 
	    fi 
        fi 
    fi 
    popd &> /dev/null
}

function usage () {
    basename=`basename $0`
    cat <<EOF
     $basename <theme>

EOF
    exit 1
}
    
theme=$1

[[ -z $theme ]] &&  usage;

[[ -f $sysconfig ]] && . $sysconfig

if [[ $THEME = $theme ]]; then
    remove_theme
    update_boot
fi