2018-04-26 12:00:14 +02:00
|
|
|
|
#!/bin/sh
|
|
|
|
|
|
2022-11-30 20:45:40 +01:00
|
|
|
|
ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime
|
|
|
|
|
echo "$TZ" >/etc/timezone
|
2018-04-26 12:00:14 +02:00
|
|
|
|
|
2021-01-11 22:36:50 +01:00
|
|
|
|
find /etc/php*/ -type f -name php.ini -exec sed -r -i "\\#^;?date.timezone#s#^.*#date.timezone = $TZ#" {} \;
|
|
|
|
|
find /etc/php*/ -type f -name php.ini -exec sed -r -i "\\#^;?post_max_size#s#^.*#post_max_size = 32M#" {} \;
|
|
|
|
|
find /etc/php*/ -type f -name php.ini -exec sed -r -i "\\#^;?upload_max_filesize#s#^.*#upload_max_filesize = 32M#" {} \;
|
2019-01-16 22:19:40 +01:00
|
|
|
|
|
2021-01-07 23:32:39 +01:00
|
|
|
|
if [ -n "$LISTEN" ]; then
|
2021-01-11 22:36:50 +01:00
|
|
|
|
find /etc/apache2/ -type f -name FreshRSS.Apache.conf -exec sed -r -i "\\#^Listen#s#^.*#Listen $LISTEN#" {} \;
|
2021-01-07 23:32:39 +01:00
|
|
|
|
fi
|
|
|
|
|
|
2023-07-30 12:59:18 +02:00
|
|
|
|
if [ -n "$TRUSTED_PROXY" ]; then
|
2023-10-25 15:57:27 +02:00
|
|
|
|
if [ "$TRUSTED_PROXY" = "0" ]; then
|
2023-10-25 16:23:03 +02:00
|
|
|
|
# Disable RemoteIPHeader and RemoteIPInternalProxy
|
2023-07-30 12:59:18 +02:00
|
|
|
|
find /etc/apache2/ -type f -name FreshRSS.Apache.conf -exec sed -r -i "/^\s*RemoteIP.*$/s/^/#/" {} \;
|
|
|
|
|
else
|
2023-10-25 16:23:03 +02:00
|
|
|
|
# Custom list for RemoteIPInternalProxy
|
|
|
|
|
find /etc/apache2/ -type f -name FreshRSS.Apache.conf -exec sed -r -i "\\#^\s*RemoteIPInternalProxy#s#^.*#\tRemoteIPInternalProxy $TRUSTED_PROXY#" {} \;
|
2023-07-30 12:59:18 +02:00
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
2023-06-13 16:28:51 +02:00
|
|
|
|
if [ -n "$OIDC_ENABLED" ] && [ "$OIDC_ENABLED" -ne 0 ]; then
|
2023-10-28 13:40:22 +02:00
|
|
|
|
# Debian
|
|
|
|
|
(which a2enmod >/dev/null && a2enmod -q auth_openidc) ||
|
|
|
|
|
# Alpine
|
|
|
|
|
(mv /etc/apache2/conf.d/mod-auth-openidc.conf.bak /etc/apache2/conf.d/mod-auth-openidc.conf && echo 'Enabling module auth_openidc.')
|
|
|
|
|
if [ -n "$OIDC_SCOPES" ]; then
|
|
|
|
|
# Compatibility with : as separator instead of space
|
2023-10-27 15:26:39 +02:00
|
|
|
|
OIDC_SCOPES=$(echo "$OIDC_SCOPES" | tr ':' ' ')
|
|
|
|
|
export OIDC_SCOPES
|
|
|
|
|
fi
|
2023-06-13 16:28:51 +02:00
|
|
|
|
fi
|
|
|
|
|
|
2018-04-26 12:00:14 +02:00
|
|
|
|
if [ -n "$CRON_MIN" ]; then
|
2023-11-21 16:33:19 +01:00
|
|
|
|
awk -v RS='\0' '!/^(FRESHRSS_INSTALL|FRESHRSS_USER|HOME|PATH|PWD|SHLVL|TERM|_)=/ {gsub("\047", "\047\\\047\047"); print "export \047" $0 "\047"}' /proc/self/environ >/var/www/FreshRSS/Docker/env.txt
|
2021-10-24 19:39:35 +02:00
|
|
|
|
sed </etc/crontab.freshrss.default \
|
2021-10-24 17:25:03 +02:00
|
|
|
|
-r "s#^[^ ]+ #$CRON_MIN #" | crontab -
|
2018-04-26 12:00:14 +02:00
|
|
|
|
fi
|
|
|
|
|
|
2023-02-06 15:42:53 +01:00
|
|
|
|
./cli/access-permissions.sh
|
|
|
|
|
|
|
|
|
|
php -f ./cli/prepare.php >/dev/null
|
|
|
|
|
|
2021-01-11 22:36:50 +01:00
|
|
|
|
if [ -n "$FRESHRSS_INSTALL" ]; then
|
|
|
|
|
# shellcheck disable=SC2046
|
|
|
|
|
php -f ./cli/do-install.php -- \
|
2022-06-19 20:03:34 +02:00
|
|
|
|
$(echo "$FRESHRSS_INSTALL" | sed -r 's/[\r\n]+/\n/g' | paste -s -)
|
2021-01-11 22:36:50 +01:00
|
|
|
|
EXITCODE=$?
|
|
|
|
|
|
|
|
|
|
if [ $EXITCODE -eq 3 ]; then
|
|
|
|
|
echo 'ℹ️ FreshRSS already installed; no change performed.'
|
|
|
|
|
elif [ $EXITCODE -eq 0 ]; then
|
|
|
|
|
echo '✅ FreshRSS successfully installed.'
|
|
|
|
|
else
|
|
|
|
|
echo '❌ FreshRSS error during installation!'
|
|
|
|
|
exit $EXITCODE
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -n "$FRESHRSS_USER" ]; then
|
|
|
|
|
# shellcheck disable=SC2046
|
|
|
|
|
php -f ./cli/create-user.php -- \
|
2022-06-19 20:03:34 +02:00
|
|
|
|
$(echo "$FRESHRSS_USER" | sed -r 's/[\r\n]+/\n/g' | paste -s -)
|
2021-01-11 22:36:50 +01:00
|
|
|
|
EXITCODE=$?
|
|
|
|
|
|
|
|
|
|
if [ $EXITCODE -eq 3 ]; then
|
|
|
|
|
echo 'ℹ️ FreshRSS user already exists; no change performed.'
|
|
|
|
|
elif [ $EXITCODE -eq 0 ]; then
|
|
|
|
|
echo '✅ FreshRSS user successfully created.'
|
|
|
|
|
./cli/list-users.php | xargs -n1 ./cli/actualize-user.php --user
|
|
|
|
|
else
|
|
|
|
|
echo '❌ FreshRSS error during the creation of a user!'
|
|
|
|
|
exit $EXITCODE
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
2023-02-06 15:42:53 +01:00
|
|
|
|
./cli/access-permissions.sh
|
2021-01-11 22:36:50 +01:00
|
|
|
|
|
2018-04-26 12:00:14 +02:00
|
|
|
|
exec "$@"
|