blob: 2dd6dc613933f4ab19129e41f4b82aa2192bea77 (
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
|
#!/bin/sh
MDK_FOLDERS="$HOME/.mdk-folders"
if [ "$UID" != "0" -a ! -e $MDK_FOLDERS ]; then
. /etc/profile.d/10lang.sh
locale=C
if [ ! -z "$LC_ALL" ]; then
locale=$LC_ALL
elif [ ! -z "$LC_CTYPE" ]; then
locale=$LC_CTYPE
elif [ ! -z "$LANG" ]; then
locale=$LANG
fi
CHARSET=`locale charmap`
[ -d $MDK_FOLDERS ] || mkdir -p "$MDK_FOLDERS"
for file in /usr/share/mdk/menu/*-mdk.desktop.template ; do
TARGET_DIR=`grep -m1 -F Name[$locale]= $file | sed -e 's|.*=||g'`
if [ -z "$TARGET_DIR" ]; then
locale=`echo $locale | sed -e 's/@.*//g' -e 's/\..*//g'`
TARGET_DIR=`grep -m1 -F Name[$locale]= $file | sed -e 's|.*=||g'`
if [ -z "$TARGET_DIR" ]; then
locale=`echo $locale | sed -e 's/_.*//g'`
TARGET_DIR=`grep -m1 -F Name[$locale]= $file | sed -e 's|.*=||g'`
fi
fi
if [ -z "$TARGET_DIR" ]; then
TARGET_DIR=`grep -m1 -F Name= $file | sed -e 's|.*=||g'`
fi
if [ "$CHARSET" != "UTF-8" ]; then
TARGET_DIR=`echo $TARGET_DIR | iconv -f UTF-8 -t "$CHARSET" 2>/dev/null`
fi
DIRECTORY_PATH="$HOME/$TARGET_DIR"
[ -d "$DIRECTORY_PATH" ] || mkdir -p "$DIRECTORY_PATH"
echo -e [Desktop Entry]\\n`grep Icon= $file` > "$DIRECTORY_PATH/.directory"
FILE_PATH=$MDK_FOLDERS/`basename $file .template`
SYMLINK=$MDK_FOLDERS/`basename $file -mdk.desktop.template`
ln -f -s "$DIRECTORY_PATH" $SYMLINK
if [ "$CHARSET" != "UTF-8" ]; then
DIRECTORY_PATH=`echo $DIRECTORY_PATH | iconv -f "$CHARSET" -t UTF-8 2>/dev/null`
fi
[ -f $FILE_PATH ] || cat $file | sed -e "s|\$HOME.*|$DIRECTORY_PATH|g" > $FILE_PATH
echo "file://$FILE_PATH" >> $HOME/.gtk-bookmarks
done
fi
|