entrypoint.sh 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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" = "0" ]; then
  12. # Disable RemoteIPHeader and RemoteIPInternalProxy
  13. find /etc/apache2/ -type f -name FreshRSS.Apache.conf -exec sed -r -i "/^\s*RemoteIP.*$/s/^/#/" {} \;
  14. else
  15. # Custom list for RemoteIPInternalProxy
  16. find /etc/apache2/ -type f -name FreshRSS.Apache.conf -exec sed -r -i "\\#^\s*RemoteIPInternalProxy#s#^.*#\tRemoteIPInternalProxy $TRUSTED_PROXY#" {} \;
  17. fi
  18. fi
  19. if [ -n "$OIDC_ENABLED" ] && [ "$OIDC_ENABLED" -ne 0 ]; then
  20. a2enmod -q auth_openidc
  21. if [ -n "$OIDC_ENABLED" ]; then
  22. # Compatibility with : as separator instead of space:
  23. OIDC_SCOPES=$(echo "$OIDC_SCOPES" | tr ':' ' ')
  24. export OIDC_SCOPES
  25. fi
  26. fi
  27. if [ -n "$CRON_MIN" ]; then
  28. (
  29. echo "export TZ=$TZ"
  30. echo "export COPY_LOG_TO_SYSLOG=$COPY_LOG_TO_SYSLOG"
  31. echo "export COPY_SYSLOG_TO_STDERR=$COPY_SYSLOG_TO_STDERR"
  32. echo "export FRESHRSS_ENV=$FRESHRSS_ENV"
  33. echo "export DATA_PATH=$DATA_PATH"
  34. ) >/var/www/FreshRSS/Docker/env.txt
  35. sed </etc/crontab.freshrss.default \
  36. -r "s#^[^ ]+ #$CRON_MIN #" | crontab -
  37. fi
  38. ./cli/access-permissions.sh
  39. php -f ./cli/prepare.php >/dev/null
  40. if [ -n "$FRESHRSS_INSTALL" ]; then
  41. # shellcheck disable=SC2046
  42. php -f ./cli/do-install.php -- \
  43. $(echo "$FRESHRSS_INSTALL" | sed -r 's/[\r\n]+/\n/g' | paste -s -)
  44. EXITCODE=$?
  45. if [ $EXITCODE -eq 3 ]; then
  46. echo 'ℹ️ FreshRSS already installed; no change performed.'
  47. elif [ $EXITCODE -eq 0 ]; then
  48. echo '✅ FreshRSS successfully installed.'
  49. else
  50. echo '❌ FreshRSS error during installation!'
  51. exit $EXITCODE
  52. fi
  53. fi
  54. if [ -n "$FRESHRSS_USER" ]; then
  55. # shellcheck disable=SC2046
  56. php -f ./cli/create-user.php -- \
  57. $(echo "$FRESHRSS_USER" | sed -r 's/[\r\n]+/\n/g' | paste -s -)
  58. EXITCODE=$?
  59. if [ $EXITCODE -eq 3 ]; then
  60. echo 'ℹ️ FreshRSS user already exists; no change performed.'
  61. elif [ $EXITCODE -eq 0 ]; then
  62. echo '✅ FreshRSS user successfully created.'
  63. ./cli/list-users.php | xargs -n1 ./cli/actualize-user.php --user
  64. else
  65. echo '❌ FreshRSS error during the creation of a user!'
  66. exit $EXITCODE
  67. fi
  68. fi
  69. ./cli/access-permissions.sh
  70. exec "$@"