Changes of Revision 8
[-] | Changed | memcached.spec |
x 1
2 -%define selinux_variants mls strict targeted 3 -%define selinux_policyver %(sed -e 's,.*selinux-policy-\\([^/]*\\)/.*,\\1,' /usr/share/selinux/devel/policyhelp) 4 -%define modulename memcached 5 - 6 -%define username memcached 7 -%define groupname memcached 8 - 9 Name: memcached 10 Version: 1.4.1 11 -Release: 1 12 +Release: 1%{?dist} 13 Summary: High Performance, Distributed Memory Object Cache 14 15 Group: System Environment/Daemons 16 License: BSD 17 URL: http://www.danga.com/memcached/ 18 Source0: http://www.danga.com/memcached/dist/%{name}-%{version}.tar.gz 19 - 20 -# custom init script 21 -Source1: memcached.sysv 22 - 23 -# SELinux files 24 -Source10: %{modulename}.te 25 -Source11: %{modulename}.fc 26 -Source12: %{modulename}.if 27 - 28 -# Fixes 29 - 30 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 31 32 BuildRequires: libevent-devel 33 BuildRequires: perl(Test::More) 34 - 35 Requires: initscripts 36 -Requires: libevent 37 -Requires(pre): shadow-utils 38 Requires(post): /sbin/chkconfig 39 Requires(preun): /sbin/chkconfig, /sbin/service 40 Requires(postun): /sbin/service 41
42 system, generic in nature, but intended for use in speeding up dynamic 43 web applications by alleviating database load. 44 45 - 46 -%package selinux 47 -Summary: SELinux policy module supporting memcached 48 -Group: System Environment/Base 49 -BuildRequires: checkpolicy, selinux-policy-devel, hardlink 50 -%if "%{selinux_policyver}" != "" 51 -Requires: selinux-policy >= %{selinux_policyver} 52 -%endif 53 -Requires: %{name} = %{version}-%{release} 54 -Requires(post): policycoreutils 55 -Requires(postun): policycoreutils 56 - 57 -%description selinux 58 -SELinux policy module supporting memcached. 59 - 60 - 61 %prep 62 %setup -q 63 -mkdir SELinux 64 -cp -p %{SOURCE10} %{SOURCE11} %{SOURCE12} SELinux/ 65 66 67 %build 68
69 70 make %{?_smp_mflags} 71 72 -pushd SELinux 73 -for selinuxvariant in %{selinux_variants}; do 74 - make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile 75 - mv %{modulename}.pp %{modulename}.pp.${selinuxvariant} 76 - make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile clean 77 -done 78 -popd 79 - 80 - 81 %check 82 -# remove failing test that doesn't work in 83 -# build systems 84 -rm -f t/daemonize.t 85 - 86 -#make test 87 +make test 88 89 %install 90 rm -rf %{buildroot} 91 -make install DESTDIR=%{buildroot} INSTALL="%{__install} -p" 92 +make install DESTDIR=%{buildroot} 93 + 94 # remove memcached-debug 95 rm -f %{buildroot}/%{_bindir}/memcached-debug 96 97
98 install -Dp -m0755 scripts/memcached-tool %{buildroot}%{_bindir}/memcached-tool 99 100 # Init script 101 -install -Dp -m0755 %{SOURCE1} %{buildroot}%{_initrddir}/memcached 102 +install -Dp -m0755 scripts/memcached.sysv %{buildroot}%{_initrddir}/memcached 103 104 # Default configs 105 mkdir -p %{buildroot}/%{_sysconfdir}/sysconfig 106 cat <<EOF >%{buildroot}/%{_sysconfdir}/sysconfig/%{name} 107 PORT="11211" 108 -USER="%{username}" 109 +USER="nobody" 110 MAXCONN="1024" 111 CACHESIZE="64" 112 OPTIONS="" 113
114 # pid directory 115 mkdir -p %{buildroot}/%{_localstatedir}/run/memcached 116 117 -# Install SELinux policy modules 118 -pushd SELinux 119 -for selinuxvariant in %{selinux_variants}; do 120 - install -d %{buildroot}%{_datadir}/selinux/${selinuxvariant} 121 - install -p -m 644 %{modulename}.pp.${selinuxvariant} \ 122 - %{buildroot}%{_datadir}/selinux/${selinuxvariant}/%{modulename}.pp 123 -done 124 -popd 125 - 126 -# Hardlink identical policy module packages together 127 -/usr/sbin/hardlink -cv %{buildroot}%{_datadir}/selinux 128 - 129 - 130 %clean 131 rm -rf %{buildroot} 132 133 134 -%pre 135 -getent group %{groupname} >/dev/null || groupadd -r %{groupname} 136 -getent passwd %{username} >/dev/null || \ 137 -useradd -r -g %{groupname} -d %{_localstatedir}/run/memcached \ 138 - -s /sbin/nologin -c "Memcached daemon" %{username} 139 -exit 0 140 - 141 - 142 %post 143 /sbin/chkconfig --add %{name} 144 145 - 146 %preun 147 if [ "$1" = 0 ] ; then 148 /sbin/service %{name} stop > /dev/null 2>&1 149
150 fi 151 exit 0 152 153 - 154 %postun 155 if [ "$1" -ge 1 ]; then 156 /sbin/service %{name} condrestart > /dev/null 2>&1 157
158 exit 0 159 160 161 -%post selinux 162 -# Install SELinux policy modules 163 -for selinuxvariant in %{selinux_variants} 164 -do 165 - /usr/sbin/semodule -s ${selinuxvariant} -i \ 166 - %{_datadir}/selinux/${selinuxvariant}/%{modulename}.pp &> /dev/null || : 167 -done 168 -/usr/sbin/semanage port -a -t memcached_port_t -p tcp 11211 &> /dev/null || : 169 -/sbin/fixfiles -R %{name} restore || : 170 - 171 - 172 -%postun selinux 173 -# Clean up after package removal 174 -if [ $1 -eq 0 ]; then 175 - /usr/sbin/semanage port -d -t memcached_port_t -p tcp 11211 &> /dev/null || : 176 - # Remove SELinux policy modules 177 - for selinuxvariant in %{selinux_variants} 178 - do 179 - /usr/sbin/semodule -s ${selinuxvariant} -r %{modulename} &> /dev/null || : 180 - done 181 - /sbin/fixfiles -R %{name} restore || : 182 -fi 183 - 184 - 185 %files 186 %defattr(-,root,root,-) 187 %doc AUTHORS ChangeLog COPYING NEWS README TODO doc/CONTRIBUTORS doc/*.txt 188 -%config(noreplace) %{_sysconfdir}/sysconfig/%{name} 189 +%config(noreplace) %{_sysconfdir}/sysconfig/%{name} 190 191 %dir %attr(750,nobody,nobody) %{_localstatedir}/run/memcached 192 %{_bindir}/memcached-tool 193
194 %{_initrddir}/memcached 195 %{_includedir}/memcached 196 197 - 198 %changelog 199 -* Fri Jul 10 2009 Juergen Gotteswinter <jg@internetx.de> - 1.4.0-1 200 -- version bump to 1.4.0 201 |