Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e19760d37e | |||
| 89837bef2b | |||
| 3334a877d7 | |||
| bdfe38f896 | |||
| de28f71901 | |||
| c313318eb0 |
@@ -23,24 +23,30 @@ Install the Git UI server called Gitea.
|
|||||||
|
|
||||||
%post
|
%post
|
||||||
# Download gitea bin and verify gpg signature
|
# Download gitea bin and verify gpg signature
|
||||||
wget --output-document %{_tmppath}/gitea "$GITEA_BIN_URL"
|
wget --quiet --output-document %{_tmppath}/gitea "$GITEA_BIN_URL"
|
||||||
wget --output-document %{_tmppath}/gitea.asc "$GITEA_ASC_URL"
|
wget --quiet --output-document %{_tmppath}/gitea.asc "$GITEA_ASC_URL"
|
||||||
gpg --keyserver "$GITEA_GPG_KEYSERVER" --recv "$GITEA_GPG_RECV"
|
gpg --keyserver "$GITEA_GPG_KEYSERVER" --recv "$GITEA_GPG_RECV"
|
||||||
gpg --verify %{_tmppath}/gitea.asc %{_tmppath}/gitea
|
gpg --verify %{_tmppath}/gitea.asc %{_tmppath}/gitea
|
||||||
mv %{_tmppath}/gitea %{_sbindir}
|
mv %{_tmppath}/gitea %{_sbindir}
|
||||||
chmod 755 %{_sbindir}/gitea
|
chmod 755 %{_sbindir}/gitea
|
||||||
rm %{_tmppath}/gitea.asc
|
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
|
# Generate internal token and secret key
|
||||||
INTERNAL_TOKEN="$(gitea generate secret INTERNAL_TOKEN)"
|
INTERNAL_TOKEN="$(gitea generate secret INTERNAL_TOKEN)"
|
||||||
SECRET_KEY="$(gitea generate secret SECRET_KEY)"
|
SECRET_KEY="$(gitea generate secret SECRET_KEY)"
|
||||||
envsubst < %{_sysconfdir}/gitea/app.ini > %{_sysconfdir}/gitea/app.ini.new
|
envsubst < %{_sysconfdir}/gitea/app.ini > %{_sysconfdir}/gitea/app.ini.new
|
||||||
mv %{_sysconfdir}/gitea/app.ini.new %{_sysconfdir}/gitea/app.ini
|
mv %{_sysconfdir}/gitea/app.ini.new %{_sysconfdir}/gitea/app.ini
|
||||||
chmod 600 %{_sysconfdir}/gitea/app.ini
|
|
||||||
|
# Create gitea user
|
||||||
|
useradd --system --create-home --base-dir %{_sharedstatedir} gitea
|
||||||
|
runuser --user gitea -- mkdir --parents %{_sharedstatedir}/gitea/{data,custom}
|
||||||
|
chgrp gitea %{_sysconfdir}/gitea/app.ini
|
||||||
|
|
||||||
|
# Start gitea and nginx services
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl reenable gitea.service
|
||||||
|
systemctl restart gitea.service
|
||||||
|
systemctl restart nginx.service
|
||||||
|
|
||||||
# Create actrunners
|
# Create actrunners
|
||||||
for i in $(seq 1 $GITEA_ACT_RUNNERS); do
|
for i in $(seq 1 $GITEA_ACT_RUNNERS); do
|
||||||
@@ -52,27 +58,22 @@ for i in $(seq 1 $GITEA_ACT_RUNNERS); do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Start gitea service
|
|
||||||
systemctl daemon-reload
|
|
||||||
systemctl reenable gitea.service
|
|
||||||
systemctl restart gitea.service
|
|
||||||
|
|
||||||
%preun
|
%preun
|
||||||
# Backup gitea data in case of problem
|
# 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
|
%postun
|
||||||
# Remove gitea user after uninstall
|
# Remove gitea user after uninstall
|
||||||
if [ %1 == 0 ]; then
|
#if [ %1 == 0 ]; then
|
||||||
systemctl stop gitea.service
|
# systemctl stop gitea.service
|
||||||
userdel --force --remove gitea
|
# userdel --force --remove gitea
|
||||||
fi
|
#fi
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%attr(644, root, root) %{_sysconfdir}/nginx/conf.d/git.netoik.io.conf
|
%attr(644, root, root) %{_sysconfdir}/nginx/conf.d/git.netoik.io.conf
|
||||||
|
|
||||||
%dir %attr(755, root, root) %{_sysconfdir}/gitea
|
%dir %attr(755, root, root) %{_sysconfdir}/gitea
|
||||||
%attr(640, root, gitea) %{_sysconfdir}/gitea/app.ini
|
%attr(640, root, -) %{_sysconfdir}/gitea/app.ini
|
||||||
|
|
||||||
%attr(644, root, root) %{_unitdir}/gitea.service
|
%attr(644, root, root) %{_unitdir}/gitea.service
|
||||||
%attr(644, root, root) %{_unitdir}/actrunner@.service
|
%attr(644, root, root) %{_unitdir}/actrunner@.service
|
||||||
@@ -81,5 +82,3 @@ fi
|
|||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
%autochangelog
|
%autochangelog
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user