1#!/bin/bash
2#   BAREOS® - Backup Archiving REcovery Open Sourced
3#
4#   Copyright (C) 2017-2021 Bareos GmbH & Co. KG
5#
6#   This program is Free Software; you can redistribute it and/or
7#   modify it under the terms of version three of the GNU Affero General Public
8#   License as published by the Free Software Foundation and included
9#   in the file LICENSE.
10#
11#   This program is distributed in the hope that it will be useful, but
12#   WITHOUT ANY WARRANTY; without even the implied warranty of
13#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14#   Affero General Public License for more details.
15#
16#   You should have received a copy of the GNU Affero General Public License
17#   along with this program; if not, write to the Free Software
18#   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19#   02110-1301, USA.
20
21
22set -e
23set -u
24
25print_header()
26{
27   TEXT="$1"
28   printf "#\n"
29   printf "# %s\n" "$TEXT"
30   printf "#\n"
31}
32
33if [ "${COVERITY_SCAN:-}" ]; then
34   # run configure with default options
35   debian/rules override_dh_auto_configure
36   eval "$COVERITY_SCAN_BUILD"
37   echo "result: $?"
38   exit 0
39fi
40
41
42print_header "build Bareos core packages"
43# https://www.debian.org/doc/debian-policy/ch-source.html#s-debianrules-options
44export DEB_BUILD_OPTIONS="nocheck"
45fakeroot debian/rules binary
46
47print_header "create Debian package repository"
48cd ..
49dpkg-scanpackages . > Packages
50gzip --keep Packages
51ls -la Packages*
52printf 'deb file:%s /\n' $PWD > /tmp/bareos.list
53sudo cp /tmp/bareos.list /etc/apt/sources.list.d/bareos.list
54cd -
55
56PKGS="bareos bareos-database-$DB bareos-webui"
57print_header "install Bareos packages: $PKGS"
58sudo apt-get -qq update --allow-insecure-repositories || true
59sudo apt-get install -y --allow-unauthenticated $PKGS
60