#!/usr/bin/with-contenv bash

# set umask
UMASK_SET=${UMASK_SET:-022}
umask "$UMASK_SET"

# env settings
APP_DIR="/app/emby"
export LD_LIBRARY_PATH="${APP_DIR}"
export FONTCONFIG_PATH="${APP_DIR}"/etc/fonts
if [ -d "/lib/x86_64-linux-gnu" ]; then
	export LIBVA_DRIVERS_PATH="${APP_DIR}"/dri
fi
export SSL_CERT_FILE="${APP_DIR}"/etc/ssl/certs/ca-certificates.crt

exec \
	s6-setuidgid abc /app/emby/EmbyServer \
	-programdata /config \
	-ffdetect /app/emby/ffdetect \
	-ffmpeg /app/emby/ffmpeg \
	-ffprobe /app/emby/ffprobe \
	-restartexitcode 3
