#!/bin/bash

## Copyright (C) 2012 - 2025 ENCRYPTED SUPPORT LLC <adrelanos@whonix.org>
## See the file COPYING for copying conditions.

set -x
set -e

true "INFO: Currently running script: $BASH_SOURCE $@"

dist_build_internal_run="true"

MYDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$MYDIR"

## XXX: hardcoded path
source "$HOME/derivative-maker/help-steps/pre"
source "$HOME/derivative-maker/help-steps/colors"
source "$HOME/derivative-maker/help-steps/variables"

## Debugging.
"$dist_source_help_steps_folder/signing-key-test" "$@"

for derivative_name_item in $derivative_name_list ; do
   derivative_repository_name="$derivative_name_item"
   export derivative_repository_name

   ## NOTE: Do not deprecate too early.
   ## Old:
   ## https://forums.whonix.org/t/one-time-popup-notification-of-whonix-15-deprecation-once-whonix-16-was-released/11720
   dm-reprepro-wrapper --export=changed export bookworm
   dm-reprepro-wrapper --export=changed export bookworm-proposed-updates
   dm-reprepro-wrapper --export=changed export bookworm-testers
   dm-reprepro-wrapper --export=changed export bookworm-developers

   dm-reprepro-wrapper --export=changed export trixie
   dm-reprepro-wrapper --export=changed export trixie-proposed-updates
   dm-reprepro-wrapper --export=changed export trixie-testers
   dm-reprepro-wrapper --export=changed export trixie-developers
done

true "${cyan}INFO: Done. Refreshed repository. OpenPGP Resigned and updated valid-until field. Do not forget to upload the refreshed repository. ${reset}"
