#!/usr/share/ucs-test/runner bash
# shellcheck shell=bash
## desc: |
##  Update localhost component with non-standard prefix
##  1. setup local repository for component from custom prefix
##  2. check if the package is installable
## roles-not: [basesystem]
## tags: [basic]
## packages:
##  - apache2 | apache2-mpm-prefork
## exposure: dangerous

. pool.sh || exit 137

compname="test${RANDOM}"
repoprefix="univention-repository-$$-${RANDOM}"

setup_apache "${repoprefix}"

mkpdir "${_version_version}--component/${compname}" all "${ARCH}"  # 0 1 2 3
mkdeb "${pkgname}" 1 "${ARCH}" "${DIR}"
mkpkg "${DIR}" "${DIR}"

comp="repository/online/component/${compname}"
config_repo "${comp}=yes" "${comp}/prefix=${repoprefix}"

	set -e
	checkapt "http://localhost\\(:80\\)\\?/${repoprefix}/" "${DIRS[@]}"
	apt-get -qq update
	apt-get -qq install "${pkgname}"
	dpkg-query -W "${pkgname}" | grep -Fqx "${pkgname}	1"
	checkdeb "${pkgname}" 1
# vim:set ft=sh:
