File: check_calligra_install.sh

package info (click to toggle)
calligra 1%3A2.4.4-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 290,028 kB
  • sloc: cpp: 1,105,019; xml: 24,940; ansic: 11,807; python: 8,457; perl: 2,792; sh: 1,507; yacc: 1,307; ruby: 1,248; sql: 903; lex: 455; makefile: 89
file content (98 lines) | stat: -rwxr-xr-x 2,246 bytes parent folder | download
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/bash
if ! kde4-config ; then
  echo 'kde4-config not found ! Aborting. You need a more recent KDE, or to fix your $PATH.'
  exit 1
fi

instance=words
applnks=`kde4-config --path apps`:`kde4-config --path xdgdata-apps`
services=`kde4-config --path services`
found=0

function checkname()
{
  f=`echo $1 | sed -e 's,//,/,g'`
  if [ -f $f ]; then
    echo -n "Found: $f... "
    mimetypes=`grep ^MimeType $f|sed -e 's/.*=//;s/;/,/g;'`
    servicetypes=`grep ^ServiceTypes $f|sed -e 's/.*=//;s/$/,/g'`
    fulllist="$mimetypes,$servicetypes"
    if echo $fulllist | grep "CalligraPart," >/dev/null 2>/dev/null; then
      echo "ok, this is a CalligraPart"
    else
      echo '**** CalligraPart not in list of types !'
      echo Service Types: $fulllist
      cat $f
      exit 1
    fi
    nativemime=`grep X-KDE-NativeMimeType $f`
    echo Native mimetype : $nativemime
    if echo $nativemime | grep "application/x-$instance" >/dev/null 2>/dev/null; then
      found=1
    fi
  fi
}

IFS=:
for dir in $services; do
  if test -n "$dir"; then
    echo Looking for ${instance}part.desktop under services dir: $dir
    f="$dir/${instance}part.desktop"
    checkname $f
  fi
done

if [ $found = 0 ]; then
  # The old way, as fallback
  for dir in $applnks; do
    if test -n "$dir"; then
      echo Looking under applnk dir: $dir
      f="$dir/Office/$instance.desktop"
      checkname $f
    fi
  done
fi

if [ $found = 0 ]; then
  echo
  echo Now looking by filename
  echo

  for dir in $applnks; do
    if test -n "$dir"; then
      echo Looking under applnk dir: $dir
      for f in `find $dir -name $instance.desktop`; do
        checkname $f
      done
    fi
  done
fi

if [ $found = 0 ]; then
  echo "***** No $instance.desktop with X-KDE-NativeMimetype in it was found! Installation problem."
  echo $applnks
fi

echo

stfound=0
for dir in `kde4-config --path servicetypes`; do
  echo Service Types dir $dir
  f=`echo $dir/calligrapart.desktop | sed -e 's,//,/,g'`
  if [ -f $f ]; then
    echo Found $f
    grep Native $f
    stfound=1
  fi
done

if [ $stfound = 0 ]; then
  echo '****** calligrapart.desktop not found!'
  kde4-config --path servicetypes
else
  echo
  if [ $found = 1 ]; then
    echo "Everything looks ok"
  fi
fi