#!/usr/share/ucs-test/runner bash
# shellcheck shell=bash
## desc: |
##  Update localhost repository with repository/online/prefix unset
##  1. setup local repository with 1 packet in maintained
##  2. check if that package is installable
## roles-not: [basesystem]
## tags: [basic]
## packages:
##  - apache2 | apache2-mpm-prefork
## exposure: dangerous

RETVAL=110 # Test fehlgeschlagen
. pool.sh || exit 137

setup_apache "${repoprefix}"

# shellcheck disable=SC2046
mkpdir $(allpatchlevels "${_version_version}-${_version_patchlevel:?}") maintained "${ARCH}"
mkdeb "${pkgname}" 1 "${ARCH}" "${DIR_POOL}"
mkpkg "${DIR}" "${DIR_POOL}"

config_repo /

(
	set -e
	checkapt "http://localhost\\(:80\\)\\?/${repoprefix}/" "${DIR}"
	apt-get -qq update
	apt-get -qq install "${pkgname}"
	dpkg-query -W "${pkgname}" | grep -Fqx "${pkgname}	1"
	checkdeb "${pkgname}" 1
)
# shellcheck disable=SC2181
[ $? -eq 0 ] && RETVAL=100 # Test bestanden (Keine Fehler)
dpkg -P --force-all "${pkgname}" >&3 2>&3

exit ${RETVAL}
# vim:set ft=sh:
