entrypoint.sh 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/bin/sh
  2. ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime
  3. echo "$TZ" >/etc/timezone
  4. find /etc/php*/ -type f -name php.ini -exec sed -r -i "\\#^;?date.timezone#s#^.*#date.timezone = $TZ#" {} \;
  5. find /etc/php*/ -type f -name php.ini -exec sed -r -i "\\#^;?post_max_size#s#^.*#post_max_size = 32M#" {} \;
  6. find /etc/php*/ -type f -name php.ini -exec sed -r -i "\\#^;?upload_max_filesize#s#^.*#upload_max_filesize = 32M#" {} \;
  7. if [ -n "$LISTEN" ]; then
  8. find /etc/apache2/ -type f -name FreshRSS.Apache.conf -exec sed -r -i "\\#^Listen#s#^.*#Listen $LISTEN#" {} \;
  9. fi
  10. if [ -n "$TRUSTED_PROXY" ]; then
  11. if [ "$TRUSTED_PROXY" -eq 0 ]; then
  12. # Disable RemoteIPHeader and RemoteIPTrustedProxy
  13. find /etc/apache2/ -type f -name FreshRSS.Apache.conf -exec sed -r -i "/^\s*RemoteIP.*$/s/^/#/" {} \;
  14. else
  15. # Custom list for RemoteIPTrustedProxy
  16. find /etc/apache2/ -type f -name FreshRSS.Apache.conf -exec sed -r -i "\\#^\s*RemoteIPTrustedProxy#s#^.*#\tRemoteIPTrustedProxy $TRUSTED_PROXY#" {} \;
  17. fi
  18. fi
  19. if [ -n "$OIDC_ENABLED" ] && [ "$OIDC_ENABLED" -ne 0 ]; then
  20. a2enmod -q auth_openidc
  21. fi
  22. if [ -n "$CRON_MIN" ]; then
  23. (
  24. echo "export TZ=$TZ"
  25. echo "export COPY_LOG_TO_SYSLOG=$COPY_LOG_TO_SYSLOG"
  26. echo "export COPY_SYSLOG_TO_STDERR=$COPY_SYSLOG_TO_STDERR"
  27. echo "export FRESHRSS_ENV=$FRESHRSS_ENV"
  28. echo "export DATA_PATH=$DATA_PATH"
  29. ) >/var/www/FreshRSS/Docker/env.txt
  30. sed </etc/crontab.freshrss.default \
  31. -r "s#^[^ ]+ #$CRON_MIN #" | crontab -
  32. fi
  33. ./cli/access-permissions.sh
  34. php -f ./cli/prepare.php >/dev/null
  35. if [ -n "$FRESHRSS_INSTALL" ]; then
  36. # shellcheck disable=SC2046
  37. php -f ./cli/do-install.php -- \
  38. $(echo "$FRESHRSS_INSTALL" | sed -r 's/[\r\n]+/\n/g' | paste -s -)
  39. EXITCODE=$?
  40. if [ $EXITCODE -eq 3 ]; then
  41. echo 'ℹ️ FreshRSS already installed; no change performed.'
  42. elif [ $EXITCODE -eq 0 ]; then
  43. echo '✅ FreshRSS successfully installed.'
  44. else
  45. echo '❌ FreshRSS error during installation!'
  46. exit $EXITCODE
  47. fi
  48. fi
  49. if [ -n "$FRESHRSS_USER" ]; then
  50. # shellcheck disable=SC2046
  51. php -f ./cli/create-user.php -- \
  52. $(echo "$FRESHRSS_USER" | sed -r 's/[\r\n]+/\n/g' | paste -s -)
  53. EXITCODE=$?
  54. if [ $EXITCODE -eq 3 ]; then
  55. echo 'ℹ️ FreshRSS user already exists; no change performed.'
  56. elif [ $EXITCODE -eq 0 ]; then
  57. echo '✅ FreshRSS user successfully created.'
  58. ./cli/list-users.php | xargs -n1 ./cli/actualize-user.php --user
  59. else
  60. echo '❌ FreshRSS error during the creation of a user!'
  61. exit $EXITCODE
  62. fi
  63. fi
  64. ./cli/access-permissions.sh
  65. exec "$@"