#!/bin/sh set -u set -e PREFIX_DIR="" # declare the Bareos repository DOWNLOADSERVER=download.bareos.com URL="https://download.bareos.com/bareos/release/21/FreeBSD_13.0" # setup credentials # (required for download.bareos.com, subscription) BAREOS_USERNAME="username_at_example.com" BAREOS_PASSWORD="MySecretBareosPassword" if [ "${DOWNLOADSERVER}" = "download.bareos.com" ]; then scheme="$(echo "${URL}" | cut -d / -f 1)" rest="$(echo "${URL}" | cut -d / -f 3-)" URL="${scheme}//${BAREOS_USERNAME}:${BAREOS_PASSWORD}@${rest}" fi mkdir -p "${PREFIX_DIR}/usr/local/etc/pkg/repos" cat << EOT > "${PREFIX_DIR}/usr/local/etc/pkg/repos/bareos.conf" Bareos: { url: "${URL}", mirror_type: "none", signature_type: "none", enabled: yes } EOT chmod 0640 "${PREFIX_DIR}/usr/local/etc/pkg/repos/bareos.conf" echo "Repository ${URL} successfully added."