#!/bin/bash

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

## AI-Assisted

## Resolve target_home via getent rather than '/home/<user>/' to
## avoid baking the OS's home-dir convention into this script.

set -o errexit
set -o nounset
set -o pipefail
set -o errtrace
shopt -s inherit_errexit
shopt -s shift_verbose

target_user=builder

cd -- "$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")")/../.."

timeout 1200 \
   ./help-steps/run-as-user --chown "${PWD}" -- \
      "${target_user}" \
      ./derivative-maker \
         --dry-run true \
         --unsupported-os true \
         --allow-uncommitted true \
         --allow-untagged true \
         --flavor source \
         --target source
