Switch to unified view

a/src/recollinstall.in b/src/recollinstall.in
1
#!/bin/sh
1
#!/bin/sh
2
2
# Install recoll files.
3
# Install recoll files. This has 2 modes, for installing the binaries or
4
# the personal configuration files
5
3
6
fatal()
4
fatal()
7
{
5
{
8
    echo $*
6
    echo $*
9
    exit 1
7
    exit 1
10
}
8
}
11
usage()
9
usage()
12
{
10
{
13
    echo 'Usage (common files): recollinstall <dir>, ie: recollinstall /usr/local'
11
    fatal 'Usage: recollinstall <dir>, ie: recollinstall /usr/local'
14
    fatal 'Usage (personal config): recollinstall'
15
}
12
}
16
13
17
INSTALL=${INSTALL:=install}
14
INSTALL=${INSTALL:=install -c}
18
15
19
if test $# = 1 ; then
20
   # Install commands and example config to target directory
16
# Install commands and example config to target directory
21
   PREFIX=$1
17
PREFIX=$1
22
18
23
   echo "Installing to $PREFIX"
19
echo "Installing to $PREFIX"
24
20
25
   test -x qtgui/recoll || fatal "qtgui/recoll does not exist." \
21
test -x qtgui/recoll || fatal "qtgui/recoll does not exist." \
26
        " You need to build first (type 'make')."
22
     " You need to build first (type 'make')."
27
23
28
   for d in ${PREFIX} \
24
for d in ${PREFIX} \
29
        ${PREFIX}/bin \
25
        ${PREFIX}/bin \
30
        ${PREFIX}/share \
26
        ${PREFIX}/share \
31
        ${PREFIX}/share/recoll \
27
        ${PREFIX}/share/recoll \
32
        ${PREFIX}/share/recoll/examples \
28
        ${PREFIX}/share/recoll/examples \
33
        ${PREFIX}/share/recoll/filters \
29
        ${PREFIX}/share/recoll/filters \
34
        ${PREFIX}/share/recoll/images \
30
        ${PREFIX}/share/recoll/images \
35
        ${PREFIX}/share/recoll/translations
31
        ${PREFIX}/share/recoll/translations
36
   do
32
do
37
     test -d $d || mkdir $d || exit 1
33
  test -d $d || mkdir $d || exit 1
38
   done
34
done
39
35
36
${INSTALL} qtgui/recoll index/recollindex $PREFIX/bin || exit 1
40
37
41
   ${INSTALL} qtgui/recoll index/recollindex recollinstall $PREFIX/bin \
38
${INSTALL} filters/rcl* ${PREFIX}/share/recoll/filters/ || exit 1
42
        || exit 1
39
chmod a+x ${PREFIX}/share/recoll/filters/rcl* || exit 1
40
# Clean up possible old filters in examples
41
rm -f ${PREFIX}/share/recoll/examples/rcl*
43
42
44
   ${INSTALL} filters/rcl* ${PREFIX}/share/recoll/filters/ || exit 1
45
   chmod a+x ${PREFIX}/share/recoll/filters/rcl* || exit 1
46
   # Clean up possible old filters in examples
47
   rm -f ${PREFIX}/share/recoll/examples/rcl*
48
49
   ${INSTALL} sampleconf/recoll.conf sampleconf/mimeconf sampleconf/mimemap \
43
${INSTALL} sampleconf/recoll.conf sampleconf/mimeconf sampleconf/mimemap \
50
            ${PREFIX}/share/recoll/examples/ || exit 1
44
            ${PREFIX}/share/recoll/examples/ || exit 1
51
45
52
53
   ${INSTALL} qtgui/mtpics/*.png ${PREFIX}/share/recoll/images || exit 1
46
${INSTALL} qtgui/mtpics/*.png ${PREFIX}/share/recoll/images || exit 1
54
   ${INSTALL} qtgui/recoll*.qm ${PREFIX}/share/recoll/translations || exit 1
47
${INSTALL} qtgui/recoll*.qm ${PREFIX}/share/recoll/translations || exit 1
55
56
   exit 0
57
58
else
59
60
  # Install configuration files to home directory
61
  PREFIX=${PREFIX:=@prefix@}
62
63
  me=`whoami`
64
  if test "$me" = root ; then
65
    fatal "Can't install personal config in root's home directory"
66
  fi
67
  if test ! -d ${PREFIX}/share/recoll/examples ; then
68
     fatal "Global install should be performed first"
69
  fi
70
71
  if test -d $HOME/.recoll ; then 
72
    cat <<EOF
73
     
74
     $HOME/.recoll already exists, no modification done.
75
     You should check for new filters or updated files in 
76
     ${PREFIX}/share/recoll/examples.
77
EOF
78
     exit 0
79
  fi
80
81
  mkdir $HOME/.recoll || exit 1
82
  cp ${PREFIX}/share/recoll/examples/* $HOME/.recoll
83
  chmod +w $HOME/.recoll/recoll.conf
84
  chmod +w $HOME/.recoll/mimeconf
85
86
  echo Copied configuration files and filters to $HOME/.recoll/
87
  echo You should now take a look at $HOME/.recoll/recoll.conf
88
  exit 0
89
fi