cdist-contrib/type/__jitsi_meet/explorer/jicofo-authpassword

27 lines
1.0 KiB
Bash
Executable File

#!/bin/sh -eu
JICOFO_AUTHPASSWORD=""
# We need this to properly configure jicofo
# Default to reading debconf
DEBCONF_PASS_FILE="/var/cache/debconf/passwords.dat"
if [ -f "${DEBCONF_PASS_FILE}" ]; then
JICOFO_AUTHPASSWORD="$(grep -A1 'Template: jicofo/jicofo-authpassword' "${DEBCONF_PASS_FILE}" | tail -n 1 | cut -d ' ' -f 2-)"
fi
# Try jicofo.conf if necessary
JICOFO_CONF_FILE="/etc/jitsi/jicofo/jicofo.conf"
if [ -z "${JICOFO_AUTHPASSWORD}" ] && [ -f "${JICOFO_CONF_FILE}" ]; then
JICOFO_AUTHPASSWORD="$(grep -E '^[[:space:]]*password:' "${JICOFO_CONF_FILE}" | sed -E 's!^[^:]*:[[:space:]]*"(.*)"$!\1!')"
fi
# And fallback to config file if necessary
JICOFO_CONFIG_FILE="/etc/jitsi/jicofo/config"
if [ -z "${JICOFO_AUTHPASSWORD}" ] && [ -f "${JICOFO_CONFIG_FILE}" ]; then
JICOFO_AUTHPASSWORD="$(grep -E '^JICOFO_AUTH_PASSWORD=' "${JICOFO_CONFIG_FILE}" | cut -d '=' -f 2-)"
fi
# If we didn't find it, this is likely a new installation and we'll generate
# the password on the manifest
echo "${JICOFO_AUTHPASSWORD:-}"