#!/usr/bin/env bash

USERNAME="cyteen"
PASSWORD="mlpfinsonik"
# DISTRIBUTION="unstable"
# DISTRIBUTION="excalibur"
DISTRIBUTION="ceres"
COMPONENT="main"
GITEA_URL="https://git2.ring-zero.co.uk/api/packages/${USERNAME}/debian/pool/${DISTRIBUTION}/${COMPONENT}/upload"
DEBS=(
	"wayland-protocols_1.36-0devuan1_all.deb"
	"hyprland-protocols_0.2_amd64.deb"
	"hyprcursor_0.1.7_amd64.deb"
	"hyprwayland-scanner_0.1.0_amd64.deb"
	"libhyprlang2_0.5.1-0devuan1_amd64.deb"
	"libhyprlang2-dbgsym_0.5.1-0devuan1_amd64.deb"
	"libhyprlang-dev_0.5.1-0devuan1_amd64.deb"
)

for DEB_FILE in "${DEBS}"; do
	curl --user ${USERNAME}:${PASSWORD} \
		--upload-file ./${DEB_FILE} \
		${GITEA_URL}
done

echo "See: automate/020_gitea_dpr.sh for sources.list creation."
echo "deb [signed-by=\${KEYRING}] https://${USERNAME}:${PASSWORD}@https://git2.ring-zero.co.uk/api/packages/${USERNAME}/debian ${DISTRIBUTION} ${COMPONENT}"

# show available packages
curl -s --url https://cyteen:mlpfinsonik@git2.ring-zero.co.uk/api/v1/packages/cyteen/ | jq '.[] | select(.type == "debian") | {type, name, version, html_url, created_at}'
