WIP: ...
This commit is contained in:
parent
430258b6df
commit
ee3f297a88
11
Makefile
11
Makefile
@ -17,11 +17,11 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
NAME := "kf2-srv"
|
||||
NAME := kf2-srv
|
||||
|
||||
RPMBUILDDIR := "$$HOME/rpmbuild"
|
||||
ACTIVEDIR := $(shell readlink -e "$$HOME/rpmbuild")
|
||||
WORKDIR := $(shell readlink -e ".")
|
||||
RPMBUILDDIR := $$HOME/rpmbuild
|
||||
ACTIVEDIR := $(shell readlink -e $$HOME/rpmbuild)
|
||||
WORKDIR := $(shell readlink -e .)
|
||||
|
||||
BUILDDIR := $(WORKDIR)/BUILD
|
||||
BUILDROOTDIR := $(WORKDIR)/BUILDROOT
|
||||
@ -32,9 +32,8 @@ SRPMSDIR := $(WORKDIR)/SRPMS
|
||||
SCRIPTSDIR := $(SOURCESDIR)/scripts
|
||||
|
||||
SPEC := $(SPECSDIR)/$(NAME).spec
|
||||
SOURCETARBALL := $(SOURCESDIR)$(NAME)-$(VERSION).tar.gz
|
||||
|
||||
VERSION := $(shell grep -Fi 'Version:' $(SPEC) | awk '{ print $$2 }')
|
||||
SOURCETARBALL := $(SOURCESDIR)/$(NAME)-$(VERSION).tar.gz
|
||||
|
||||
.PHONY: all prep rpm srpm activate check-activate clean-tmp clean-pkg clean
|
||||
|
||||
|
121
SOURCES/Makefile
Normal file
121
SOURCES/Makefile
Normal file
@ -0,0 +1,121 @@
|
||||
# kf2-srv is a command line tool for managing a set of Killing Floor 2 servers.
|
||||
# Copyright (C) 2019, 2020 GenZmeY
|
||||
# mailto: genzmey@gmail.com
|
||||
#
|
||||
# This file is part of kf2-srv.
|
||||
#
|
||||
# kf2-srv is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
BASH := /bin/bash
|
||||
|
||||
NAME := kf2-srv
|
||||
|
||||
SOURCEDIR := .
|
||||
|
||||
MAINLOGDIR := /var/log/$(NAME)
|
||||
BETALOGDIR := /var/log/$(NAME)-beta
|
||||
CONFDIR := /etc/$(NAME)
|
||||
INSTMAINDIR := $(CONFDIR)/instances
|
||||
INSTBETADIR := $(CONFDIR)/instances-beta
|
||||
MAPCYCLEDIR := $(CONFDIR)/mapcycles
|
||||
CACHEDIR := /var/cache/$(NAME)
|
||||
LOGROTATEDIR := /etc/logrotate.d
|
||||
RSYSLOGDIR := /etc/rsyslog.d
|
||||
SERVICEDIR = $(if $(BUILDROOT),/lib/systemd/system,/etc/systemd/system)
|
||||
FIREWALLDDIR = $(if $(BUILDROOT),/lib/firewalld/services,/etc/firewalld/services)
|
||||
|
||||
BUILDROOT =
|
||||
PREFIX = /usr/local
|
||||
BINDIR = $(BUILDROOT)$(PREFIX)/bin
|
||||
SBINDIR = $(BUILDROOT)$(PREFIX)/sbin
|
||||
GAMEDIR = $(BUILDROOT)$(PREFIX)/games
|
||||
DATADIR = $(BUILDROOT)$(PREFIX)/share
|
||||
LICENSEDIR = $(DATADIR)/licenses/$(NAME)
|
||||
KF2MAINDIR = $(GAMEDIR)/$(NAME)
|
||||
KF2BETADIR = $(GAMEDIR)/$(NAME)-beta
|
||||
|
||||
.PHONY: all install uninstall filesystem
|
||||
|
||||
all: install
|
||||
|
||||
filesystem:
|
||||
test -d '$(CONFDIR)' || install -m 775 -d '$(CONFDIR)'
|
||||
test -d '$(INSTMAINDIR)' || install -m 775 -d '$(INSTMAINDIR)'
|
||||
test -d '$(INSTBETADIR)' || install -m 775 -d '$(INSTBETADIR)'
|
||||
test -d '$(MAPCYCLEDIR)' || install -m 775 -d '$(MAPCYCLEDIR)'
|
||||
test -d '$(CACHEDIR)' || install -m 775 -d '$(CACHEDIR)'
|
||||
test -d '$(BINDIR)' || install -m 755 -d '$(BINDIR)'
|
||||
test -d '$(SBINDIR)' || install -m 755 -d '$(SBINDIR)'
|
||||
test -d '$(KF2MAINDIR)' || install -m 775 -d '$(KF2MAINDIR)'
|
||||
test -d '$(KF2BETADIR)' || install -m 775 -d '$(KF2BETADIR)'
|
||||
test -d '$(LICENSEDIR)' || install -m 755 -d '$(LICENSEDIR)'
|
||||
test -d '$(MAINLOGDIR)' || install -m 770 -d '$(MAINLOGDIR)'
|
||||
test -d '$(BETALOGDIR)' || install -m 770 -d '$(BETALOGDIR)'
|
||||
test -d '$(SERVICEDIR)' || install -m 755 -d '$(SERVICEDIR)'
|
||||
test -d '$(FIREWALLDDIR)' || install -m 755 -d '$(FIREWALLDDIR)'
|
||||
test -d '$(LOGROTATEDIR)' || install -m 755 -d '$(LOGROTATEDIR)'
|
||||
test -d '$(RSYSLOGDIR)' || install -m 755 -d '$(RSYSLOGDIR)'
|
||||
|
||||
install: filesystem
|
||||
install -m 755 $(SOURCEDIR)/main/$(NAME) $(BINDIR)
|
||||
install -m 755 $(SOURCEDIR)/main/$(NAME)-beta $(BINDIR)
|
||||
|
||||
install -m 644 $(SOURCEDIR)/main/systemd/$(NAME)@.service $(SERVICEDIR)
|
||||
install -m 644 $(SOURCEDIR)/main/systemd/$(NAME)-beta@.service $(SERVICEDIR)
|
||||
install -m 644 $(SOURCEDIR)/main/systemd/$(NAME)-beta-update.service $(SERVICEDIR)
|
||||
install -m 644 $(SOURCEDIR)/main/systemd/$(NAME)-beta-update.timer $(SERVICEDIR)
|
||||
install -m 644 $(SOURCEDIR)/main/systemd/$(NAME)-update.service $(SERVICEDIR)
|
||||
install -m 644 $(SOURCEDIR)/main/systemd/$(NAME)-update.timer $(SERVICEDIR)
|
||||
|
||||
install -m 644 $(SOURCESIR)/main/firewalld/$(NAME).xml $(FIREWALLDDIR)
|
||||
install -m 644 $(SOURCESIR)/main/logrotate/$(NAME) $(LOGROTATEDIR)
|
||||
install -m 644 $(SOURCESIR)/main/rsyslog/$(NAME).conf $(RSYSLOGDIR)
|
||||
|
||||
install -m 755 $(SOURCEDIR)/force-attr/$(NAME)-force-attr $(SBINDIR)
|
||||
install -m 755 $(SOURCEDIR)/force-attr/systemd/$(NAME)-force-attr.service $(SERVICEDIR)
|
||||
|
||||
install -m 644 $(SOURCEDIR)/conf/bot.conf $(CONFDIR)
|
||||
install -m 644 $(SOURCEDIR)/conf/instance.conf.template $(CONFDIR)
|
||||
install -m 644 $(SOURCEDIR)/conf/$(NAME).conf $(CONFDIR)
|
||||
|
||||
install -m 644 $(SOURCEDIR)/COPYING $(LICENSEDIR)
|
||||
|
||||
uninstall:
|
||||
rm -f $(BINDIR)/$(NAME)
|
||||
rm -f $(BINDIR)/$(NAME)-beta
|
||||
|
||||
rm -f $(SERVICEDIR)/$(NAME)@.service
|
||||
rm -f $(SERVICEDIR)/$(NAME)-beta@.service
|
||||
rm -f $(SERVICEDIR)/$(NAME)-beta-update.service
|
||||
rm -f $(SERVICEDIR)/$(NAME)-beta-update.timer
|
||||
rm -f $(SERVICEDIR)/$(NAME)-update.service
|
||||
rm -f $(SERVICEDIR)/$(NAME)-update.timer
|
||||
|
||||
rm -f $(FIREWALLDDIR)/$(NAME).xml
|
||||
rm -f $(LOGROTATEDIR)/$(NAME)
|
||||
rm -f $(RSYSLOGDIR)/$(NAME).conf
|
||||
|
||||
rm -f $(SBINDIR)/$(NAME)-force-attr
|
||||
rm -f $(SERVICEDIR)/$(NAME)-force-attr.service
|
||||
|
||||
rm -rf $(LICENSEDIR)
|
||||
rm -rf $(KF2MAINDIR)
|
||||
rm -rf $(KF2BETADIR)
|
||||
rm -rf $(CACHEDIR)
|
||||
|
||||
test:
|
||||
$(BASH) -n $(BINDIR)/$(NAME)
|
||||
$(BASH) -n $(BINDIR)/$(NAME)-beta
|
||||
$(BASH) -n $(SBINDIR)/$(NAME)-force-attr
|
||||
|
@ -9,23 +9,6 @@ License: GNU GPLv3
|
||||
BuildArch: noarch
|
||||
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
Source1: %{name}
|
||||
Source2: %{name}-beta
|
||||
Source3: %{name}.xml
|
||||
Source4: %{name}@.service
|
||||
Source5: %{name}-update.service
|
||||
Source6: %{name}-update.timer
|
||||
Source7: instance.conf.template
|
||||
Source8: %{name}-beta@.service
|
||||
Source9: %{name}-beta-update.service
|
||||
Source10: %{name}-beta-update.timer
|
||||
Source11: %{name}.conf
|
||||
Source12: COPYING
|
||||
Source13: rsyslog-%{name}.conf
|
||||
Source14: logrotate-%{name}
|
||||
Source15: bot.conf
|
||||
Source16: %{name}-force-attr
|
||||
Source17: %{name}-force-attr.service
|
||||
|
||||
Requires: systemd >= 219
|
||||
Requires: steamcmd
|
||||
@ -50,50 +33,17 @@ Provides: %{name}
|
||||
Command line tool for managing a set of Killing Floor 2 servers.
|
||||
|
||||
%prep
|
||||
%setup -q -c
|
||||
|
||||
%build
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
install -d %{buildroot}/%{_bindir}
|
||||
install -d %{buildroot}/%{_sbindir}
|
||||
install -d %{buildroot}/%{_prefix}/lib/systemd/system
|
||||
install -d %{buildroot}/%{_prefix}/lib/firewalld/services
|
||||
install -d %{buildroot}/%{_sysconfdir}/%{name}/instances
|
||||
install -d %{buildroot}/%{_sysconfdir}/%{name}/instances-beta
|
||||
install -d %{buildroot}/%{_sysconfdir}/%{name}/mapcycles
|
||||
install -d %{buildroot}/%{_sysconfdir}/rsyslog.d
|
||||
install -d %{buildroot}/%{_sysconfdir}/logrotate.d
|
||||
install -d %{buildroot}/%{_prefix}/games/%{name}
|
||||
install -d %{buildroot}/%{_prefix}/games/%{name}-beta
|
||||
install -d %{buildroot}/%{_datadir}/licenses/%{name}
|
||||
install -d %{buildroot}/%{_localstatedir}/log/%{name}
|
||||
install -d %{buildroot}/%{_localstatedir}/log/%{name}-beta
|
||||
install -d %{buildroot}/%{_localstatedir}/cache/kf2-srv
|
||||
|
||||
# access rights are used here to prevent warnings when building the package
|
||||
install -m 755 %{SOURCE1} %{buildroot}/%{_bindir}
|
||||
install -m 755 %{SOURCE2} %{buildroot}/%{_bindir}
|
||||
install -m 644 %{SOURCE3} %{buildroot}/%{_prefix}/lib/firewalld/services
|
||||
install -m 644 %{SOURCE4} %{buildroot}/%{_prefix}/lib/systemd/system
|
||||
install -m 644 %{SOURCE5} %{buildroot}/%{_prefix}/lib/systemd/system
|
||||
install -m 644 %{SOURCE6} %{buildroot}/%{_prefix}/lib/systemd/system
|
||||
install -m 644 %{SOURCE7} %{buildroot}/%{_sysconfdir}/%{name}
|
||||
install -m 644 %{SOURCE8} %{buildroot}/%{_prefix}/lib/systemd/system
|
||||
install -m 644 %{SOURCE9} %{buildroot}/%{_prefix}/lib/systemd/system
|
||||
install -m 644 %{SOURCE10} %{buildroot}/%{_prefix}/lib/systemd/system
|
||||
install -m 644 %{SOURCE11} %{buildroot}/%{_sysconfdir}/%{name}
|
||||
install -m 644 %{SOURCE12} %{buildroot}/%{_datadir}/licenses/%{name}
|
||||
install -m 644 %{SOURCE13} %{buildroot}/%{_sysconfdir}/rsyslog.d/%{name}.conf
|
||||
install -m 644 %{SOURCE14} %{buildroot}/%{_sysconfdir}/logrotate.d/%{name}
|
||||
install -m 644 %{SOURCE15} %{buildroot}/%{_sysconfdir}/%{name}
|
||||
install -m 755 %{SOURCE16} %{buildroot}/%{_sbindir}
|
||||
install -m 644 %{SOURCE17} %{buildroot}/%{_prefix}/lib/systemd/system
|
||||
make install PREFIX=%{buildroot}/%{_prefix}
|
||||
|
||||
%check
|
||||
bash -n %{buildroot}/%{_bindir}/%{name}
|
||||
bash -n %{buildroot}/%{_bindir}/%{name}-beta
|
||||
make test PREFIX=%{buildroot}/%{_prefix}
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
Loading…
Reference in New Issue
Block a user