#!/bin/sh set -u set -e PREFIX_DIR="" # declare the Bareos repository DOWNLOADSERVER="download.bareos.org" URL="https://download.bareos.org/experimental/PR-2004/xUbuntu_20.04" # setup credentials for apt auth # (required for download.bareos.com, subscription) BAREOS_USERNAME="username_at_example.com" BAREOS_PASSWORD="MySecretBareosPassword" if [ "${DOWNLOADSERVER}" = "download.bareos.com" ] && [ -d "${PREFIX_DIR}/etc/apt/auth.conf.d/" ]; then cat <"${PREFIX_DIR}/etc/apt/auth.conf.d/download_bareos_com.conf" machine download.bareos.com login ${BAREOS_USERNAME} password ${BAREOS_PASSWORD} EOT chmod 0600 "${PREFIX_DIR}/etc/apt/auth.conf.d/download_bareos_com.conf" fi # add the Bareos repository cat <"${PREFIX_DIR}/etc/apt/sources.list.d/bareos.sources" Types: deb deb-src URIs: ${URL} Suites: / Architectures: amd64 Signed-By: ${PREFIX_DIR}/etc/apt/keyrings/bareos-experimental.gpg EOT # add package key mkdir -p "${PREFIX_DIR}/etc/apt/keyrings/" # download key via # wget -O /etc/apt/keyrings/bareos-experimental.gpg ${URL}/bareos-keyring.gpg # or cat << EOT | gpg --dearmor -o "${PREFIX_DIR}/etc/apt/keyrings/bareos-experimental.gpg" -----BEGIN PGP PUBLIC KEY BLOCK----- mQINBF23EK4BEAC1FADpF6aaC93bxouVT6/BuXJajjtLkHNKfY26BYuvpwgLmVwp M8vBuQWEPxxP6y2wXffv5bO/0Y1tS7tCW4i7duKz6W6as7/N13P/Mah8KOS0Zles VM94fKXX8um7okqY9EwqgWVyHetW0PVpMKCsguMezv0IUmGAi/XX/GgJBeDYWvTh S8DXtMhqWMXWv9yptJJsFQgdS0GVb8fcHG+Vl5GWmb+p8+R5x2JjLrP2OIoY8caD boueBiUUeYnlPQqBa7flZSlBslSbk8qwnr75r/fX0/ihnFfLZol348AOCjPeWEYM H3xQvuuyXsOg7dJ3dX4pE/MwUUOSlWyAACvCDYLQ+Xlvnt1j1dmbnGiBYRfn9cMZ YEDZVSey7LwUwkXi9yXA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V eIeL6THtJhpm8OGacLSN/G4bDjxFpmlUxPH7nwL6zFCxPBoQubhzxgIIFSfKcB/E iigZf6MxTddPMRaD36FLlataihx7mLQ= =GxhN -----END PGP PUBLIC KEY BLOCK----- EOT echo "Repository ${URL} successfully added."