#!/usr/bin/env bash

cd "${0%/*}"
cd incoming
version=$1

set -eux
wget \
	https://kernel.ubuntu.com/~kernel-ppa/mainline/v${version}/ \
		--execute robots=off --recursive --timestamping --continue --no-parent --accept-regex '(generic.*amd64.deb|CHECKSUMS|all.deb)'  --cut-dirs 4 -nH

gpg --verify CHECKSUMS.gpg CHECKSUMS
fgrep -f <(ls *.deb ) CHECKSUMS | shasum -cs
rm -f CHECKSUMS CHECKSUMS.gpg index.html

cd ..
reprepro includedeb stable incoming/*_${version}-*.deb
