~ubuntu-branches/debian/sid/kexi/sid

« back to all changes in this revision

Viewing changes to devtools/scripts/check_msword_import.sh

  • Committer: Package Import Robot
  • Author(s): Pino Toscano
  • Date: 2017-06-24 20:10:10 UTC
  • Revision ID: package-import@ubuntu.com-20170624201010-5lrzd5r2vwthwifp
Tags: upstream-3.0.1.1
ImportĀ upstreamĀ versionĀ 3.0.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
if ! kde4-config ; then
 
3
  echo 'kde4-config not found ! Aborting. You need a more recent KDE, or to fix your $PATH.'
 
4
  exit 1
 
5
fi
 
6
IFS=:
 
7
 
 
8
echo -n "KDE prefixes: "
 
9
kde4-config --prefix
 
10
 
 
11
# Check for the binary
 
12
found=0
 
13
exedirs=`kde4-config --path exe`
 
14
for dir in $exedirs; do
 
15
  if [ -f "$dir/words" ]; then
 
16
    echo "words found in $dir"
 
17
    found=1
 
18
  fi
 
19
done
 
20
 
 
21
if [ $found -eq 0 ]; then
 
22
    echo "ERROR: words not found - looked at $exedirs"
 
23
fi
 
24
 
 
25
mimelnks=`kde4-config --path mime`
 
26
# Relevant existing mimetypes
 
27
mimes=""
 
28
 
 
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
 
35
          echo "deleted";
 
36
      else
 
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)"
 
42
          fi
 
43
          echo
 
44
      fi
 
45
  fi
 
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
 
51
          echo "deleted";
 
52
      else
 
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)"
 
58
          fi
 
59
          echo
 
60
      fi
 
61
  fi
 
62
done
 
63
 
 
64
IFS=" "
 
65
mimes=`echo $mimes | sed -e 's/^://g'`
 
66
echo "Relevant mimetypes found: $mimes"
 
67
 
 
68
IFS=:
 
69
foundmagicfile=0
 
70
for dir in $mimelnks; do
 
71
  magic=$dir/magic
 
72
  if [ -f "$magic" ]; then
 
73
    echo "$magic says: "
 
74
    grep 'Microsoft\\ Word' $magic
 
75
    foundmagicfile=1
 
76
  fi
 
77
done
 
78
 
 
79
if [ $foundmagicfile -eq 0 ]; then
 
80
    echo "ERROR: Magic file not found $magic"
 
81
fi
 
82
 
 
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
 
87
  done
 
88
done
 
89