Create entrypoint.sh
Browse files- entrypoint.sh +81 -0
entrypoint.sh
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
|
3 |
+
ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime
|
4 |
+
echo "$TZ" >/etc/timezone
|
5 |
+
|
6 |
+
find /etc/php*/ -type f -name php.ini -exec sed -r -i "\\#^;?date.timezone#s#^.*#date.timezone = $TZ#" {} \;
|
7 |
+
find /etc/php*/ -type f -name php.ini -exec sed -r -i "\\#^;?post_max_size#s#^.*#post_max_size = 32M#" {} \;
|
8 |
+
find /etc/php*/ -type f -name php.ini -exec sed -r -i "\\#^;?upload_max_filesize#s#^.*#upload_max_filesize = 32M#" {} \;
|
9 |
+
|
10 |
+
if [ -n "$LISTEN" ]; then
|
11 |
+
find /etc/apache2/ -type f -name FreshRSS.Apache.conf -exec sed -r -i "\\#^Listen#s#^.*#Listen $LISTEN#" {} \;
|
12 |
+
fi
|
13 |
+
|
14 |
+
if [ -n "$TRUSTED_PROXY" ]; then
|
15 |
+
if [ "$TRUSTED_PROXY" = "0" ]; then
|
16 |
+
# Disable RemoteIPHeader and RemoteIPInternalProxy
|
17 |
+
find /etc/apache2/ -type f -name FreshRSS.Apache.conf -exec sed -r -i "/^\s*RemoteIP.*$/s/^/#/" {} \;
|
18 |
+
else
|
19 |
+
# Custom list for RemoteIPInternalProxy
|
20 |
+
find /etc/apache2/ -type f -name FreshRSS.Apache.conf -exec sed -r -i "\\#^\s*RemoteIPInternalProxy#s#^.*#\tRemoteIPInternalProxy $TRUSTED_PROXY#" {} \;
|
21 |
+
fi
|
22 |
+
fi
|
23 |
+
|
24 |
+
if [ -n "$OIDC_ENABLED" ] && [ "$OIDC_ENABLED" -ne 0 ]; then
|
25 |
+
# Debian
|
26 |
+
(which a2enmod >/dev/null && a2enmod -q auth_openidc) ||
|
27 |
+
# Alpine
|
28 |
+
(mv /etc/apache2/conf.d/mod-auth-openidc.conf.bak /etc/apache2/conf.d/mod-auth-openidc.conf && echo 'Enabling module auth_openidc.')
|
29 |
+
if [ -n "$OIDC_SCOPES" ]; then
|
30 |
+
# Compatibility with : as separator instead of space
|
31 |
+
OIDC_SCOPES=$(echo "$OIDC_SCOPES" | tr ':' ' ')
|
32 |
+
export OIDC_SCOPES
|
33 |
+
fi
|
34 |
+
fi
|
35 |
+
|
36 |
+
if [ -n "$CRON_MIN" ]; then
|
37 |
+
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
|
38 |
+
sed </etc/crontab.freshrss.default \
|
39 |
+
-r "s#^[^ ]+ #$CRON_MIN #" | crontab -
|
40 |
+
fi
|
41 |
+
|
42 |
+
./cli/access-permissions.sh
|
43 |
+
|
44 |
+
php -f ./cli/prepare.php >/dev/null
|
45 |
+
|
46 |
+
if [ -n "$FRESHRSS_INSTALL" ]; then
|
47 |
+
# shellcheck disable=SC2046
|
48 |
+
php -f ./cli/do-install.php -- \
|
49 |
+
$(echo "$FRESHRSS_INSTALL" | sed -r 's/[\r\n]+/\n/g' | paste -s -)
|
50 |
+
EXITCODE=$?
|
51 |
+
|
52 |
+
if [ $EXITCODE -eq 3 ]; then
|
53 |
+
echo 'ℹ️ FreshRSS already installed; no change performed.'
|
54 |
+
elif [ $EXITCODE -eq 0 ]; then
|
55 |
+
echo '✅ FreshRSS successfully installed.'
|
56 |
+
else
|
57 |
+
echo '❌ FreshRSS error during installation!'
|
58 |
+
exit $EXITCODE
|
59 |
+
fi
|
60 |
+
fi
|
61 |
+
|
62 |
+
if [ -n "$FRESHRSS_USER" ]; then
|
63 |
+
# shellcheck disable=SC2046
|
64 |
+
php -f ./cli/create-user.php -- \
|
65 |
+
$(echo "$FRESHRSS_USER" | sed -r 's/[\r\n]+/\n/g' | paste -s -)
|
66 |
+
EXITCODE=$?
|
67 |
+
|
68 |
+
if [ $EXITCODE -eq 3 ]; then
|
69 |
+
echo 'ℹ️ FreshRSS user already exists; no change performed.'
|
70 |
+
elif [ $EXITCODE -eq 0 ]; then
|
71 |
+
echo '✅ FreshRSS user successfully created.'
|
72 |
+
./cli/list-users.php | xargs -n1 ./cli/actualize-user.php --user
|
73 |
+
else
|
74 |
+
echo '❌ FreshRSS error during the creation of a user!'
|
75 |
+
exit $EXITCODE
|
76 |
+
fi
|
77 |
+
fi
|
78 |
+
|
79 |
+
./cli/access-permissions.sh
|
80 |
+
|
81 |
+
exec "$@"
|