feat: go back to gitea
Some checks failed
Continuous Integration / lint_n_build (push) Has been cancelled
Some checks failed
Continuous Integration / lint_n_build (push) Has been cancelled
This commit is contained in:
@@ -3,17 +3,17 @@
|
||||
Name: %(make name)
|
||||
Version: %(make version)
|
||||
Release: %(make release)
|
||||
Summary: Netoik Reverse Proxy
|
||||
License: MIT
|
||||
URL: https://git.netoik.io/%(make owner)/%(make name)
|
||||
Summary: %(make summary)
|
||||
License: %(make license)
|
||||
URL: %(make url)
|
||||
|
||||
Source0: %{name}-%{version}-%{release}.tar.gz
|
||||
Source0: %(make source0)
|
||||
Buildarch: %(make arch)
|
||||
BuildRequires: make
|
||||
Requires: netoik-rp netoik-db netoik-cache forgejo
|
||||
Requires: netoik-rp netoik-db netoik-cache
|
||||
|
||||
%description
|
||||
Install the Git UI server called Forgejo (fork of Gitea).
|
||||
Install the Git server called Gitea.
|
||||
|
||||
%prep
|
||||
%autosetup -v
|
||||
@@ -22,35 +22,68 @@ Install the Git UI server called Forgejo (fork of Gitea).
|
||||
%make_install
|
||||
|
||||
%post
|
||||
# Change rights on config file
|
||||
chgrp forgejo %{_sysconfdir}/forgejo/conf/netoik_app.ini
|
||||
# Download and verify gitea binary
|
||||
export ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')
|
||||
wget -O %{_tmppath}/gitea https://dl.gitea.com/gitea/1.25.5/gitea-1.25.5-linux-$ARCH
|
||||
wget -O %{_tmppath}/gitea.asc https://dl.gitea.com/gitea/1.25.5/gitea-1.25.5-linux-$ARCH.asc
|
||||
gpg --keyserver hkps://keys.openpgp.org --recv 7C9E68152594688862D62AF62D9AE806EC1592E2
|
||||
gpg --verify %{_tmppath}/gitea.asc %{_tmppath}/gitea
|
||||
rm %{_tmppath}/gitea.asc
|
||||
chmod 755 gitea
|
||||
mv %{_tmppath}/gitea %{_sbindir}/gitea
|
||||
|
||||
# Add user forgejo to db groups
|
||||
usermod --groups postgres,valkey --append forgejo
|
||||
# Replace secrets in app.ini
|
||||
export INTERNAL_TOKEN=$(runuser --user=gitea -- gitea generate secret INTERNAL_TOKEN)
|
||||
export JWT_SECRET=$(runuser --user=gitea -- gitea generate secret JWT_SECRET)
|
||||
export SECRET_KEY=$(runuser --user=gitea -- gitea generate secret SECRET_TOKEN)
|
||||
envsubst < %{_sysconfdir}/gitea/app.ini > %{_sysconfdir}/gitea/.app.ini.new
|
||||
mv %{_sysconfdir}/gitea/.app.ini.new %{_sysconfdir}/gitea/app.ini
|
||||
chown root:gitea %{_sysconfdir}/gitea/app.ini
|
||||
|
||||
# Create gitea user
|
||||
useradd --base-dir %{_sharedstatedir} --create-home --shell $SHELL --system gitea
|
||||
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
|
||||
usermod --groups postgres,valkey --append gitea
|
||||
|
||||
# Add lugit theme
|
||||
wget -O %{_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 --directory=%{_sharedstatedir}/gitea/custom --file %{_tmppath}/gitea-lugit-theme.tar.gz
|
||||
runuser --user=gitea -- mv %{_tmppath}/gitea_images/* %{_sharedstatedir}/gitea/custom/public/assets/img
|
||||
rm --recursive %{_tmppath}/gitea_images
|
||||
|
||||
# Create postgres user and db
|
||||
if ! runuser --user=postgres -- psql --quiet --tuples-only --command='\du' | grep --quiet forgejo; then
|
||||
runuser --user=postgres -- createuser forgejo
|
||||
runuser --user=postgres -- createdb --owner=forgejo forgejo
|
||||
if ! runuser --user=postgres -- psql --quiet --tuples-only --command='\du' | grep --quiet gitea; then
|
||||
runuser --user=postgres -- createuser gitea
|
||||
runuser --user=postgres -- createdb --owner=gitea gitea
|
||||
fi
|
||||
|
||||
# Create admin user
|
||||
if ! runuser --user=forgejo -- forgejo --config %{_sysconfdir}/forgejo/conf/netoik_app.ini admin user list | grep samuel; then
|
||||
runuser --user=forgejo -- forgejo --config %{_sysconfdir}/forgejo/conf/netoik_app.ini admin user create --username samuel --email "samuel.campos@netoik.io" --admin --random-password --random-password-length 30 --fullname "Samuel Campos"
|
||||
if ! runuser --user=gitea -- gitea admin user list | grep samuel; then
|
||||
runuser --user=gitea -- gitea admin user create --username samuel --email "samuel.campos@netoik.io" --admin --random-password --random-password-length 30 --fullname "Samuel Campos"
|
||||
runuser --user=gitea -- gitea admin user must-change-password samuel
|
||||
fi
|
||||
|
||||
# Restart forgejo and nginx services
|
||||
# Restart gitea and nginx services
|
||||
systemctl daemon-reload
|
||||
systemctl reenable forgejo.service
|
||||
systemctl restart forgejo.service
|
||||
systemctl restart nginx.service
|
||||
systemctl reenable gitea.service
|
||||
systemctl restart gitea.service nginx.service
|
||||
|
||||
%postun
|
||||
if [ $1 == 0 ]; then
|
||||
userdel --force --remove gitea
|
||||
runuser --user=postgres -- psql --command='DROP DATABASE gitea; DROP USER gitea;'
|
||||
fi
|
||||
|
||||
%files
|
||||
%attr(660, root, -) %{_sysconfdir}/forgejo/conf/netoik_app.ini
|
||||
%dir %attr(755, root, root) %{_sysconfdir}/gitea
|
||||
%attr(640, root, -) %{_sysconfdir}/gitea/app.ini
|
||||
|
||||
%attr(644, root, root) %{_sysconfdir}/nginx/conf.d/git.netoik.io.conf
|
||||
|
||||
%dir %attr(755, root, root) %{_unitdir}/forgejo.service.d
|
||||
%attr(644, root, root) %{_unitdir}/forgejo.service.d/forgejo.conf
|
||||
%attr(644, root, root) %{_unitdir}/gitea.service
|
||||
|
||||
%attr(755, root, root) %{_sbindir}/gitea
|
||||
|
||||
%changelog
|
||||
%autochangelog
|
||||
|
||||
Reference in New Issue
Block a user