|
a/src/recollinstall |
|
b/src/recollinstall |
1 |
#!/bin/sh
|
1 |
#!/bin/sh
|
|
|
2 |
|
|
|
3 |
# Install recoll files. This has 2 modes, for installing the binaries or
|
|
|
4 |
# the personal configuration files
|
2 |
|
5 |
|
3 |
fatal()
|
6 |
fatal()
|
4 |
{
|
7 |
{
|
5 |
echo $*
|
8 |
echo $*
|
6 |
exit 1
|
9 |
exit 1
|
7 |
}
|
10 |
}
|
8 |
usage()
|
11 |
usage()
|
9 |
{
|
12 |
{
|
10 |
fatal 'installrecoll <targetdir>, ie: installrecoll /usr/local'
|
13 |
echo 'Usage (binaries): installrecoll <dir>, ie: installrecoll /usr/local'
|
11 |
}
|
14 |
fatal 'Usage (personal config): installrecoll'
|
12 |
install()
|
|
|
13 |
{
|
|
|
14 |
src=$1
|
|
|
15 |
dst=$2
|
|
|
16 |
if test -d $dst; then dst=$2/`basename $1`;fi
|
|
|
17 |
if test -f $dst; then
|
|
|
18 |
bak=$dst.prev
|
|
|
19 |
#echo "Preserving $dst as $bak"
|
|
|
20 |
(install $dst $bak)
|
|
|
21 |
fi
|
|
|
22 |
echo $src '->' $dst
|
|
|
23 |
cp $src $dst
|
|
|
24 |
}
|
15 |
}
|
25 |
|
16 |
|
26 |
if test $# != 1 ; then
|
17 |
INSTALL=${INSTALL:=install}
|
27 |
usage
|
|
|
28 |
fi
|
|
|
29 |
targetdir=$1
|
|
|
30 |
|
18 |
|
31 |
echo "Installing binaries to $targetdir"
|
19 |
if test $# = 1 ; then
|
|
|
20 |
# Install commands and example config to target directory
|
|
|
21 |
PREFIX=$1
|
32 |
|
22 |
|
33 |
test -x qtgui/recoll || fatal "qtgui/recoll does not exist." \
|
23 |
echo "Installing to $PREFIX"
|
34 |
" You need to build first."
|
|
|
35 |
|
24 |
|
36 |
if test -d $targetdir/bin -a -w $targetdir/bin ; then
|
25 |
test -x qtgui/recoll || fatal "qtgui/recoll does not exist." \
|
37 |
install qtgui/recoll $targetdir/bin/recoll
|
26 |
" You need to build first."
|
38 |
install index/recollindex $targetdir/bin/recollindex
|
27 |
|
|
|
28 |
test -d ${PREFIX}/bin || mkdir ${PREFIX}/bin || exit 1
|
|
|
29 |
${INSTALL} qtgui/recoll index/recollindex recollinstall $PREFIX/bin \
|
|
|
30 |
|| exit 1
|
|
|
31 |
test -d ${PREFIX}/share || mkdir ${PREFIX}/share
|
|
|
32 |
test -d ${PREFIX}/share/examples || mkdir ${PREFIX}/share/examples
|
|
|
33 |
test -d ${PREFIX}/share/examples/recoll || \
|
|
|
34 |
mkdir ${PREFIX}/share/examples/recoll
|
|
|
35 |
${INSTALL} filters/rcl* ${PREFIX}/share/examples/recoll || exit 1
|
|
|
36 |
${INSTALL} sampleconf/recoll.conf sampleconf/mimeconf sampleconf/mimemap \
|
|
|
37 |
${PREFIX}/share/examples/recoll || exit 1
|
|
|
38 |
|
|
|
39 |
exit 0
|
|
|
40 |
|
39 |
else
|
41 |
else
|
40 |
echo "Not installing binary executables to $targetdir/bin which is not writable"
|
|
|
41 |
echo "Going on with personal install"
|
|
|
42 |
fi
|
|
|
43 |
|
42 |
|
|
|
43 |
# Install configuration files to home directory
|
|
|
44 |
PREFIX=${PREFIX:=/usr/local}
|
|
|
45 |
|
44 |
me=`whoami`
|
46 |
me=`whoami`
|
45 |
if test "$me" != root ; then
|
47 |
if test "$me" = root ; then
|
|
|
48 |
fatal "Cowardly refusing to install personal config in root's" \
|
|
|
49 |
"home directory"
|
|
|
50 |
fi
|
|
|
51 |
if test ! -d ${PREFIX}/share/examples/recoll ; then
|
|
|
52 |
fatal "Global install should be performed first"
|
|
|
53 |
fi
|
|
|
54 |
|
46 |
if test -d $HOME/.recoll ; then
|
55 |
if test -d $HOME/.recoll ; then
|
47 |
cat <<EOF
|
56 |
cat <<EOF
|
48 |
|
57 |
|
49 |
$HOME/.recoll already exists, no modification done.
|
58 |
$HOME/.recoll already exists, no modification done.
|
50 |
You should check for new filters in the filters/ directory, and
|
59 |
You should check for new filters or updated files in
|
51 |
for modifications to files in the sampleconf/ directory (ie new
|
60 |
${PREFIX}/share/examples/recoll.
|
52 |
mime types in mimemap).
|
|
|
53 |
EOF
|
61 |
EOF
|
54 |
exit 0
|
62 |
exit 0
|
55 |
fi
|
63 |
fi
|
56 |
|
64 |
|
57 |
mkdir $HOME/.recoll || exit 1
|
65 |
mkdir $HOME/.recoll || exit 1
|
58 |
cp filters/rcl* $HOME/.recoll
|
66 |
cp ${PREFIX}/share/examples/recoll/* $HOME/.recoll
|
59 |
chmod a+x $HOME/.recoll/rcl*
|
67 |
chmod a+x $HOME/.recoll/rcl*
|
60 |
cd sampleconf
|
|
|
61 |
cp mimeconf mimemap recoll.conf $HOME/.recoll
|
|
|
62 |
chmod +w $HOME/.recoll/recoll.conf
|
68 |
chmod +w $HOME/.recoll/recoll.conf
|
63 |
chmod +w $HOME/.recoll/mimeconf
|
69 |
chmod +w $HOME/.recoll/mimeconf
|
64 |
|
70 |
|
|
|
71 |
echo Copied configuration files and filters to $HOME/.recoll/
|
65 |
echo You should now take a look at $HOME/.recoll/recoll.conf
|
72 |
echo You should now take a look at $HOME/.recoll/recoll.conf
|
66 |
|
73 |
exit 0
|
67 |
else
|
|
|
68 |
|
|
|
69 |
echo "Not installing personal configuration for root user"
|
|
|
70 |
|
|
|
71 |
fi
|
74 |
fi
|
72 |
|
|
|