Migrate to systemd.
This commit is contained in:
parent
879744783c
commit
5db2e5a277
1
memcached-tmpfiles.conf
Normal file
1
memcached-tmpfiles.conf
Normal file
@ -0,0 +1 @@
|
|||||||
|
D /var/run/memcached/memcached 0710 memcached memcached -
|
13
memcached.service
Normal file
13
memcached.service
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Memcached
|
||||||
|
Before=httpd.service
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=forking
|
||||||
|
EnvironmentFile=-/etc/sysconfig/memcached
|
||||||
|
PIDFile=/var/run/memcached/memcached.pid
|
||||||
|
ExecStart=/usr/bin/memcached -d -u $USER -P /var/run/memcached/memcached.pid -p $PORT -m $CACHESIZE -c $MAXCONN $OPTIONS
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
Name: memcached
|
Name: memcached
|
||||||
Version: 1.4.13
|
Version: 1.4.13
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
Epoch: 0
|
Epoch: 0
|
||||||
Summary: High Performance, Distributed Memory Object Cache
|
Summary: High Performance, Distributed Memory Object Cache
|
||||||
|
|
||||||
@ -12,8 +12,9 @@ License: BSD
|
|||||||
URL: http://www.memcached.org/
|
URL: http://www.memcached.org/
|
||||||
Source0: http://memcached.googlecode.com/files/%{name}-%{version}.tar.gz
|
Source0: http://memcached.googlecode.com/files/%{name}-%{version}.tar.gz
|
||||||
|
|
||||||
# custom init script
|
# custom unit file
|
||||||
Source1: memcached.sysv
|
Source1: memcached.service
|
||||||
|
Source2: %{name}-tmpfiles.conf
|
||||||
|
|
||||||
# Patches
|
# Patches
|
||||||
|
|
||||||
@ -24,11 +25,13 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
|||||||
BuildRequires: libevent-devel
|
BuildRequires: libevent-devel
|
||||||
BuildRequires: perl(Test::More)
|
BuildRequires: perl(Test::More)
|
||||||
|
|
||||||
Requires: initscripts
|
Requires(post): systemd-units
|
||||||
|
Requires(preun): systemd-units
|
||||||
|
Requires(postun): systemd-units
|
||||||
|
# For triggerun
|
||||||
|
Requires(post): systemd-sysv
|
||||||
Requires(pre): shadow-utils
|
Requires(pre): shadow-utils
|
||||||
Requires(post): /sbin/chkconfig
|
|
||||||
Requires(preun): /sbin/chkconfig, /sbin/service
|
|
||||||
Requires(postun): /sbin/service
|
|
||||||
|
|
||||||
# as of 3.5.5-4 selinux has memcache included
|
# as of 3.5.5-4 selinux has memcache included
|
||||||
Obsoletes: memcached-selinux
|
Obsoletes: memcached-selinux
|
||||||
@ -76,8 +79,8 @@ rm -f %{buildroot}/%{_bindir}/memcached-debug
|
|||||||
# Perl script for monitoring memcached
|
# Perl script for monitoring memcached
|
||||||
install -Dp -m0755 scripts/memcached-tool %{buildroot}%{_bindir}/memcached-tool
|
install -Dp -m0755 scripts/memcached-tool %{buildroot}%{_bindir}/memcached-tool
|
||||||
|
|
||||||
# Init script
|
# Unit file
|
||||||
install -Dp -m0755 %{SOURCE1} %{buildroot}%{_initrddir}/memcached
|
install -Dp -m0644 %{SOURCE1} %{buildroot}%{_unitdir}/memcached.service
|
||||||
|
|
||||||
# Default configs
|
# Default configs
|
||||||
mkdir -p %{buildroot}/%{_sysconfdir}/sysconfig
|
mkdir -p %{buildroot}/%{_sysconfdir}/sysconfig
|
||||||
@ -93,7 +96,10 @@ EOF
|
|||||||
touch -r %{SOURCE1} %{buildroot}/%{_sysconfdir}/sysconfig/%{name}
|
touch -r %{SOURCE1} %{buildroot}/%{_sysconfdir}/sysconfig/%{name}
|
||||||
|
|
||||||
# pid directory
|
# pid directory
|
||||||
mkdir -p %{buildroot}/%{_localstatedir}/run/memcached
|
mkdir -p %{buildroot}%{_localstatedir}/run/memcached
|
||||||
|
|
||||||
|
mkdir -p %{buildroot}%{_sysconfdir}/tmpfiles.d
|
||||||
|
install -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/tmpfiles.d/%{name}.conf
|
||||||
|
|
||||||
%clean
|
%clean
|
||||||
rm -rf %{buildroot}
|
rm -rf %{buildroot}
|
||||||
@ -108,22 +114,36 @@ exit 0
|
|||||||
|
|
||||||
|
|
||||||
%post
|
%post
|
||||||
/sbin/chkconfig --add %{name}
|
if [ $1 -eq 1 ] ; then
|
||||||
|
# Initial installation
|
||||||
|
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
%preun
|
%preun
|
||||||
if [ "$1" = 0 ] ; then
|
if [ $1 -eq 0 ] ; then
|
||||||
/sbin/service %{name} stop > /dev/null 2>&1
|
# Package removal, not upgrade
|
||||||
/sbin/chkconfig --del %{name}
|
/bin/systemctl --no-reload disable memcached.service > /dev/null 2>&1 || :
|
||||||
|
/bin/systemctl stop memcached.service > /dev/null 2>&1 || :
|
||||||
fi
|
fi
|
||||||
exit 0
|
|
||||||
|
|
||||||
|
|
||||||
%postun
|
%postun
|
||||||
if [ "$1" -ge 1 ]; then
|
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||||
/sbin/service %{name} condrestart > /dev/null 2>&1
|
if [ $1 -ge 1 ] ; then
|
||||||
|
# Package upgrade, not uninstall
|
||||||
|
/bin/systemctl try-restart memcached.service >/dev/null 2>&1 || :
|
||||||
fi
|
fi
|
||||||
exit 0
|
|
||||||
|
%triggerun -- memcached < 0:1.4.13-2
|
||||||
|
# Save the current service runlevel info
|
||||||
|
# User must manually run systemd-sysv-convert --apply memcached
|
||||||
|
# to migrate them to systemd targets
|
||||||
|
/usr/bin/systemd-sysv-convert --save memcached >/dev/null 2>&1 ||:
|
||||||
|
|
||||||
|
# Run these because the SysV package being removed won't do them
|
||||||
|
/sbin/chkconfig --del memcached >/dev/null 2>&1 || :
|
||||||
|
/bin/systemctl try-restart memcached.service >/dev/null 2>&1 || :
|
||||||
|
|
||||||
|
|
||||||
%files
|
%files
|
||||||
@ -131,11 +151,12 @@ exit 0
|
|||||||
%doc AUTHORS ChangeLog COPYING NEWS README doc/CONTRIBUTORS doc/*.txt
|
%doc AUTHORS ChangeLog COPYING NEWS README doc/CONTRIBUTORS doc/*.txt
|
||||||
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
|
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
|
||||||
|
|
||||||
%ghost %dir %attr(755,%{username},%{groupname}) %{_localstatedir}/run/memcached
|
%dir %attr(755,%{username},%{groupname}) %{_localstatedir}/run/memcached
|
||||||
%{_bindir}/memcached-tool
|
%{_bindir}/memcached-tool
|
||||||
%{_bindir}/memcached
|
%{_bindir}/memcached
|
||||||
%{_mandir}/man1/memcached.1*
|
%{_mandir}/man1/memcached.1*
|
||||||
%{_initrddir}/memcached
|
%{_unitdir}/memcached.service
|
||||||
|
%config(noreplace) %{_sysconfdir}/tmpfiles.d/%{name}.conf
|
||||||
|
|
||||||
|
|
||||||
%files devel
|
%files devel
|
||||||
@ -143,6 +164,9 @@ exit 0
|
|||||||
%{_includedir}/memcached/*
|
%{_includedir}/memcached/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri May 04 2012 Jon Ciesla <limburgher@gmail.com> - 0:1.4.13-2
|
||||||
|
- Migrate to systemd, 783112.
|
||||||
|
|
||||||
* Tue Feb 7 2012 Paul Lindner <lindner@mirth.inuus.com> - 0:1.4.13-1
|
* Tue Feb 7 2012 Paul Lindner <lindner@mirth.inuus.com> - 0:1.4.13-1
|
||||||
- Upgrade to memcached 1.4.13
|
- Upgrade to memcached 1.4.13
|
||||||
- http://code.google.com/p/memcached/wiki/ReleaseNotes1413
|
- http://code.google.com/p/memcached/wiki/ReleaseNotes1413
|
||||||
|
Loading…
Reference in New Issue
Block a user