2
if ! kde4-config ; then
3
echo 'kde4-config not found ! Aborting. You need a more recent KDE, or to fix your $PATH.'
8
echo -n "KDE prefixes: "
11
# Check for the binary
13
exedirs=`kde4-config --path exe`
14
for dir in $exedirs; do
15
if [ -f "$dir/words" ]; then
16
echo "words found in $dir"
21
if [ $found -eq 0 ]; then
22
echo "ERROR: words not found - looked at $exedirs"
25
mimelnks=`kde4-config --path mime`
26
# Relevant existing mimetypes
29
for dir in $mimelnks; do
30
filename="application/msword.desktop"
31
if [ -f "$dir$filename" ]; then
32
echo -n "Found: $dir$filename... "
33
hidden=`grep ^Hidden $dir$filename`
34
if [ "$hidden" == "true" ]; then
37
mimetype=`grep ^MimeType $dir$filename|sed -e 's/.*=//'`
38
mimes="$mimes:$mimetype"; # using ':' because of IFS
39
patterns=`grep ^Patterns $dir$filename|sed -e 's/.*=//'`
40
if [ -n "$patterns" ]; then
41
echo -n "(associated with $patterns)"
46
filename="application/msword2.desktop"
47
if [ -f "$dir$filename" ]; then
48
echo -n "Found: $dir$filename... "
49
hidden=`grep ^Hidden $dir$filename`
50
if [ "$hidden" == "true" ]; then
53
mimetype=`grep ^MimeType $dir$filename|sed -e 's/.*=//'`
54
mimes="$mimes:$mimetype"; # using ':' because of IFS
55
patterns=`grep ^Patterns $dir$filename|sed -e 's/.*=//'`
56
if [ -n "$patterns" ]; then
57
echo -n "(associated with $patterns)"
65
mimes=`echo $mimes | sed -e 's/^://g'`
66
echo "Relevant mimetypes found: $mimes"
70
for dir in $mimelnks; do
72
if [ -f "$magic" ]; then
74
grep 'Microsoft\\ Word' $magic
79
if [ $foundmagicfile -eq 0 ]; then
80
echo "ERROR: Magic file not found $magic"
83
for dir in `kde4-config --path services`; do
84
echo Services dir $dir
85
for mime in $mimes; do
86
grep "Import=.*$mime" $dir/*.desktop