entrypoint.sh 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/bin/sh
  2. php -f ./cli/prepare.php >/dev/null
  3. find /etc/php*/ -type f -name php.ini -exec sed -r -i "\\#^;?date.timezone#s#^.*#date.timezone = $TZ#" {} \;
  4. find /etc/php*/ -type f -name php.ini -exec sed -r -i "\\#^;?post_max_size#s#^.*#post_max_size = 32M#" {} \;
  5. find /etc/php*/ -type f -name php.ini -exec sed -r -i "\\#^;?upload_max_filesize#s#^.*#upload_max_filesize = 32M#" {} \;
  6. if [ -n "$LISTEN" ]; then
  7. find /etc/apache2/ -type f -name FreshRSS.Apache.conf -exec sed -r -i "\\#^Listen#s#^.*#Listen $LISTEN#" {} \;
  8. fi
  9. if [ -n "$CRON_MIN" ]; then
  10. (
  11. echo "export TZ=$TZ"
  12. echo "export COPY_LOG_TO_SYSLOG=$COPY_LOG_TO_SYSLOG"
  13. echo "export COPY_SYSLOG_TO_STDERR=$COPY_SYSLOG_TO_STDERR"
  14. echo "export FRESHRSS_ENV=$FRESHRSS_ENV"
  15. ) >/var/www/FreshRSS/Docker/env.txt
  16. crontab -l | sed -r "\\#FreshRSS#s#^[^ ]+ #$CRON_MIN #" | crontab -
  17. fi
  18. if [ -n "$FRESHRSS_INSTALL" ]; then
  19. # shellcheck disable=SC2046
  20. php -f ./cli/do-install.php -- \
  21. $(echo "$FRESHRSS_INSTALL" | sed -r 's/[\r\n]+/\n/g' | paste -s -) \
  22. 1>/tmp/out.txt 2>/tmp/err.txt
  23. EXITCODE=$?
  24. grep -v 'Remember to' /tmp/out.txt
  25. grep -v 'Please use' /tmp/err.txt 1>&2
  26. if [ $EXITCODE -eq 3 ]; then
  27. echo 'ℹ️ FreshRSS already installed; no change performed.'
  28. elif [ $EXITCODE -eq 0 ]; then
  29. echo '✅ FreshRSS successfully installed.'
  30. else
  31. rm -f /tmp/out.txt /tmp/err.txt
  32. echo '❌ FreshRSS error during installation!'
  33. exit $EXITCODE
  34. fi
  35. rm -f /tmp/out.txt /tmp/err.txt
  36. fi
  37. if [ -n "$FRESHRSS_USER" ]; then
  38. # shellcheck disable=SC2046
  39. php -f ./cli/create-user.php -- \
  40. $(echo "$FRESHRSS_USER" | sed -r 's/[\r\n]+/\n/g' | paste -s -) \
  41. 1>/tmp/out.txt 2>/tmp/err.txt
  42. EXITCODE=$?
  43. grep -v 'Remember to' /tmp/out.txt
  44. cat /tmp/err.txt 1>&2
  45. if [ $EXITCODE -eq 3 ]; then
  46. echo 'ℹ️ FreshRSS user already exists; no change performed.'
  47. elif [ $EXITCODE -eq 0 ]; then
  48. echo '✅ FreshRSS user successfully created.'
  49. ./cli/list-users.php | xargs -n1 ./cli/actualize-user.php --user
  50. else
  51. rm -f /tmp/out.txt /tmp/err.txt
  52. echo '❌ FreshRSS error during the creation of a user!'
  53. exit $EXITCODE
  54. fi
  55. rm -f /tmp/out.txt /tmp/err.txt
  56. fi
  57. chown -R :www-data .
  58. chmod -R g+r . && chmod -R g+w ./data/
  59. exec "$@"