File kolab-pre-setup of Package kolab-scripts

#!/bin/bash
#
# Copyright 2013 Aeneas Jaissle <aj@ajaissle.de>
# Copyright 2013 Richard Bos
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 3 or, at your option, any later version
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin street, Fifth Floor, Boston, MA 02111-1301, USA.
#

PATH=/usr/bin:/bin

[[ ! $(id -u) ]] && {
  echo "This program must be run as root" >&2
  exit 1
}

[[ -f /etc/kolab/pre-setup.conf ]] && {
  . /etc/kolab/pre-setup.conf
  export INTERNET_CONNECTIVITY
}

echo "Preparing system for the Kolab Groupware installation with kolab-setup..."

# The prefix KPS_ is for Kolab_Pre_Setup
for ORDER in $(grep KPS_CHECK_ORDER: /usr/share/kolab/pre-setup.d/*sh | cut -d: -f3 | sort -nu); do
  for F in $(grep -l "KPS_CHECK_ORDER: $ORDER" /usr/share/kolab/pre-setup.d/*sh); do
    FILENAME=$(basename $F | sed 's/-/_/g;s/\.sh$//')
    eval MODE=\$$FILENAME
      [[ "$MODE" != "disable" ]] && {
        [[ -x $F ]] && $F
    }
  done
done

echo
echo "Check the output above, if it looks OK to you run 'kolab-setup' to "
echo "actually install Kolab on your system.  Otherwise run this script "
echo "once more, or correct the errors manually"

openSUSE Build Service is sponsored by