#!/bin/bash

# Check if reprepro is installed
if ! command -v reprepro >/dev/null 2>&1; then
  echo "reprepro not found. Please install reprepro and try again."
  exit 1
fi

# Check if conf/distributions file exists
if [ ! -f "conf/distributions" ]; then
  echo "conf/distributions file not found. Make sure you are in the root of the repository directory."
  exit 1
fi

# Extract codenames from the conf/distributions file
codenames=$(grep -E '^Codename:' conf/distributions | awk '{print $2}')

# List all packages for each codename
for codename in $codenames; do
  echo "Listing packages for codename: $codename"
  reprepro -b . list $codename
  echo
done

