aboutsummaryrefslogtreecommitdiffstats
path: root/trunk/xinit.d/menu
blob: 41b8c998327408c03af275351114e33c7070fa8d (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
#!/bin/sh

# move old menus if still existing
if [ ! -f $HOME/.mdk-menu-migrated ]; then
if [ -f $HOME/.config/menus/applications-mdk.menu ]; then
	mv $HOME/.config/menus/applications-mdk.menu $HOME/.config/menus/applications-mdk.menu.obsolete
	if [ -L $HOME/.config/menus/applications.menu ]; then
		mv $HOME/.config/menus/applications.menu $HOME/.config/menus/applications.menu.obsolete
	fi
fi

if [ -d $HOME/.local/share/applications/Mandrakelinux ]; then
	mkdir -p $HOME/.local/share/applications-obsolete/ 2> /dev/null
	mv $HOME/.local/share/applications/Mandrakelinux $HOME/.local/share/applications-obsolete/Mandrakelinux 
fi

if [ -d $HOME/.local/share/applications/MandrivaLinux ]; then
	mkdir -p $HOME/.local/share/applications-obsolete/ 2> /dev/null
	mv $HOME/.local/share/applications/MandrivaLinux $HOME/.local/share/applications-obsolete/MandrivaLinux 
fi

if [ -d $HOME/.local/share/desktop-directories ]; then
	mkdir -p $HOME/.local/share/desktop-directories-obsolete 
	mv $HOME/.local/share/desktop-directories/mandrake* $HOME/.local/share/desktop-directories-obsolete/ 2> /dev/null
fi
touch $HOME/.mdk-menu-migrated
fi

USER_STAMP=$HOME/.menu-updates.stamp
SYSTEM_STAMP=/var/lib/menu/.menu-updates.stamp
MENU_DIR=$HOME/.config/menus
APPS_DIR=$HOME/.local/share/applications

RETVAL=0

if [ \( -d "$MENU_DIR" -o -d "$APP_DIR" \) -o -f "$USER_STAMP" -a -f "$SYSTEM_STAMP" ]; then
    if [ ! -f "$USER_STAMP" ]; then
            RETVAL=1;
    elif [ "$SYSTEM_STAMP" -nt "$USER_STAMP" ]; then
            RETVAL=1;
    elif [ "$MENU_DIR" -nt "$USER_STAMP" ]; then
	    RETVAL=1;
    elif [ "$APPS_DIR" -nt "$USER_STAMP" ]; then
            RETVAL=1;
    fi
    if [ $RETVAL -eq 1 ]; then
        echo "Running update-menus..."
        update-menus -u
	echo "menu generation finished"
    fi
fi


# menu ends here