9 Commits

Author SHA1 Message Date
d12efca2e3 fix: create act runners after gitea start 2026-04-11 15:38:19 +02:00
28d629073a fix: create gitea db schema 2026-04-11 15:33:54 +02:00
7229529ad0 fix: add env variables 2026-04-11 14:37:51 +02:00
b9c55b9786 fix: bash_profile path
Some checks failed
Continuous Delivery / build_n_upload (push) Has been cancelled
2026-04-06 17:57:55 +02:00
5fdb221abc fix: export gitea home dir variable
Some checks failed
Continuous Delivery / build_n_upload (push) Has been cancelled
2026-04-06 17:44:07 +02:00
46df78d59e fix: add work dir variable
Some checks failed
Continuous Delivery / build_n_upload (push) Has been cancelled
2026-04-06 17:17:20 +02:00
0188b0cb2f fix: unxz does already remove file automatically
All checks were successful
Continuous Delivery / build_n_upload (push) Successful in 22s
2026-04-06 16:45:33 +02:00
c2b680c6df fix: typo in token generate command
Some checks failed
Continuous Delivery / build_n_upload (push) Has been cancelled
2026-04-06 11:01:33 +02:00
545898493c fix: add logos to files
Some checks failed
Continuous Delivery / build_n_upload (push) Has been cancelled
2026-04-06 10:47:25 +02:00

View File

@@ -22,6 +22,16 @@ Install the Git server called Gitea.
%make_install %make_install
%post %post
# Display commands and exit on error
set -xe
# Set environment variables
export ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')
export GITEA_BINARY=gitea-1.25.5-linux-$ARCH
export GITEA_LUGIT_THEME=gitea-lugit-theme
export GITEA_WORK_DIR=/var/lib/gitea
export ACTRUNNER_BINARY=act_runner-0.3.0-linux-$ARCH
# Create gitea user # Create gitea user
if ! id gitea >/dev/null 2>&1; then if ! id gitea >/dev/null 2>&1; then
useradd --base-dir %{_sharedstatedir} --create-home --shell $SHELL --system gitea useradd --base-dir %{_sharedstatedir} --create-home --shell $SHELL --system gitea
@@ -29,10 +39,9 @@ fi
runuser --user=gitea -- mkdir --parents %{_sharedstatedir}/gitea/{custom,data,log} %{_sharedstatedir}/gitea/custom/conf runuser --user=gitea -- mkdir --parents %{_sharedstatedir}/gitea/{custom,data,log} %{_sharedstatedir}/gitea/custom/conf
runuser --user=gitea -- ln --symbolic --force %{_sysconfdir}/gitea/app.ini %{_sharedstatedir}/gitea/custom/conf/app.ini runuser --user=gitea -- ln --symbolic --force %{_sysconfdir}/gitea/app.ini %{_sharedstatedir}/gitea/custom/conf/app.ini
usermod --groups postgres,valkey --append gitea usermod --groups postgres,valkey --append gitea
printf 'export GITEA_WORK_DIR=%{_sharedstatedir}/gitea\n' >> %{_sharedstatedir}/gitea/.bash_profile
# Download and install gitea binary # Download and install gitea binary
export ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')
export GITEA_BINARY=gitea-1.25.5-linux-$ARCH
wget --output-document $GITEA_BINARY https://dl.gitea.com/gitea/1.25.5/$GITEA_BINARY wget --output-document $GITEA_BINARY https://dl.gitea.com/gitea/1.25.5/$GITEA_BINARY
wget --output-document $GITEA_BINARY.asc https://dl.gitea.com/gitea/1.25.5/$GITEA_BINARY.asc wget --output-document $GITEA_BINARY.asc https://dl.gitea.com/gitea/1.25.5/$GITEA_BINARY.asc
gpg --keyserver hkps://keys.openpgp.org --recv 7C9E68152594688862D62AF62D9AE806EC1592E2 gpg --keyserver hkps://keys.openpgp.org --recv 7C9E68152594688862D62AF62D9AE806EC1592E2
@@ -51,11 +60,10 @@ chmod 640 %{_sysconfdir}/gitea/app.ini
chown root:gitea %{_sysconfdir}/gitea/app.ini chown root:gitea %{_sysconfdir}/gitea/app.ini
# Add lugit theme # Add lugit theme
export GITEA_LUGIT_THEME=gitea-lugit-theme
wget --output-document %{_tmppath}/$GITEA_LUGIT_THEME.tar.gz https://github.com/lucas-labs/gitea-lugit-theme/releases/download/v1.0.1/$GITEA_LUGIT_THEME.tar.gz wget --output-document %{_tmppath}/$GITEA_LUGIT_THEME.tar.gz https://github.com/lucas-labs/gitea-lugit-theme/releases/download/v1.0.1/$GITEA_LUGIT_THEME.tar.gz
runuser --user=gitea -- tar --extract --gzip --overwrite --directory=%{_sharedstatedir}/gitea/custom --file %{_tmppath}/$GITEA_LUGIT_THEME.tar.gz runuser --user=gitea -- tar --extract --gzip --overwrite --directory=%{_sharedstatedir}/gitea/custom --file %{_tmppath}/$GITEA_LUGIT_THEME.tar.gz
rm %{_tmppath}/$GITEA_LUGIT_THEME.tar.gz rm %{_tmppath}/$GITEA_LUGIT_THEME.tar.gz
runuser --user=gitea -- mv %{_tmppath}/gitea_images/* %{_sharedstatedir}/gitea/custom/public/assets/img runuser --user=gitea -- cp %{_tmppath}/gitea_images/* %{_sharedstatedir}/gitea/custom/public/assets/img
# Create postgres user and db # Create postgres user and db
if ! runuser --user=postgres -- psql --quiet --tuples-only --command='\du' | grep --quiet gitea; then if ! runuser --user=postgres -- psql --quiet --tuples-only --command='\du' | grep --quiet gitea; then
@@ -63,6 +71,7 @@ if ! runuser --user=postgres -- psql --quiet --tuples-only --command='\du' | gre
fi fi
if ! runuser --user=postgres -- psql --quiet --tuples-only --command='\l' | grep --quiet gitea; then if ! runuser --user=postgres -- psql --quiet --tuples-only --command='\l' | grep --quiet gitea; then
runuser --user=postgres -- createdb --owner=gitea gitea runuser --user=postgres -- createdb --owner=gitea gitea
runuser --user=gitea -- gitea migrate
fi fi
# Create admin user # Create admin user
@@ -72,18 +81,21 @@ if ! runuser --user=gitea -- gitea admin user list | grep --quiet samuel; then
fi fi
# Download and install act_runner binary # Download and install act_runner binary
export ACTRUNNER_BINARY=act_runner-0.3.0-linux-$ARCH
wget --output-document $ACTRUNNER_BINARY.xz https://gitea.com/gitea/act_runner/releases/download/v0.3.0/$ACTRUNNER_BINARY.xz wget --output-document $ACTRUNNER_BINARY.xz https://gitea.com/gitea/act_runner/releases/download/v0.3.0/$ACTRUNNER_BINARY.xz
wget --output-document $ACTRUNNER_BINARY.xz.sha256 https://gitea.com/gitea/act_runner/releases/download/v0.3.0/$ACTRUNNER_BINARY.xz.sha256 wget --output-document $ACTRUNNER_BINARY.xz.sha256 https://gitea.com/gitea/act_runner/releases/download/v0.3.0/$ACTRUNNER_BINARY.xz.sha256
cat $ACTRUNNER_BINARY.xz.sha256 | sha256sum --check --status cat $ACTRUNNER_BINARY.xz.sha256 | sha256sum --check --status
rm $ACTRUNNER_BINARY.xz.sha256 rm $ACTRUNNER_BINARY.xz.sha256
unxz $ACTRUNNER_BINARY.xz unxz $ACTRUNNER_BINARY.xz
rm $ACTRUNNER_BINARY.xz
chmod 755 $ACTRUNNER_BINARY chmod 755 $ACTRUNNER_BINARY
mv $ACTRUNNER_BINARY %{_sbindir}/act_runner mv $ACTRUNNER_BINARY %{_sbindir}/act_runner
# Restart gitea and nginx services
systemctl daemon-reload
systemctl reenable gitea.service
systemctl restart gitea.service nginx.service
# Create 4 actrunner users # Create 4 actrunner users
export ACTRUNNER_TOKEN=$(runuser --user=gitea -- gitea actions generate-token-runner --scope samuel) export ACTRUNNER_TOKEN=$(runuser --user=gitea -- gitea actions generate-runner-token)
for i in $(seq 1 4); do for i in $(seq 1 4); do
if ! id actrunner$i >/dev/null 2>&1; then if ! id actrunner$i >/dev/null 2>&1; then
useradd --base-dir %{_sharedstatedir} --create-home --shell $SHELL --system actrunner$i useradd --base-dir %{_sharedstatedir} --create-home --shell $SHELL --system actrunner$i
@@ -94,12 +106,10 @@ for i in $(seq 1 4); do
systemctl restart actrunner@$i.service systemctl restart actrunner@$i.service
done done
# Restart gitea and nginx services
systemctl daemon-reload
systemctl reenable gitea.service
systemctl restart gitea.service nginx.service
%postun %postun
# Display commands and exit on error
set -xe
# If uninstalling, then delete users and db # If uninstalling, then delete users and db
if [ $1 == 0 ]; then if [ $1 == 0 ]; then
# Remove gitea user if existing # Remove gitea user if existing
@@ -136,6 +146,7 @@ fi
%ghost %attr(755, root, root) %{_sbindir}/act_runner %ghost %attr(755, root, root) %{_sbindir}/act_runner
%dir %attr(755, root, root) %{_tmppath}/gitea_images %dir %attr(755, root, root) %{_tmppath}/gitea_images
%attr(644, root, root) %{_tmppath}/gitea_images/{favicon,logo}.{png,svg}
%changelog %changelog
%autochangelog %autochangelog