#!/bin/sh set -e # Optionally configure DNS servers at runtime if provided if [ -n "$DNS_SERVERS" ]; then { for s in $DNS_SERVERS; do echo "nameserver $s" done } > /etc/resolv.conf 2>/dev/null || true fi # Optionally configure proxy for outbound requests if [ -n "$YT_PROXY" ]; then export HTTPS_PROXY="$YT_PROXY" export HTTP_PROXY="$YT_PROXY" fi # Ensure output directory exists and is writable OUTDIR="${YT_AUDIO_DIR:-/tmp/ytdl}" mkdir -p "$OUTDIR" 2>/dev/null || true chmod 777 "$OUTDIR" 2>/dev/null || true exec "$@"