2015-09-04 17:12:37 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
|
|
setup_ttrss()
|
|
|
|
|
{
|
2017-07-28 23:07:23 +02:00
|
|
|
if [ -z "$TTRSS_REPO_URL" ]; then
|
2022-09-25 10:39:53 +02:00
|
|
|
TTRSS_REPO_URL=https://git.tt-rss.org/fox/tt-rss.git/
|
2017-07-19 18:52:19 +12:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -z "$TTRSS_PATH" ]; then
|
|
|
|
|
TTRSS_PATH=/var/www/ttrss
|
|
|
|
|
fi
|
2017-07-28 23:07:23 +02:00
|
|
|
|
2018-12-16 14:44:25 +01:00
|
|
|
TTRSS_PATH_THEMES=${TTRSS_PATH}/themes.local
|
|
|
|
|
TTRSS_PATH_PLUGINS=${TTRSS_PATH}/plugins.local
|
|
|
|
|
|
2015-09-04 17:12:37 +02:00
|
|
|
# Add initial config.
|
|
|
|
|
cp ${TTRSS_PATH}/config.php-dist ${TTRSS_PATH}/config.php
|
|
|
|
|
|
2017-07-07 13:48:54 +02:00
|
|
|
# Check if TTRSS_URL is undefined, and if so, use localhost as default.
|
|
|
|
|
if [ -z ${TTRSS_URL} ]; then
|
|
|
|
|
TTRSS_URL=localhost
|
2017-07-07 13:31:48 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ "$TTRSS_WITH_SELFSIGNED_CERT" = "1" ]; then
|
|
|
|
|
# Make sure the TTRSS protocol is https now.
|
|
|
|
|
TTRSS_PROTO=https
|
2017-06-19 13:54:21 +00:00
|
|
|
fi
|
2015-09-04 17:12:37 +02:00
|
|
|
|
2017-07-07 13:31:48 +02:00
|
|
|
# If no protocol is specified, use http as default. Not secure, I know.
|
|
|
|
|
if [ -z ${TTRSS_PROTO} ]; then
|
|
|
|
|
TTRSS_PROTO=http
|
2017-07-28 23:13:29 +02:00
|
|
|
fi
|
2017-07-07 13:31:48 +02:00
|
|
|
|
2017-10-05 12:42:09 +02:00
|
|
|
# Add a leading colon (for the final URL) to the port.
|
2017-07-28 23:13:29 +02:00
|
|
|
if [ -n "$TTRSS_PORT" ]; then
|
|
|
|
|
TTRSS_PORT=:${TTRSS_PORT}
|
2017-07-07 13:31:48 +02:00
|
|
|
fi
|
2017-07-28 23:07:23 +02:00
|
|
|
|
2017-07-21 23:35:05 +12:00
|
|
|
# If we've been passed $TTRSS_SELF_URL as an env variable, then use that,
|
2017-07-28 22:26:41 +02:00
|
|
|
# otherwise use the URL we constructed above.
|
2017-07-21 23:44:37 +12:00
|
|
|
if [ -z "$TTRSS_SELF_URL" ]; then
|
2017-07-28 22:26:41 +02:00
|
|
|
# Construct the final URL TTRSS will use.
|
|
|
|
|
TTRSS_SELF_URL=${TTRSS_PROTO}://${TTRSS_URL}${TTRSS_PORT}/
|
2017-07-21 23:35:05 +12:00
|
|
|
fi
|
2017-07-07 13:31:48 +02:00
|
|
|
|
|
|
|
|
echo "Setup: URL is: $TTRSS_SELF_URL"
|
|
|
|
|
|
2019-07-25 23:25:45 +02:00
|
|
|
# By default we want to reset the theme to the default one.
|
|
|
|
|
if [ -z ${TTRSS_THEME_RESET} ]; then
|
|
|
|
|
TTRSS_THEME_RESET=1
|
|
|
|
|
fi
|
|
|
|
|
|
2017-07-07 13:31:48 +02:00
|
|
|
# Patch URL path.
|
2021-02-23 21:31:24 +01:00
|
|
|
echo "putenv('TTRSS_SELF_URL_PATH=$TTRSS_SELF_URL');" >> ${TTRSS_PATH}/config.php
|
2021-02-23 21:33:43 +01:00
|
|
|
|
2017-11-19 15:54:19 +01:00
|
|
|
# Check if single user mode is selected
|
|
|
|
|
if [ "$TTRSS_SINGLEUSER" = true ]; then
|
|
|
|
|
echo "Single User mode Selected"
|
2021-02-23 21:31:24 +01:00
|
|
|
echo "putenv('TTRSS_SINGLE_USER_MODE=1');" >> ${TTRSS_PATH}/config.php
|
2017-11-19 15:54:19 +01:00
|
|
|
fi
|
|
|
|
|
|
2017-07-28 22:12:19 +02:00
|
|
|
# Enable additional system plugins.
|
|
|
|
|
if [ -z ${TTRSS_PLUGINS} ]; then
|
|
|
|
|
|
2017-10-05 12:49:18 +02:00
|
|
|
TTRSS_PLUGINS=
|
2017-07-28 22:12:19 +02:00
|
|
|
|
|
|
|
|
# Only if SSL/TLS is enabled: af_zz_imgproxy (Loads insecure images via built-in proxy).
|
|
|
|
|
if [ "$TTRSS_PROTO" = "https" ]; then
|
2017-10-05 12:49:18 +02:00
|
|
|
TTRSS_PLUGINS=${TTRSS_PLUGINS}af_zz_imgproxy
|
2017-07-28 22:12:19 +02:00
|
|
|
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
|
2019-07-25 23:25:45 +02:00
|
|
|
|
|
|
|
|
# Export variables for sub shells.
|
|
|
|
|
export TTRSS_PATH
|
|
|
|
|
export TTRSS_PATH_PLUGINS
|
|
|
|
|
export TTRSS_THEME_RESET
|
2015-09-04 17:12:37 +02:00
|
|
|
}
|
|
|
|
|
|
2017-07-13 18:24:17 +02:00
|
|
|
setup_db()
|
|
|
|
|
{
|
|
|
|
|
echo "Setup: Database"
|
|
|
|
|
php -f /srv/ttrss-configure-db.php
|
|
|
|
|
php -f /srv/ttrss-configure-plugin-mobilize.php
|
|
|
|
|
}
|
|
|
|
|
|
2017-07-07 13:31:48 +02:00
|
|
|
setup_ttrss
|
2017-07-13 18:24:17 +02:00
|
|
|
setup_db
|
2015-09-04 17:12:37 +02:00
|
|
|
|
2017-07-14 11:28:15 +02:00
|
|
|
echo "Setup: Applying updates ..."
|
|
|
|
|
/srv/update-ttrss.sh --no-start
|
|
|
|
|
|
2015-09-04 17:12:37 +02:00
|
|
|
echo "Setup: Done"
|