Parent: [6f5717] (diff)

Child: [2aedcd] (diff)

Download this file

recollinstall    75 lines (59 with data), 2.0 kB

#!/bin/sh

# Install recoll files. This has 2 modes, for installing the binaries or
# the personal configuration files

fatal()
{
    echo $*
    exit 1
}
usage()
{
    echo 'Usage (binaries): installrecoll <dir>, ie: installrecoll /usr/local'
    fatal 'Usage (personal config): installrecoll'
}

INSTALL=${INSTALL:=install}

if test $# = 1 ; then
   # Install commands and example config to target directory
   PREFIX=$1

   echo "Installing to $PREFIX"

   test -x qtgui/recoll || fatal "qtgui/recoll does not exist." \
        " You need to build first."

   test -d ${PREFIX}/bin || mkdir ${PREFIX}/bin || exit 1
   ${INSTALL} qtgui/recoll index/recollindex recollinstall $PREFIX/bin \
	      || exit 1
   test -d ${PREFIX}/share || mkdir ${PREFIX}/share
   test -d ${PREFIX}/share/examples || mkdir ${PREFIX}/share/examples
   test -d ${PREFIX}/share/examples/recoll || \
	mkdir ${PREFIX}/share/examples/recoll
   ${INSTALL} filters/rcl* ${PREFIX}/share/examples/recoll || exit 1
   ${INSTALL} sampleconf/recoll.conf sampleconf/mimeconf sampleconf/mimemap \
	      ${PREFIX}/share/examples/recoll || exit 1

   exit 0

else

  # Install configuration files to home directory
  PREFIX=${PREFIX:=/usr/local}

  me=`whoami`
  if test "$me" = root ; then
    fatal "Cowardly refusing to install personal config in root's" \
	    "home directory"
  fi
  if test ! -d ${PREFIX}/share/examples/recoll ; then
     fatal "Global install should be performed first"
  fi

  if test -d $HOME/.recoll ; then 
    cat <<EOF
     
     $HOME/.recoll already exists, no modification done.
     You should check for new filters or updated files in 
     ${PREFIX}/share/examples/recoll.
EOF
     exit 0
  fi

  mkdir $HOME/.recoll || exit 1
  cp ${PREFIX}/share/examples/recoll/* $HOME/.recoll
  chmod a+x $HOME/.recoll/rcl*
  chmod +w $HOME/.recoll/recoll.conf
  chmod +w $HOME/.recoll/mimeconf

  echo Copied configuration files and filters to $HOME/.recoll/
  echo You should now take a look at $HOME/.recoll/recoll.conf
  exit 0
fi