Fix HAOS compatibility and update documentation

This commit is contained in:
2026-04-04 00:37:10 +02:00
parent b23d0b4072
commit c4ddb25467
12 changed files with 293 additions and 111 deletions

View File

@@ -1,27 +1,46 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
if [[ -n "${ACCOUNT_TOKEN}" ]] && [[ -n "${MACHINE_NAME}" ]]; then
TOKEN_AND_NAME="--account-token ${ACCOUNT_TOKEN} --machine-name ${MACHINE_NAME}"
else
echo '
***************************************************************************
***************************************************************************
**** ****
**** ****
**** On first run, both the ACCOUNT_TOKEN and the MACHINE_NAME ****
**** env vars are required. Please set them and recreate the container ****
**** unless the instance was previously added to online account. ****
**** ****
**** ****
***************************************************************************
***************************************************************************
'
declare -a args
# Network: bind to all interfaces, allow all connections
args+=(--http-addresses "0.0.0.0:7396")
args+=(--allow "0/0")
# FAH account credentials
if [[ -n "${FAH_USER}" ]]; then
args+=(--user "${FAH_USER}")
fi
if [[ -n "${TEAM}" ]]; then
args+=(--team "${TEAM}")
fi
if [[ -n "${PASSKEY}" ]]; then
args+=(--passkey "${PASSKEY}")
fi
# Power level (light, medium, full)
if [[ -n "${POWER}" ]]; then
args+=(--power "${POWER}")
fi
# Online account token (new FAH 8 account system)
if [[ -n "${ACCOUNT_TOKEN}" ]]; then
args+=(--account-token "${ACCOUNT_TOKEN}")
if [[ -n "${MACHINE_NAME}" ]]; then
args+=(--machine-name "${MACHINE_NAME}")
fi
fi
if [[ -z "${FAH_USER}" ]] && [[ -z "${ACCOUNT_TOKEN}" ]]; then
echo "INFO: No FAH_USER or ACCOUNT_TOKEN set — folding anonymously."
fi
# Run from /config so fah-client stores its data there
mkdir -p /config
cd /config || exit 1
exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 7396" \
cd /config s6-setuidgid abc /app/fah-client \
--http-addresses 0.0.0.0:7396 --allow 0/0 ${TOKEN_AND_NAME} \
${CLI_ARGS}
/app/fah-client "${args[@]}" ${CLI_ARGS}