1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-26 13:29:12 -05:00

[GITEA] environment-to-ini fails if run as root

(cherry picked from commit 494f11afe8)
(cherry picked from commit 883d3f3f0f)
(cherry picked from commit ec2b69b0ec)
This commit is contained in:
Earl Warren 2023-06-24 00:44:32 +02:00
parent 8924d15dec
commit 50158ca8e1
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -56,11 +56,11 @@ if [ ! -f ${GITEA_CUSTOM}/conf/app.ini ]; then
chown ${USER}:git ${GITEA_CUSTOM}/conf/app.ini chown ${USER}:git ${GITEA_CUSTOM}/conf/app.ini
fi fi
# Replace app.ini settings with env variables in the form GITEA__SECTION_NAME__KEY_NAME
environment-to-ini --config ${GITEA_CUSTOM}/conf/app.ini
# only chown if current owner is not already the gitea ${USER}. No recursive check to save time # only chown if current owner is not already the gitea ${USER}. No recursive check to save time
if ! [[ $(ls -ld /data/gitea | awk '{print $3}') = ${USER} ]]; then chown -R ${USER}:git /data/gitea; fi if ! [[ $(ls -ld /data/gitea | awk '{print $3}') = ${USER} ]]; then chown -R ${USER}:git /data/gitea; fi
if ! [[ $(ls -ld /app/gitea | awk '{print $3}') = ${USER} ]]; then chown -R ${USER}:git /app/gitea; fi if ! [[ $(ls -ld /app/gitea | awk '{print $3}') = ${USER} ]]; then chown -R ${USER}:git /app/gitea; fi
if ! [[ $(ls -ld /data/git | awk '{print $3}') = ${USER} ]]; then chown -R ${USER}:git /data/git; fi if ! [[ $(ls -ld /data/git | awk '{print $3}') = ${USER} ]]; then chown -R ${USER}:git /data/git; fi
chmod 0755 /data/gitea /app/gitea /data/git chmod 0755 /data/gitea /app/gitea /data/git
# Replace app.ini settings with env variables in the form GITEA__SECTION_NAME__KEY_NAME
su $USER -c "environment-to-ini --config ${GITEA_CUSTOM}/conf/app.ini"