Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bdfe38f896 | |||
| de28f71901 | |||
| c313318eb0 |
@@ -21,6 +21,11 @@ Install the Git UI server called Gitea.
|
||||
%install
|
||||
%make_install
|
||||
|
||||
%pre
|
||||
# Create gitea user
|
||||
useradd --system --create-home --bade-dir %{_sharedstatedir} gitea
|
||||
runuser --user gitea -- mkdir --parents %{_sharedstatedir}/gitea/{data,custom}
|
||||
|
||||
%post
|
||||
# Download gitea bin and verify gpg signature
|
||||
wget --output-document %{_tmppath}/gitea "$GITEA_BIN_URL"
|
||||
@@ -31,16 +36,18 @@ mv %{_tmppath}/gitea %{_sbindir}
|
||||
chmod 755 %{_sbindir}/gitea
|
||||
rm %{_tmppath}/gitea.asc
|
||||
|
||||
# Create gitea user
|
||||
useradd --system --create-home --bade-dir %{_sharedstatedir} gitea
|
||||
runuser --user gitea -- mkdir --parents %{_sharedstatedir}/gitea/{data,custom}
|
||||
|
||||
# Generate internal token and secret key
|
||||
INTERNAL_TOKEN="$(gitea generate secret INTERNAL_TOKEN)"
|
||||
SECRET_KEY="$(gitea generate secret SECRET_KEY)"
|
||||
envsubst < %{_sysconfdir}/gitea/app.ini > %{_sysconfdir}/gitea/app.ini.new
|
||||
mv %{_sysconfdir}/gitea/app.ini.new %{_sysconfdir}/gitea/app.ini
|
||||
chmod 600 %{_sysconfdir}/gitea/app.ini
|
||||
chgrp gitea %{_sysconfdir}/gitea/app.ini
|
||||
chmod 640 %{_sysconfdir}/gitea/app.ini
|
||||
|
||||
# Start gitea service
|
||||
systemctl daemon-reload
|
||||
systemctl reenable gitea.service
|
||||
systemctl restart gitea.service
|
||||
|
||||
# Create actrunners
|
||||
for i in $(seq 1 $GITEA_ACT_RUNNERS); do
|
||||
@@ -52,14 +59,9 @@ for i in $(seq 1 $GITEA_ACT_RUNNERS); do
|
||||
fi
|
||||
done
|
||||
|
||||
# Start gitea service
|
||||
systemctl daemon-reload
|
||||
systemctl reenable gitea.service
|
||||
systemctl restart gitea.service
|
||||
|
||||
%preun
|
||||
# Backup gitea data in case of problem
|
||||
gitea dump --config %{_sysconfdir}/gitea/app.ini --tempdir %{_tmppath}
|
||||
runuser --user gitea -- gitea dump --config %{_sysconfdir}/gitea/app.ini --tempdir %{_tmppath}
|
||||
|
||||
%postun
|
||||
# Remove gitea user after uninstall
|
||||
@@ -81,5 +83,3 @@ fi
|
||||
|
||||
%changelog
|
||||
%autochangelog
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user