#!/bin/sh

set -exu

for f in /etc/apt/sources.list /etc/apt/sources.list.d/*; do
	[ -e "$f" ] || continue
	# do not add entries from deb.debian.org or otherwise, tests will fail
	# if mirror pushes happen while the script is running
	# we append instead of overwriting
	echo >> "$1/$f"
	grep -v deb.debian.org/debian "$f" >> "$1/$f" || :
done
for f in /etc/apt/preferences.d/*; do
	[ -e "$f" ] || continue
	# we append instead of overwriting
	echo >> "$1/$f"
	cat "$f" >> "$1/$f"
done
