use upstream unit file (#1350939)

This commit is contained in:
Miroslav Lichvar 2016-07-12 14:06:39 +02:00
parent 85446a9e23
commit ea0733a371
4 changed files with 22 additions and 26 deletions

11
memcached-unit.patch Normal file
View File

@ -0,0 +1,11 @@
diff -up memcached-1.4.28/scripts/memcached.service.unit memcached-1.4.28/scripts/memcached.service
--- memcached-1.4.28/scripts/memcached.service.unit 2016-07-02 03:14:25.000000000 +0200
+++ memcached-1.4.28/scripts/memcached.service 2016-07-12 13:54:54.275782170 +0200
@@ -9,6 +9,7 @@
[Unit]
Description=memcached daemon
+Before=httpd.service
After=network.target
[Service]

View File

@ -1,12 +0,0 @@
[Unit]
Description=Memcached
Before=httpd.service
After=network.target
[Service]
Type=simple
EnvironmentFile=-/etc/sysconfig/memcached
ExecStart=/usr/bin/memcached -u $USER -p $PORT -m $CACHESIZE -c $MAXCONN $OPTIONS
[Install]
WantedBy=multi-user.target

View File

@ -12,9 +12,9 @@ Group: System Environment/Daemons
License: BSD
URL: http://www.memcached.org/
Source0: http://www.memcached.org/files/%{name}-%{version}.tar.gz
Source1: memcached.sysconfig
# custom unit file
Source1: memcached.service
Patch1: memcached-unit.patch
BuildRequires: libevent-devel systemd-units
BuildRequires: perl-generators
@ -42,6 +42,7 @@ access to the memcached binary include files.
%prep
%setup -q
%patch1 -p1 -b .unit
%build
# compile with full RELRO
@ -76,20 +77,11 @@ install -Dp -m0644 scripts/memcached-tool.1 \
%{buildroot}%{_mandir}/man1/memcached-tool.1
# Unit file
install -Dp -m0644 %{SOURCE1} %{buildroot}%{_unitdir}/memcached.service
install -Dp -m0644 scripts/memcached.service \
%{buildroot}%{_unitdir}/memcached.service
# Default configs
mkdir -p %{buildroot}/%{_sysconfdir}/sysconfig
cat <<EOF >%{buildroot}/%{_sysconfdir}/sysconfig/%{name}
PORT="11211"
USER="%{username}"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS=""
EOF
# Constant timestamp on the config file.
touch -r %{SOURCE1} %{buildroot}/%{_sysconfdir}/sysconfig/%{name}
install -Dp -m0644 %{SOURCE1} %{buildroot}/%{_sysconfdir}/sysconfig/%{name}
%pre

5
memcached.sysconfig Normal file
View File

@ -0,0 +1,5 @@
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS=""