Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3334a877d7 | |||
| bdfe38f896 | |||
| de28f71901 | |||
| c313318eb0 | |||
| 13ed7bfcd8 |
12
Makefile
12
Makefile
@@ -2,7 +2,7 @@ NAME = netoik-git
|
|||||||
VERSION = $(shell git describe --abbrev=0)
|
VERSION = $(shell git describe --abbrev=0)
|
||||||
RELEASE = $(shell git rev-parse --short HEAD)
|
RELEASE = $(shell git rev-parse --short HEAD)
|
||||||
REFERENCE = $(if $(GIT_REFERENCE),$(GIT_REFERENCE),$(shell git branch --show-current))
|
REFERENCE = $(if $(GIT_REFERENCE),$(GIT_REFERENCE),$(shell git branch --show-current))
|
||||||
BUILD_ARCH = noarch
|
ARCH = noarch
|
||||||
|
|
||||||
RPM_RPMDIR = $(shell rpm --eval '%{_rpmdir}')
|
RPM_RPMDIR = $(shell rpm --eval '%{_rpmdir}')
|
||||||
RPM_SBINDIR = $(shell rpm --eval '%{_sbindir}')
|
RPM_SBINDIR = $(shell rpm --eval '%{_sbindir}')
|
||||||
@@ -11,7 +11,7 @@ RPM_SHAREDSTATEDIR = $(shell rpm --eval '%{_sharedstatedir}')
|
|||||||
RPM_SYSCONFDIR = $(shell rpm --eval '%{_sysconfdir}')
|
RPM_SYSCONFDIR = $(shell rpm --eval '%{_sysconfdir}')
|
||||||
RPM_UNITDIR = $(shell rpm --eval '%{_unitdir}')
|
RPM_UNITDIR = $(shell rpm --eval '%{_unitdir}')
|
||||||
|
|
||||||
RPM_TARBALL_PATH = $(RPM_SOURCEDIR)/$(NAME)-$(VERSION).tar.gz
|
RPM_TARBALL_PATH = $(RPM_SOURCEDIR)/$(NAME)-$(VERSION)-$(RELEASE).tar.gz
|
||||||
RPM_BUILD_PATH = $(RPM_RPMDIR)/$(BUILD_ARCH)/$(NAME)-$(VERSION)-$(RELEASE).$(BUILD_ARCH).rpm
|
RPM_BUILD_PATH = $(RPM_RPMDIR)/$(BUILD_ARCH)/$(NAME)-$(VERSION)-$(RELEASE).$(BUILD_ARCH).rpm
|
||||||
|
|
||||||
.PHONY: name
|
.PHONY: name
|
||||||
@@ -26,14 +26,14 @@ version:
|
|||||||
release:
|
release:
|
||||||
@echo "$(RELEASE)"
|
@echo "$(RELEASE)"
|
||||||
|
|
||||||
.PHONY: build_arch
|
.PHONY: arch
|
||||||
build_arch:
|
arch:
|
||||||
@echo "$(BUILD_ARCH)"
|
@echo "$(ARCH)"
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install:
|
install:
|
||||||
install --mode=755 --directory $(DESTDIR)$(RPM_SYSCONFDIR)/gitea $(DESTDIR)$(RPM_SYSCONFDIR)/nginx/conf.d $(DESTDIR)$(RPM_UNITDIR) $(DESTDIR)$(RPM_SHAREDSTATEDIR)/actrunners
|
install --mode=755 --directory $(DESTDIR)$(RPM_SYSCONFDIR)/gitea $(DESTDIR)$(RPM_SYSCONFDIR)/nginx/conf.d $(DESTDIR)$(RPM_UNITDIR) $(DESTDIR)$(RPM_SHAREDSTATEDIR)/actrunners
|
||||||
install --mode=644 --target-directory=$(DESTDIR)$(RPM_SYSCONFDIR)/nginx/conf.d/ git.netoik.io.conf
|
install --mode=644 --target-directory=$(DESTDIR)$(RPM_SYSCONFDIR)/nginx/conf.d/ files/nginx/git.netoik.io.conf
|
||||||
install --mode=640 --target-directory=$(DESTDIR)$(RPM_SYSCONFDIR)/gitea files/gitea/app.ini
|
install --mode=640 --target-directory=$(DESTDIR)$(RPM_SYSCONFDIR)/gitea files/gitea/app.ini
|
||||||
install --mode=644 --target-directory=$(DESTDIR)$(RPM_UNITDIR) files/systemd/gitea.service files/systemd/actrunner@.service
|
install --mode=644 --target-directory=$(DESTDIR)$(RPM_UNITDIR) files/systemd/gitea.service files/systemd/actrunner@.service
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ Summary: Netoik Reverse Proxy
|
|||||||
License: MIT
|
License: MIT
|
||||||
URL: https://git.netoik.io/samuel/%(make name)
|
URL: https://git.netoik.io/samuel/%(make name)
|
||||||
|
|
||||||
Source0: %{name}-%{version}.tar.gz
|
Source0: %{name}-%{version}-%{release}.tar.gz
|
||||||
Buildarch: %(make build_arch)
|
Buildarch: %(make arch)
|
||||||
BuildRequires: make
|
BuildRequires: make
|
||||||
Requires: netoik-rp netoik-db netoik-cache git
|
Requires: netoik-rp netoik-db netoik-cache git
|
||||||
|
|
||||||
@@ -31,16 +31,21 @@ 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 --bade-dir %{_sharedstatedir} gitea
|
||||||
|
runuser --user gitea -- mkdir --parents %{_sharedstatedir}/gitea/{data,custom}
|
||||||
|
chgrp gitea %{_sysconfdir}/gitea/app.ini
|
||||||
|
|
||||||
|
# Start gitea service
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl reenable gitea.service
|
||||||
|
systemctl restart gitea.service
|
||||||
|
|
||||||
# Create actrunners
|
# Create actrunners
|
||||||
for i in $(seq 1 $GITEA_ACT_RUNNERS); do
|
for i in $(seq 1 $GITEA_ACT_RUNNERS); do
|
||||||
@@ -52,14 +57,9 @@ 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
|
||||||
@@ -72,7 +72,7 @@ fi
|
|||||||
%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 +81,3 @@ fi
|
|||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
%autochangelog
|
%autochangelog
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user