#!/bin/sh setup_ttrss() { if [ -z "$TTRSS_REPO_URL" ]; then TTRSS_REPO_URL=https://git.tt-rss.org/fox/tt-rss.git/ fi if [ -z "$TTRSS_PATH" ]; then TTRSS_PATH=/var/www/ttrss fi TTRSS_PATH_THEMES=${TTRSS_PATH}/themes.local TTRSS_PATH_PLUGINS=${TTRSS_PATH}/plugins.local # Add initial config. cp ${TTRSS_PATH}/config.php-dist ${TTRSS_PATH}/config.php # Check if TTRSS_URL is undefined, and if so, use localhost as default. if [ -z ${TTRSS_URL} ]; then TTRSS_URL=localhost fi if [ "$TTRSS_WITH_SELFSIGNED_CERT" = "1" ]; then # Make sure the TTRSS protocol is https now. TTRSS_PROTO=https fi # If no protocol is specified, use http as default. Not secure, I know. if [ -z ${TTRSS_PROTO} ]; then TTRSS_PROTO=http fi # Add a leading colon (for the final URL) to the port. if [ -n "$TTRSS_PORT" ]; then TTRSS_PORT=:${TTRSS_PORT} fi # If we've been passed $TTRSS_SELF_URL as an env variable, then use that, # otherwise use the URL we constructed above. if [ -z "$TTRSS_SELF_URL" ]; then # Construct the final URL TTRSS will use. TTRSS_SELF_URL=${TTRSS_PROTO}://${TTRSS_URL}${TTRSS_PORT}/ fi echo "Setup: URL is: $TTRSS_SELF_URL" # By default we want to reset the theme to the default one. if [ -z ${TTRSS_THEME_RESET} ]; then TTRSS_THEME_RESET=1 fi # Patch URL path. echo "putenv('TTRSS_SELF_URL_PATH=$TTRSS_SELF_URL');" >> ${TTRSS_PATH}/config.php # Check if single user mode is selected if [ "$TTRSS_SINGLEUSER" = true ]; then echo "Single User mode Selected" echo "putenv('TTRSS_SINGLE_USER_MODE=1');" >> ${TTRSS_PATH}/config.php fi # Enable additional system plugins. if [ -z ${TTRSS_PLUGINS} ]; then TTRSS_PLUGINS= # Only if SSL/TLS is enabled: af_zz_imgproxy (Loads insecure images via built-in proxy). if [ "$TTRSS_PROTO" = "https" ]; then TTRSS_PLUGINS=${TTRSS_PLUGINS}af_zz_imgproxy fi fi echo "Setup: Additional plugins: $TTRSS_PLUGINS" sed -i -e "s/.*define('PLUGINS'.*/define('PLUGINS', '$TTRSS_PLUGINS, auth_internal, note, updater');/g" ${TTRSS_PATH}/config.php # Export variables for sub shells. export TTRSS_PATH export TTRSS_PATH_PLUGINS export TTRSS_THEME_RESET } setup_db() { echo "Setup: Database" php -f /srv/ttrss-configure-db.php php -f /srv/ttrss-configure-plugin-mobilize.php } setup_ttrss setup_db echo "Setup: Applying updates ..." /srv/update-ttrss.sh --no-start echo "Setup: Done"