#!/bin/sh -efu

cat >"$1"/ovz/hooks.d/99apt <<EOF
#!/bin/sh

find /etc/apt/sources.list /etc/apt/sources.list.d -type -f -delete
> /etc/apt/sources.list

EOF

grep -hr '^[^#]*rpm' /etc/apt/sources.list /etc/apt/sources.list.d |
while read line; do
	printf 'echo "%s" >>/etc/apt/sources.list\n' "$line"
done >> "$1"/ovz/hooks.d/99apt

chmod +x "$1"/ovz/hooks.d/99apt
