#!/bin/sh set -e # This script waits for the Gitea admin token to be created, # exports it as an environment variable, and then executes the main container command. TOKEN_FILE="/gitea-data/autogits_obs_staging_bot.token" echo "OBS Staging Bot: Waiting for Gitea autogits_obs_staging_bot token at $TOKEN_FILE..." while [ ! -s "$TOKEN_FILE" ]; do sleep 2 done export GITEA_TOKEN=$(cat "$TOKEN_FILE" | tr -d '\n\r ') echo "OBS Staging Bot: GITEA_TOKEN exported." # Execute the bot as the current user (root), using 'env' to pass required variables. echo "OBS Staging Bot: Executing bot..." exe=$(which obs-staging-bot) exe=${exe:-/usr/local/bin/obs-staging-bot} package=$(rpm -qa | grep autogits-obs-staging-bot) || : echo "!!!!!!!!!!!!!!!! using binary $exe; installed package: $package" which strings > /dev/null 2>&1 && strings "$exe" | grep -A 2 vcs.revision= | head -4 || : exec $exe "$@"