Compare commits

..

No commits in common. "master" and "0.1" have entirely different histories.
master ... 0.1

2 changed files with 19 additions and 50 deletions

View File

@ -1,5 +1,6 @@
NAME = netoik-api NAME = netoik-api
VERSION = $(shell [ -d ".git" ] && git describe | sed "s/-/./g") VERSION = $(shell [ -d ".git" ] && git describe | sed "s/-/./g")
BRANCH = $(shell [ -d ".git" ] && git branch --show-current)
SYSCONFDIR = $(shell rpm --eval "%{_sysconfdir}") SYSCONFDIR = $(shell rpm --eval "%{_sysconfdir}")
UNITDIR = $(shell rpm --eval "%{_unitdir}") UNITDIR = $(shell rpm --eval "%{_unitdir}")
@ -21,39 +22,15 @@ version:
tarball: $(HOME)/rpmbuild/SOURCES/$(NAME)-$(VERSION).tar.gz tarball: $(HOME)/rpmbuild/SOURCES/$(NAME)-$(VERSION).tar.gz
$(HOME)/rpmbuild/SOURCES/$(NAME)-%.tar.gz: . $(HOME)/rpmbuild/SOURCES/$(NAME)-%.tar.gz: .
git archive --format=tar.gz \ git archive --format=tar.gz --output=$@ --prefix=$(NAME)-$(VERSION)/ --worktree-attributes --verbose $(BRANCH)
--output=$@ \
--prefix=$(NAME)-$(VERSION)/ \
--worktree-attributes \
--verbose \
HEAD
.PHONY: install .PHONY: install
install: install:
install -D \ mkdir --parents $(DESTDIR)$(VARDIR)/$(NAME)/captcha
--no-target-directory \ mkdir --parents $(DESTDIR)$(SYSCONFDIR)/$(NAME)
server.conf.sample \ install server.conf.sample $(DESTDIR)$(SYSCONFDIR)/$(NAME)/server.conf.sample
"$(DESTDIR)$(SYSCONFDIR)/$(NAME)/server.conf" install server.conf.sample $(DESTDIR)$(SYSCONFDIR)/$(NAME)/server.conf
install -D \ mkdir --parents $(DESTDIR)$(UNITDIR)
--target-directory="$(DESTDIR)$(SYSCONFDIR)/$(NAME)" \ install systemd/netoik-api-server.service $(DESTDIR)$(UNITDIR)/netoik-api-server.service
server.conf.sample mkdir --parents $(DESTDIR)$(BINDIR)
install -D \ install bin/server $(DESTDIR)$(BINDIR)/$(NAME)-server
--target-directory="$(DESTDIR)$(UNITDIR)" \
systemd/netoik-api-server.service
install -D \
--no-target-directory \
bin/server \
"$(DESTDIR)$(BINDIR)/$(NAME)-server"
install --directory "$(DESTDIR)$(VARDIR)/$(NAME)/captcha"
.PHONY: check_format
check_format:
gofmt -d -e cmd/ pkg/
.PHONY: check_linting
check_linting:
@echo "Not implemented!"
.PHONY: unit_test
unit_test:
@echo "Not implemented!"

View File

@ -26,33 +26,25 @@ Netoik rest API server
%make_install %make_install
%pre %pre
# Create user only if not already exisiting. useradd --no-create-home --system --user-group %{name}
id %{name} || useradd --no-create-home --shell=%{_sbindir}/nologin --user-group %{name}
%post %post
# Reload systemctl daemon and (re)start service. systemctl stop %{name}-server.service
systemctl daemon-reload systemctl daemon-reload
systemctl restart %{name}-server.service systemctl start %{name}-server.service
systemctl enable %{name}-server.service
%preun %preun
# Stop service only if uninstalling. systemctl stop %{name}-server.service
if [ $1 -eq 0 ]; then
systemctl disable --now %{name}-server.service
fi
%postun %postun
# Reload systemctl daemon and remove netoik-api user only if uninstalling. systemctl daemon-reload
if [ $1 -eq 0 ]; then userdel %{name}
systemctl daemon-reload
userdel %{name}
fi
%files %files
%attr(755, root, root) %dir %{_var}/%{name} %attr(755, root, root) %dir %{_var}/%{name}
%attr(755, %{name}, %{name}) %dir %{_var}/%{name}/captcha %attr(755, %{name}, %{name}) %dir %{_var}/%{name}/captcha
%attr(755, root, root) %dir %{_sysconfdir}/%{name} %attr(755, root, root) %dir %{_sysconfdir}/%{name}
%attr(644, root, root) %{_sysconfdir}/%{name}/server.conf.sample %attr(644, root, root) %{_sysconfdir}/%{name}/server.conf.sample
%attr(640, root, %{name}) %config(noreplace) %{_sysconfdir}/%{name}/server.conf %attr(644, root, root) %config(noreplace) %{_sysconfdir}/%{name}/server.conf
%attr(644, root, root) %{_unitdir}/%{name}-server.service %attr(644, root, root) %{_unitdir}/%{name}-server.service
%attr(755, root, root) %{_bindir}/%{name}-server %attr(755, root, root) %{_bindir}/%{name}-server