dataset-formation/seed/forgejo-formation/patches/forgejo.service.patch

23 lines
1.8 KiB
Diff

--- ../../../dataset/seed/forgejo/templates/forgejo.service 2023-01-03 11:30:06.865085785 +0100
+++ modif/forgejo.service 2023-02-14 10:13:27.985282958 +0100
@@ -20,18 +20,8 @@
Group=forgejo
WorkingDirectory=/srv/forgejo/lib/
ExecStart=/usr/bin/forgejo web --config /etc/forgejo/app.ini
-ExecStartPre=/bin/bash -c '%slurp
-/usr/bin/forgejo migrate --config /etc/forgejo/app.ini;%slurp
-if /usr/bin/forgejo admin auth list --config /etc/forgejo/app.ini | grep "OAuth2"; then %slurp
- echo "UPDATE";%slurp
- id=$(/usr/bin/forgejo --config /etc/forgejo/app.ini admin auth list |tail -n 1|awk "{ print \$1}");%slurp
- /usr/bin/forgejo admin auth update-oauth --id $id --name "%%domain_name_eth0" --provider "openidConnect" --key "%%oauth2_client_id" --secret "%%oauth2_client_secret" --scopes "profile email" --auto-discover-url "https://%%oauth2_client_server_domainname/.well-known/openid-configuration" --config /etc/forgejo/app.ini;%slurp
-else %slurp
- echo "CONFIGURE";%slurp
- /usr/bin/forgejo admin auth add-oauth --name "%%domain_name_eth0" --provider "openidConnect" --key "%%oauth2_client_id" --secret "%%oauth2_client_secret" --scopes "profile email" --auto-discover-url "https://%%oauth2_client_server_domainname/.well-known/openid-configuration" --config /etc/forgejo/app.ini;%slurp
-fi;%slurp
-sleep 2;%slurp
-echo "CONFIGURATION DONE"'
+ExecStartPre=-/bin/bash -c "/usr/bin/forgejo admin user create --username %%forgejo_user --password %%forgejo_password --email %%forgejo_email --admin -c /etc/forgejo/app.ini"
+ExecStartPre=-/bin/bash -c "/usr/bin/forgejo admin user create --username %%forgejo_site_user --password %%forgejo_site_password --email %%forgejo_site_email --must-change-password=false -c /etc/forgejo/app.ini"
Restart=always
Environment=GITEA_WORK_DIR=/srv/forgejo/lib