#!/bin/bash
#
# BEGIN_COPYRIGHT
#
# Copyright (C) 2008-2019 SciDB, Inc.
# All Rights Reserved.
#
# SciDB is free software: you can redistribute it and/or modify
# it under the terms of the AFFERO GNU General Public License as published by
# the Free Software Foundation.
#
# SciDB is distributed "AS-IS" AND WITHOUT ANY WARRANTY OF ANY KIND,
# INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,
# NON-INFRINGEMENT, OR FITNESS FOR A PARTICULAR PURPOSE. See
# the AFFERO GNU General Public License for the complete license terms.
#
# You should have received a copy of the AFFERO GNU General Public License
# along with SciDB.  If not, see <http://www.gnu.org/licenses/agpl-3.0.html>
#
# END_COPYRIGHT
#
################################################################################
# This is the debian postinst script
#
# Note each call to a script is done through the Source function
# The produce script is looking for these calls to instruct it what scripts
# to copy into /opt/scidb/VERSION/script
################################################################################
function Source0: () { : ; }

function Source1: () { /opt/scidb/VERSION/script/$1 ; }

function Source2: () { /opt/scidb/VERSION/script/$1 ; }

function Source3: () { /opt/scidb/VERSION/script/$1 ; }

function Source4: () { /opt/scidb/VERSION/script/$1 ; }

function Source5: () { : ; }

# Rewrite in-place scidb.repo file, substituting for OS ubuntu14.04 or ubuntu12.04
if [ "`lsb_release -s -r`" = "12.04" ]; then
    sed -i 's/OS/ubuntu12.04/g' /etc/apt/sources.list.d/scidb.list
else
    sed -i 's/OS/ubuntu14.04/g' /etc/apt/sources.list.d/scidb.list
fi

Source0: config.ini

Source1: fixes.sh

Source2: create_scidb_user.sh

Source3: setup_postgresql.sh

Source4: run_scidb.sh

Source5: README.installer
