]>
Commit | Line | Data |
---|---|---|
a8bf9720 AF |
1 | # PLD rpm macros |
2 | ||
90c0eaed | 3 | %epoch 0 |
31b569b6 | 4 | %x8664 x86_64 amd64 ia32e |
cd33aab7 | 5 | |
a544555d | 6 | # kernel compiler |
cabacfeb | 7 | %kgcc gcc |
8 | %kgcc_package gcc | |
a544555d | 9 | |
31b569b6 ER |
10 | %_source_payload w9.gzdio |
11 | %_binary_payload w9.bzdio | |
12 | ||
5f9f9bd7 | 13 | # Build system path macros. |
14 | # | |
8af1c6f5 JB |
15 | %__autoconf autoconf %{?debug:-Wall} |
16 | %__automake automake -a -c -f --foreign | |
429d047e | 17 | %__autopoint autopoint --force |
18 | ||
aad1c8e4 | 19 | %__gettextize { \ |
31b569b6 | 20 | if ! gettextize --version | grep -q '0\.10\.' ; then \ |
4cd84746 | 21 | if grep -qs 'AM_GNU_GETTEXT.*external' configure.{ac,in} ; then \ |
31b569b6 | 22 | gettextize --copy --force --no-changelog; \ |
93bce43f | 23 | else \ |
31b569b6 | 24 | gettextize --copy --force --no-changelog --intl; \ |
4cd84746 JB |
25 | fi; \ |
26 | if [ ! -f po/Makevars ]; then \ | |
31b569b6 | 27 | cp -f po/Makevars{.template,}; \ |
4cd84746 | 28 | fi; \ |
31b569b6 | 29 | else \ |
4cd84746 | 30 | gettextize --copy --force; \ |
31b569b6 | 31 | fi; \ |
4cd84746 | 32 | } |
429d047e | 33 | |
34 | %__glib_gettextize glib-gettextize --copy --force | |
35 | %__gnome_doc_common gnome-doc-common --copy | |
36 | %__gtkdocize gtkdocize --copy | |
37 | %__intltoolize intltoolize --copy --force | |
38 | %__libtoolize libtoolize --copy --force | |
5f9f9bd7 | 39 | |
bd1cd543 | 40 | %dependencytracking %{nil} |
31b569b6 | 41 | |
cd33aab7 | 42 | #----------------------------------------------------------------- |
9f0287b5 | 43 | %configure2_13 { \ |
cd33aab7 AM |
44 | if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \ |
45 | LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \ | |
46 | CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \ | |
af18d245 | 47 | CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" ; export CXXFLAGS ; \ |
cd33aab7 | 48 | FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \ |
c55f2219 | 49 | CPPFLAGS="${CPPFLAGS:-}" ; export CPPFLAGS ; \ |
4eac2e49 AM |
50 | %{?__cc:CC="%{__cc}" ; export CC ; } \ |
51 | %{?__cxx:CXX="%{__cxx}" ; export CXX ; } \ | |
5b0f0ac9 | 52 | %{?configuredir:%{configuredir}}%{!?configuredir:.}/configure \ |
fa74a11c | 53 | --host=%{_target_platform} \ |
cd33aab7 AM |
54 | --prefix=%{_prefix} \ |
55 | --exec-prefix=%{_exec_prefix} \ | |
56 | --bindir=%{_bindir} \ | |
57 | --sbindir=%{_sbindir} \ | |
58 | --sysconfdir=%{_sysconfdir} \ | |
59 | --datadir=%{_datadir} \ | |
60 | --includedir=%{_includedir} \ | |
61 | --libdir=%{_libdir} \ | |
62 | --libexecdir=%{_libexecdir} \ | |
63 | --localstatedir=%{_localstatedir} \ | |
64 | --sharedstatedir=%{_sharedstatedir} \ | |
65 | --mandir=%{_mandir} \ | |
66 | --infodir=%{_infodir} \ | |
72d080a8 | 67 | --x-libraries=/usr/X11R6/%{_lib} \ |
8b4be1e1 | 68 | %{dependencytracking} \ |
cd33aab7 AM |
69 | } |
70 | ||
85f82bec | 71 | #---------------------------------------------------------------- |
7e4e3f2b | 72 | %global configure_cache 0 |
73 | %configure_cache_file %{buildroot}.configure.cache | |
74 | ||
b8cf6778 | 75 | %configure {./configure \ |
85f82bec AF |
76 | LDFLAGS="${LDFLAGS:-%rpmldflags}" \ |
77 | CFLAGS="${CFLAGS:-%rpmcflags}" \ | |
af18d245 | 78 | CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" \ |
85f82bec | 79 | FFLAGS="${FFLAGS:-%rpmcflags}" \ |
418d9760 | 80 | CPPFLAGS="${CPPFLAGS:-}" \ |
4eac2e49 AM |
81 | %{?__cc:CC="%{__cc}"} \ |
82 | %{?__cxx:CXX="%{__cxx}"} \ | |
a9bea0f7 | 83 | --host=%{_target_platform} \ |
85f82bec AF |
84 | --build=%{_target_platform} \ |
85 | --prefix=%{_prefix} \ | |
86 | --exec-prefix=%{_exec_prefix} \ | |
87 | --bindir=%{_bindir} \ | |
88 | --sbindir=%{_sbindir} \ | |
89 | --sysconfdir=%{_sysconfdir} \ | |
90 | --datadir=%{_datadir} \ | |
91 | --includedir=%{_includedir} \ | |
92 | --libdir=%{_libdir} \ | |
93 | --libexecdir=%{_libexecdir} \ | |
94 | --localstatedir=%{_localstatedir} \ | |
95 | --sharedstatedir=%{_sharedstatedir} \ | |
96 | --mandir=%{_mandir} \ | |
97 | --infodir=%{_infodir} \ | |
72d080a8 | 98 | --x-libraries=/usr/X11R6/%{_lib} \ |
8b4be1e1 | 99 | %{dependencytracking} \ |
7e4e3f2b | 100 | %{?configure_cache:--cache-file=%{configure_cache_file:-%{buildroot}.configure.cache}} \ |
85f82bec AF |
101 | } |
102 | ||
617b7266 | 103 | # ------------------------------------------------------------------------ |
a0bade1c AM |
104 | # Overloading of some basic macros |
105 | %prep \ | |
106 | %%prep\ | |
107 | LANG=C\ | |
108 | export LANG\ | |
7febf367 | 109 | unset DISPLAY ||:\ |
7507b4fa | 110 | unset LINGUAS ||:\ |
a0bade1c AM |
111 | %{nil} |
112 | ||
113 | %build %%build\ | |
114 | LANG=C\ | |
115 | export LANG\ | |
7febf367 | 116 | unset DISPLAY ||:\ |
7507b4fa | 117 | unset LINGUAS ||:\ |
a0bade1c AM |
118 | %{nil} |
119 | ||
1fcb29e9 ER |
120 | %install \ |
121 | %if 0%{?_enable_debug_packages}\ | |
122 | %{?buildsubdir:%{debug_package}}\ | |
123 | %endif\ | |
a0bade1c AM |
124 | %%install\ |
125 | LANG=C\ | |
126 | export LANG\ | |
7febf367 | 127 | unset DISPLAY ||:\ |
7507b4fa | 128 | unset LINGUAS ||:\ |
a0bade1c AM |
129 | %{nil} |
130 | ||
cd33aab7 AM |
131 | # Location of autoconf macros |
132 | %_aclocaldir %(aclocal --print-ac-dir) | |
133 | ||
32720a50 AM |
134 | # Location of omf files |
135 | %_omf_dest_dir %(scrollkeeper-config --omfdir) | |
136 | ||
c5eece2c | 137 | # Location of pkgconfig files |
a46897a7 | 138 | %_pkgconfigdir /usr/%{_lib}/pkgconfig |
c5eece2c | 139 | |
c917274d | 140 | # Location of desktop files |
141 | %_desktopdir /usr/share/applications | |
510f694c | 142 | %_applnkdir ERROR:_applnkdir_is_obsolete_use_desktopdir_instead |
c917274d | 143 | |
fb08fb4a | 144 | # Location of pixmaps for applnk/desktop files |
3a9bb008 | 145 | %_pixmapsdir /usr/share/pixmaps |
cd33aab7 | 146 | |
fb08fb4a | 147 | # Location of themable icons for applnk/desktop files |
986c3bcd | 148 | %_iconsdir /usr/share/icons |
149 | ||
c5eece2c JB |
150 | # Location of fonts directories |
151 | %_fontsdir /usr/share/fonts | |
152 | ||
5cfcbc9e | 153 | # Location of Gtk and associated libraries documentation |
e9f33a26 | 154 | %_gtkdocdir %{_defaultdocdir}/gtk-doc/html |
5cfcbc9e | 155 | |
eee08b2d | 156 | # Location of KDE documentation |
157 | %_kdedocdir %{_defaultdocdir}/kde/HTML | |
158 | ||
a7cad6ae | 159 | # unsermake script |
160 | %__unsermake /usr/share/unsermake/unsermake | |
161 | ||
cd33aab7 AM |
162 | # Current date |
163 | %date %(LC_ALL="C" date +"%a %b %d %Y") | |
164 | ||
165 | # tmp directory | |
166 | %tmpdir %(echo "${TMPDIR:-/tmp}") | |
167 | ||
168 | # Example files, programs, scripts... | |
169 | %_examplesdir /usr/src/examples | |
170 | ||
bd63739a | 171 | # The directory holding Linux kernel sources |
172 | %_kernelsrcdir /usr/src/linux | |
173 | ||
cd33aab7 | 174 | # If non-empty "debug" macro defined, add "dbg" suffix to release number |
5b0f0ac9 | 175 | %_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm |
cd33aab7 | 176 | |
5b0f0ac9 | 177 | # Requires name = version-release |
5237e419 | 178 | %requires_releq() %(echo '%*' | LC_ALL="C" xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}-%%{release}\\n' | sed -e 's/ (none):/ /' | grep -v "is not") |
511ee4c6 | 179 | |
47fa9979 PS |
180 | %releq_kernel_up() %(LC_ALL="C" rpm -qf --qf '%%{name}-up = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | sed -e 's:-headers::' | grep -vE "(is not|no such)") |
181 | %releq_kernel_smp() %(LC_ALL="C" rpm -qf --qf '%%{name}-smp = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | sed -e 's:-headers::' | grep -vE "(is not|no such)") | |
182 | %requires_releq_kernel_up() %(LC_ALL="C" rpm -qf --qf 'PreReq: %%{name}-up = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | sed -e 's:-headers::' | grep -vE "(is not|no such)") | |
183 | %requires_releq_kernel_smp() %(LC_ALL="C" rpm -qf --qf 'PreReq: %%{name}-smp = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | sed -e 's:-headers::' | grep -vE "(is not|no such)") | |
511ee4c6 | 184 | |
d0bdd45a | 185 | %requires_eq_to() %(LC_ALL="C" rpm -q --qf 'Requires: %1 = %%{epoch}:%%{version}\\n' %2 | sed -e 's/ (none):/ /' | grep -v "is not") |
e478b9e7 | 186 | |
6f3d2288 | 187 | %apache_modules_api %(awk '/#define MODULE_MAGIC_NUMBER_MAJOR/ {print $3}' /usr/include/apache/ap_mmn.h 2>/dev/null || echo ERROR) |
8dea1306 | 188 | |
189 | # kernel version-release handling | |
31b569b6 ER |
190 | %__kernel_ver %([ -f %{_kernelsrcdir}/include/linux/version.h ] && (grep UTS_RELEASE %{_kernelsrcdir}/include/linux/version.h 2>/dev/null | head -n 1 | cut -d'"' -f2) || (awk '/^VERSION/ { ver = $0; gsub(/VERSION.*=/, NIL, ver); } /^PATCHLEVEL/ { plev = $0; gsub(/PATCHLEVEL.*=/, NIL, plev); } /^SUBLEVEL/ { slev = $0; gsub(/SUBLEVEL.*=/, NIL, slev); } /^EXTRAVERSION/ { ever = $0; gsub(/EXTRAVERSION.*=/, NIL, ever); gsub(/ /, NIL, ever); } END { printf("%d.%d.%d%s", ver, plev, slev, ever); }' %{_kernelsrcdir}/Makefile 2> /dev/null)) |
191 | %__kernel_rel %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h 2>/dev/null --qf "%{RELEASE}" | grep -v "is not") | |
ed0057d9 | 192 | %__kernel_rpmvr %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h 2>/dev/null --qf "%{VERSION}-%{RELEASE}" | grep -v "is not") |
31b569b6 | 193 | %_kernel_ver %{__kernel_ver}%{?with_dist_kernel:%(echo %{__kernel_ver} | grep -q -e - || echo -%{__kernel_rel})} |
066309eb | 194 | %_kernel_ver_str %(echo %{!?_without_dist_kernel:%{__kernel_rpmvr}}%{?_without_dist_kernel:%{__kernel_ver}} | sed -e 's/-/_/g') |
fd4d8ee0 | 195 | |
c2c27a5a | 196 | # sgml macros |
31b569b6 ER |
197 | %xmlcat_add() /usr/bin/xmlcatalog --noout --add nextCatalog \"\" %1 /etc/xml/catalog ; |
198 | %xmlcat_del() /usr/bin/xmlcatalog --noout --del %1 /etc/xml/catalog ; | |
199 | %xmlcat_add_rewrite /usr/bin/xmlcatalog --noout --add rewriteSystem | |
200 | %xmlcat_create() /usr/bin/xmlcatalog --noout --create %1 ; | |
201 | %sgmlcat_add() /usr/bin/install-catalog --add %1 %2 > /dev/null ; | |
202 | %sgmlcat_del() /usr/bin/install-catalog --remove %1 %2 > /dev/null ; | |
c2c27a5a | 203 | %docbook_sgmlcat_fix() { for l in \ |
204 | '' \ | |
205 | ' -- default decl --' \ | |
206 | 'DTDDECL "-//OASIS//DTD DocBook XML V%2//EN" "../../xml.dcl"' \ | |
207 | ' -- hacks for opensp --' \ | |
208 | 'SYSTEM "file://%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \ | |
209 | 'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \ | |
210 | '' \ | |
211 | ; do echo $l; done >> %1 \ | |
212 | } | |
213 | ||
cd33aab7 AM |
214 | #----------------------------------------------------------------- |
215 | # find and gzip all files in %{_mandir} and %{infodir} | |
216 | # | |
217 | # Requires: xargs, find | |
218 | # | |
219 | #%no_install_post_compress_docs 1 | |
220 | %__spec_install_post_compress_docs { \ | |
cd33aab7 | 221 | %{!?no_install_post_compress_docs: \ |
89f18684 | 222 | echo "Compress man and info pages."; \ |
cd33aab7 AM |
223 | %{?verbose:set -x;} \ |
224 | for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \ | |
225 | if [ -d "$RPM_BUILD_ROOT$i" ]; then \ | |
226 | find "$RPM_BUILD_ROOT$i" -name \*.bz2 -print | xargs -r %{__bzip2} -df; \ | |
227 | find "$RPM_BUILD_ROOT$i" -name \*.gz -print | xargs -r %{__gzip} -dnf; \ | |
228 | find "$RPM_BUILD_ROOT$i" -type f -print | xargs -r %{__gzip} -9nf; \ | |
229 | fi; \ | |
230 | done; \ | |
231 | } } | |
232 | ||
233 | #----------------------------------------------------------------- | |
234 | # Strip executable binaries and shared object files | |
235 | # | |
236 | # Requires: find, awk, strip, cut, xargs | |
237 | # | |
238 | #%no_install_post_strip 1 | |
239 | %__spec_install_post_strip {%{!?debug: \ | |
240 | %{!?no_install_post_strip: \ | |
31b569b6 ER |
241 | %{?verbose:set -x;} \ |
242 | if [ -d "$RPM_BUILD_ROOT" ]; then \ | |
5b0f0ac9 | 243 | echo "Strip executable binaries, archives and shared object files."; \ |
1fcb29e9 | 244 | filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*\.debug" %{?_noautostrip:! -regex "%{_noautostrip}"}`; \ |
cd33aab7 AM |
245 | elfexelist=`echo $filelist | xargs -r file | \ |
246 | awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \ | |
247 | elfsharedlist=`echo $filelist | xargs -r file | \ | |
248 | awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \ | |
5b0f0ac9 MM |
249 | elfarchiveslist=`echo $filelist | xargs -r file | \ |
250 | awk '/current ar archive/ {print $1}' | cut -d: -f1`; \ | |
cd33aab7 | 251 | if [ -n "$elfexelist" ]; then \ |
aaa1486f | 252 | %{__strip} --remove-section=.note --remove-section=.comment $elfexelist; \ |
cd33aab7 AM |
253 | fi; \ |
254 | if [ -n "$elfsharedlist" ]; then \ | |
aaa1486f | 255 | %{__strip} --strip-unneeded --remove-section=.note --remove-section=.comment $elfsharedlist; \ |
5b0f0ac9 MM |
256 | fi; \ |
257 | if [ -n "$elfarchiveslist" ]; then \ | |
aaa1486f | 258 | %{__strip} --strip-debug --remove-section=.note --remove-section=.comment $elfarchiveslist; \ |
f80cefa3 | 259 | fi; \ |
31b569b6 | 260 | fi; } \ |
cd33aab7 | 261 | } } |
31b569b6 | 262 | |
cc545e1a | 263 | #----------------------------------------------------------------- |
264 | # remove all RPATH from executable binaries and shared object files | |
265 | # | |
266 | # Requires: find, awk, cut, xargs, chrpath, uname | |
267 | # | |
268 | #%no_install_post_chrpath 1 | |
269 | %__spec_install_post_chrpath {%{!?debug: \ | |
270 | %{!?no_install_post_chrpath: \ | |
271 | %{?verbose:set -x;} \ | |
f80cefa3 | 272 | if [ -d "$RPM_BUILD_ROOT" ]; then \ |
cc545e1a | 273 | echo "Remove RPATH from executable binaries and shared object files."; \ |
d274a19d | 274 | find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*" %{?_noautochrpath:! -regex "%{_noautochrpath}"} | xargs -r file | \ |
3d66db15 | 275 | awk '/ELF.*(executable.*dynamically linked|shared object)/ {print $1}' | cut -d: -f1 | \ |
cc545e1a | 276 | while read file ; do \ |
277 | rpath= ; \ | |
278 | chmod u+w "$file"; \ | |
279 | for dir in `chrpath -l "$file" | \ | |
31b569b6 | 280 | awk '/RPATH=/ { gsub(/.*RPATH=/,""); gsub(/:/," "); print $0 }'` ; do \ |
cc545e1a | 281 | case $dir in \ |
570a0c29 | 282 | /home/* | /tmp/* | /usr/lib | /usr/lib64 | /lib | /lib64 | /usr/local/lib | /usr/local/lib64 | /usr/X11R6/lib | /usr/X11R6/lib64 ) \ |
cc545e1a | 283 | echo "remove-rpath: $dir in $file"; \ |
284 | ;; \ | |
285 | * ) \ | |
286 | if [ "$rpath" = "" ] ; then rpath="$dir" ; \ | |
287 | else rpath="$rpath:$dir" ; fi ; \ | |
288 | ;; \ | |
289 | esac ; \ | |
290 | done ; \ | |
291 | if [ "$rpath" = "" ] ; then chrpath -d "$file" > /dev/null ; \ | |
292 | else chrpath -r "$rpath" "$file" > /dev/null ; fi ; \ | |
f80cefa3 JB |
293 | done; \ |
294 | fi; } \ | |
cc545e1a | 295 | } } |
31b569b6 | 296 | |
22a54b3e | 297 | #----------------------------------------------------------------- |
93b46c00 | 298 | # Find and gzip all kernel modules |
299 | # | |
300 | # Requires: find | |
301 | # | |
302 | #%no_install_post_compress_modules 1 | |
303 | %__spec_install_post_compress_modules { \ | |
93b46c00 | 304 | %{!?no_install_post_compress_modules: \ |
31b569b6 ER |
305 | %{?verbose:set -x;} \ |
306 | if [ -d "$RPM_BUILD_ROOT" ]; then \ | |
307 | echo "Compress kernel modules if any."; \ | |
308 | if test -d $RPM_BUILD_ROOT/lib/modules ; then \ | |
309 | find $RPM_BUILD_ROOT/lib/modules -name \*o -type f -print | \ | |
310 | xargs -r %{__gzip} -9nf; \ | |
311 | find $RPM_BUILD_ROOT/lib/modules -name \*o -type l -printf "%p %l\n" | \ | |
312 | while read a b; do ln -sf $b.gz $a.gz; rm -f $a; done; \ | |
313 | fi; \ | |
314 | fi; \ | |
93b46c00 | 315 | } } |
cd33aab7 | 316 | |
aad1c8e4 | 317 | #----------------------------------------------------------------- |
cc6c554c | 318 | # Update GConf2 schemas |
aad1c8e4 | 319 | # |
320 | # Requires: GConf2 | |
321 | # | |
5b8ed3c0 | 322 | %gconf_schema_install() \ |
31b569b6 ER |
323 | umask 022; \ |
324 | GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" /usr/bin/gconftool-2 --makefile-install-rule /etc/gconf/schemas/%{?1}%{!?1:*.schemas} > /dev/null \ | |
325 | %{nil} | |
5b8ed3c0 | 326 | |
327 | %gconf_schema_uninstall() \ | |
429d047e | 328 | if [ $1 = 0 ]; then \ |
31b569b6 ER |
329 | umask 022; \ |
330 | GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" /usr/bin/gconftool-2 --makefile-uninstall-rule /etc/gconf/schemas/%{?1} > /dev/null \ | |
429d047e | 331 | fi \ |
332 | %{nil} | |
333 | ||
334 | #----------------------------------------------------------------- | |
335 | # Update desktop MIME database | |
96999189 | 336 | # requires: desktop-file-utils |
429d047e | 337 | # |
9ba5542a | 338 | %update_desktop_database_post() {{ \ |
429d047e | 339 | umask 022; \ |
340 | /usr/bin/update-desktop-database; \ | |
17c49976 | 341 | }} |
429d047e | 342 | |
38267983 | 343 | %update_desktop_database_postun() {{ \ |
429d047e | 344 | if [ $1 = 0 ]; then \ |
345 | umask 022; \ | |
346 | /usr/bin/update-desktop-database; \ | |
347 | fi \ | |
17c49976 | 348 | }} |
429d047e | 349 | |
350 | #----------------------------------------------------------------- | |
351 | # Update scrollkeeper database | |
352 | # requires: scrollkeeper | |
353 | # | |
354 | %scrollkeeper_update_post() \ | |
429d047e | 355 | /usr/bin/scrollkeeper-update -q; \ |
356 | %{nil} | |
357 | ||
358 | %scrollkeeper_update_postun() \ | |
359 | if [ $1 = 0 ]; then \ | |
429d047e | 360 | /usr/bin/scrollkeeper-update -q; \ |
361 | fi \ | |
362 | %{nil} | |
363 | ||
364 | #----------------------------------------------------------------- | |
365 | # Run ldconfig after installing/deinstalling libraries | |
366 | # | |
367 | %ldconfig_post() \ | |
368 | /sbin/ldconfig; \ | |
369 | %{nil} | |
370 | ||
371 | %ldconfig_postun() \ | |
429d047e | 372 | /sbin/ldconfig; \ |
bbc02b2d | 373 | %{nil} |
aad1c8e4 | 374 | |
cd33aab7 AM |
375 | #----------------------------------------------------------------- |
376 | # post %install sequence: | |
377 | # - autodeps exceptions | |
378 | # - compress all man and info pages, | |
379 | # - strip all ELF executables and ELF shared objects if not %debug. | |
5b0f0ac9 | 380 | # - compress kernel modules if any |
cd33aab7 AM |
381 | |
382 | ################################################################### | |
383 | # Requires/Provides automation | |
384 | # exceptions system by Jacek Konieczny <jajcus@pld.org.pl> | |
a4852742 | 385 | # |
fbbdca08 JB |
386 | %__noautoreqfiles %(sed -e s'/#.*//' /etc/rpm/noautoreqfiles)%{?_noautoreqfiles: %{_noautoreqfiles}} |
387 | %__noautoprovfiles %(sed -e s'/#.*//' /etc/rpm/noautoprovfiles)%{?_noautoprovfiles: %{_noautoprovfiles}} | |
388 | %__noautoreq %(sed -e s'/#.*//' /etc/rpm/noautoreq)%{?_noautoreq: %{_noautoreq}} | |
389 | %__noautoreqdep %(sed -e s'/#.*//' /etc/rpm/noautoreqdep)%{?_noautoreqdep: %{_noautoreqdep}} | |
390 | %__noautoprov %(sed -e s'/#.*//' /etc/rpm/noautoprov)%{?_noautoprov: %{_noautoprov}} | |
a4852742 JB |
391 | #%_noautocompressdoc %{nil} |
392 | # | |
5b0f0ac9 MM |
393 | %_missing_doc_files_terminate_build 1%{nil} |
394 | %_unpackaged_files_terminate_build %{nil} | |
4c7d3ba4 | 395 | # (X)emacs support |
42b7e5ac | 396 | %___emacs_lispdir_helper -batch -q -eval '(while load-path (princ (concat (car load-path) "\\n")) (setq load-path (cdr load-path)))' 2> /dev/null|sed -n '/\\(.*\\/x\\?emacs\\/site-lisp\\)\\/\\?$/{s,,\\1,p;q;}' |
4c7d3ba4 AF |
397 | %_emacs_lispdir %(emacs %___emacs_lispdir_helper) |
398 | %_xemacs_lispdir %(xemacs %___emacs_lispdir_helper) | |
41a62699 | 399 | |
984f6de6 JK |
400 | %__php_provides %{nil} |
401 | %__php_requires %{nil} | |
402 | %__perl_provides %{nil} | |
403 | %__perl_requires %{nil} | |
63b0a9d7 | 404 | %__mono_provides %{nil} |
405 | %__mono_requires %{nil} | |
41a62699 AF |
406 | |
407 | # Perl specific macro definitions. | |
942c693c AF |
408 | %perl_privlib %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib) |
409 | %perl_archlib %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib) | |
410 | %perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib) | |
411 | %perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch) | |
412 | %perl_sitelib %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib) | |
413 | %perl_sitearch %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch) | |
41a62699 | 414 | |
942c693c | 415 | %php_pear_dir %{_datadir}/pear |
41a62699 | 416 | |
6b2157a6 ER |
417 | # directory where php includes are installed on system. |
418 | %__php_includedir /usr/include/php | |
f73da51b | 419 | # extract php/zend api versions |
09fac83f | 420 | %php_major_version %(awk '/#define PHP_MAJOR_VERSION/{print $3}' %{__php_includedir}/main/php_version.h 2>/dev/null || echo ERROR) |
6b2157a6 | 421 | %php_api_version %(awk '/#define PHP_API_VERSION/{print $3}' %{__php_includedir}/main/php.h 2>/dev/null || echo ERROR) |
ab8d73ee | 422 | %php_debug %(awk '/#define ZEND_DEBUG/{print $3}' %{__php_includedir}/main/php_config.h 2>/dev/null || echo ERROR) |
6b2157a6 ER |
423 | %zend_module_api %(awk '/#define ZEND_MODULE_API_NO/{print $3}' %{__php_includedir}/Zend/zend_modules.h 2>/dev/null || echo ERROR) |
424 | %zend_extension_api %(awk '/#define ZEND_EXTENSION_API_NO/{print $3}' %{__php_includedir}/Zend/zend_extensions.h 2>/dev/null || echo ERROR) | |
ea702d15 | 425 | %zend_zts %(Z=$(grep -sc '^#define ZTS 1' %{__php_includedir}/main/php_config.h); echo ${Z:-ERROR}) |
6b2157a6 ER |
426 | |
427 | # helper macro | |
e255dfdc | 428 | %__php_api_requires(v:) Requires: php%{-v*}(%{expand:%1}) = %{expand:%{%{!?2:%{1}}%{?2}}} |
6b2157a6 ER |
429 | |
430 | # macros for public use | |
431 | # for php extensions (php-pecl) | |
ab8d73ee | 432 | %requires_php_extension %{__php_api_requires modules_api php_api_version} \ |
e255dfdc ER |
433 | %{__php_api_requires -v %php_major_version debug php_debug} \ |
434 | %{__php_api_requires -v %php_major_version thread-safety zend_zts} | |
ab8d73ee | 435 | |
6b2157a6 ER |
436 | # for zend extensions |
437 | %requires_zend_extension %{__php_api_requires zend_module_api} \ | |
ab8d73ee | 438 | %{__php_api_requires zend_extension_api} \ |
e255dfdc ER |
439 | %{__php_api_requires -v %php_major_version debug php_debug} \ |
440 | %{__php_api_requires -v %php_major_version thread-safety zend_zts} | |
6b2157a6 | 441 | |
41a62699 AF |
442 | # Python specific macro definitions. |
443 | # python main version | |
31b569b6 | 444 | %py_ver %(python -c "import sys; print sys.version[:3]") |
41a62699 AF |
445 | |
446 | # directories | |
31b569b6 ER |
447 | %py_prefix %(python -c "import sys; print sys.prefix") |
448 | %py_libdir %{py_prefix}/%{_lib}/python%{py_ver} | |
a4f0b5e0 | 449 | %py_scriptdir %{py_prefix}/share/python%{py_ver} |
31b569b6 | 450 | %py_incdir /usr/include/python%{py_ver} |
a4f0b5e0 JK |
451 | %py_sitedir %{py_libdir}/site-packages |
452 | %py_sitescriptdir %{py_scriptdir}/site-packages | |
31b569b6 | 453 | %py_dyndir %{py_libdir}/lib-dynload |
41a62699 AF |
454 | |
455 | # pure python modules compilation | |
31b569b6 | 456 | %py_comp python -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])" |
41a62699 | 457 | |
31b569b6 | 458 | %py_ocomp python -O -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])" |
41a62699 AF |
459 | |
460 | # Software written in Python language require Python with main version | |
5177c7b1 | 461 | %pyrequires_eq() Requires: %1 |
41a62699 | 462 | |
ea4b2900 AF |
463 | # Hardlink binary identical .pyc and .pyo files |
464 | # (idea by glen <at> pld-linux <dot> org) | |
465 | %__spec_install_post_py_hardlink {\ | |
2b8c0cee | 466 | %{!?no_install_post_py_hardlink: \ |
ea4b2900 AF |
467 | [ ! -d "$RPM_BUILD_ROOT" ] || find "$RPM_BUILD_ROOT" -name '*.pyc' | while read a; do \ |
468 | b="$(echo $a|sed -e 's/.pyc$/.pyo/')"; \ | |
469 | if cmp -s "$a" "$b"; then \ | |
470 | ln -f "$a" "$b"; \ | |
471 | fi; \ | |
472 | done \ | |
473 | } } | |
474 | ||
16f6f416 | 475 | # remove python sources, so that check-files won't complain |
ea4b2900 AF |
476 | # (idea by glen <at> pld-linux <dot> org) |
477 | %py_postclean() \ | |
e4e8948b | 478 | for d in %{py_sitescriptdir} %{py_sitedir} %*; do \ |
9ba5542a | 479 | [ ! -d "$RPM_BUILD_ROOT$d" ] || find "$RPM_BUILD_ROOT$d" -name '*.py' -print0 | xargs -0r -l512 rm;\ |
ea4b2900 AF |
480 | done \ |
481 | %{nil} | |
482 | ||
67ed5b97 | 483 | # depmod macro |
484 | %depmod() { \ | |
fe30b3ea | 485 | umask 022; \ |
67ed5b97 | 486 | if [ -e /boot/System.map-%1 ]; then \ |
31b569b6 | 487 | /sbin/depmod -a -F /boot/System.map-%1 %1; \ |
67ed5b97 | 488 | else \ |
31b569b6 ER |
489 | if [ -e /boot/System.map ]; then \ |
490 | /sbin/depmod -a -F /boot/System.map %1; \ | |
491 | else \ | |
492 | /sbin/depmod -a %1; \ | |
493 | fi \ | |
67ed5b97 | 494 | fi; \ |
495 | } | |
496 | ||
495892af | 497 | # XMMS specific macros |
31b569b6 ER |
498 | %xmms_prefix %(xmms-config --prefix 2>/dev/null) |
499 | %xmms_exec_prefix %(xmms-config --exec-prefix 2>/dev/null) | |
500 | %xmms_version %(xmms-config --version 2>/dev/null) | |
501 | %xmms_datadir %(xmms-config --data-dir 2>/dev/null) | |
502 | %xmms_plugindir %(xmms-config --plugin-dir 2>/dev/null) | |
503 | %xmms_visualization_plugindir %(xmms-config --visualization-plugin-dir 2>/dev/null) | |
504 | %xmms_input_plugindir %(xmms-config --input-plugin-dir 2>/dev/null) | |
505 | %xmms_output_plugindir %(xmms-config --output-plugin-dir 2>/dev/null) | |
506 | %xmms_effect_plugindir %(xmms-config --effect-plugin-dir 2>/dev/null) | |
507 | %xmms_general_plugindir %(xmms-config --general-plugin-dir 2>/dev/null) | |
495892af | 508 | |
bb128216 PS |
509 | %_target_base_arch %(echo %{_target_cpu} | sed 's/i.86/i386/;s/athlon/i386/;s/pentium./i386/;s/amd64/x86_64/;s/ia32e/x86_64/') |
510 | ||
e3618ee9 | 511 | # user/group checking macros |
512 | # | |
513 | # Usage: | |
514 | # %userremove myuser | |
515 | # | |
516 | %userremove /usr/lib/rpm/user_group.sh user del | |
517 | %groupremove /usr/lib/rpm/user_group.sh group del | |
518 | # | |
519 | # Usage: | |
520 | # if %usertestrm myuser; then | |
521 | # /usr/sbin/userdel -r myuser | |
522 | # Note: | |
523 | # use these macros only if you need to call userdel/groupdel with | |
524 | # a non-standard option or take an extra action; otherwise use the | |
525 | # %userremove/%groupremove macros | |
526 | # | |
527 | %usertestrm /usr/lib/rpm/user_group.sh user testrm | |
528 | %grouptestrm /usr/lib/rpm/user_group.sh group testrm | |
13f70a2c JK |
529 | # user group membership management macros |
530 | # | |
531 | # Usage: | |
532 | # %addusertogroup myuser agroup | |
533 | # | |
534 | %addusertogroup /usr/lib/rpm/user_group.sh user addtogroup | |
bfd9689c | 535 | |
536 | # banner support (useful in {pre,post}{,un} and triggers) | |
537 | # | |
538 | # Usage: | |
a980efc1 | 539 | # %banner name [-a] [-e] [-n] [-tn] <<EOF |
bfd9689c | 540 | # the banner text, the banner text |
a980efc1 ER |
541 | # the banner text, and following line |
542 | #EOF | |
543 | # You can use any form of here-document, <<'EOF' <<-EOT will do. | |
544 | # NOTE: if your use "<<-EOF", then You can actually indent inside here-document. | |
545 | # | |
bfd9689c | 546 | # -a - append to the banner |
fb033326 | 547 | # -e - send to stderr instead of stdout |
1257c400 | 548 | # -n - no show banner (overrides -t) |
549 | # -t - show only, if RPM_SCRIPTVERBOSITY >= n; default n=5 | |
a980efc1 | 550 | %banner(aent:) \ |
f1bbc6ff | 551 | RPM_SCRIPTVERBOSITY=5 \ |
552 | [ -r /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm \ | |
553 | if [ -x /usr/bin/banner.sh ]; then \ | |
a980efc1 | 554 | CMD="/usr/bin/banner.sh %{-e:--stderr} %{!-n:$([ $RPM_SCRIPTVERBOSITY -ge %{-t:%{-t*}}%{!-t:5} ] && echo -s)} %{!-a:-m}%{-a:-M} %1" \ |
f1bbc6ff | 555 | else \ |
fb033326 | 556 | CMD="cat%{-e: >&2}" \ |
f1bbc6ff | 557 | fi \ |
f9cf2bf7 | 558 | eval $CMD %2%{?3: %3} \ |
bfd9689c | 559 | %nil |
1257c400 | 560 | |
29c5556c ER |
561 | # useradd/groupadd macros written by glen@pld-linux.org. |
562 | # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada | |
563 | # | |
564 | # Usage: | |
565 | # %useradd [-P package] [-u uid] [-d home_dir] [-s shell] [-c comment] | |
566 | # [-g initial_group] [-G group[,...]] login | |
567 | # | |
568 | # -u uid. REQUIRED | |
569 | # -g gid/group. REQUIRED | |
570 | # -s defaults to /bin/false | |
571 | # -d defaults to /usr/share/empty | |
572 | # -c No default | |
573 | # -r is accepted but ignored (it's always set) | |
6eb25d5d | 574 | # -k skeleton dir. defaults to /usr/share/empty |
29c5556c ER |
575 | # rpm specific flags |
576 | # -P package name. defaults to %{name} | |
577 | # | |
29c5556c | 578 | %useradd(c:d:e:f:g:G:Mmk:op:s:u:rP:) \ |
0044d46f ER |
579 | %{!-u:%{error:useradd: Required argument -u missing}} \ |
580 | %{!-g:%{error:useradd: Required argument -g missing}} \ | |
581 | %{!?1:%{error:useradd: Required parameter login missing}} \ | |
29c5556c ER |
582 | if [ -n "`/bin/id -u %{expand:%{%{#}}} 2>/dev/null`" ]; then \ |
583 | if [ "`/bin/id -u %{expand:%{%{#}}}`" != "%{-u*}" ]; then \ | |
584 | echo "Error: user %{expand:%{%{#}}} doesn't have uid=%{-u*}. Correct this before installing %{-P*}%{!?-P:%{name}}." 1>&2 \ | |
585 | exit 1 \ | |
586 | fi \ | |
587 | else \ | |
588 | echo "Adding user %{expand:%{%{#}}} UID=%{-u*}." \ | |
589 | /usr/sbin/useradd \\\ | |
cc333c8b | 590 | %{-m:-m -k %{-k*}%{!-k:/usr/share/empty}} \\\ |
29c5556c ER |
591 | -u %{-u*} \\\ |
592 | -r \\\ | |
593 | -d %{-d*}%{!-d:/usr/share/empty} \\\ | |
594 | -s %{-s*}%{!-s:/bin/false} \\\ | |
85e3e9a1 | 595 | %{-c:-c "%(set -- %{-c*} %{*}; echo $1)"}\\\ |
29c5556c ER |
596 | -g %{-g*} \\\ |
597 | %{-M} \\\ | |
598 | %{-G:-G %{-G*}} \\\ | |
85e3e9a1 | 599 | %{expand:%{%{#}}} 1>&2 \ |
29c5556c ER |
600 | fi; |
601 | ||
29c5556c ER |
602 | # Usage: |
603 | # %groupadd [-P package] [-g gid] group | |
604 | # | |
605 | # -g gid. REQUIRED | |
606 | # | |
607 | # Sample: | |
608 | # %groupadd -P %{name}-base -g %{gid} %{name} | |
609 | ||
610 | %groupadd(g:P:rfo) \ | |
0044d46f ER |
611 | %{!-g:%{error:groupadd: Required argument -g missing}} \ |
612 | %{!?1:%{error:groupadd: Required parameter group missing}} \ | |
29c5556c ER |
613 | if [ -n "`/usr/bin/getgid %{1}`" ]; then \ |
614 | if [ "`/usr/bin/getgid %{1}`" != "%{-g*}" ]; then \ | |
615 | echo "Error: group %{1} doesn't have gid=%{-g*}. Correct this before installing %{-P*}%{!?-P:%{name}}." 1>&2 \ | |
616 | exit 1 \ | |
617 | fi \ | |
618 | else \ | |
619 | echo "Adding group %{1} GID=%{-g*}." \ | |
85e3e9a1 | 620 | /usr/sbin/groupadd -g %{-g*} -r %{1} 1>&2 \ |
29c5556c | 621 | fi; |
053b8de1 ER |
622 | |
623 | # apache_config_{install/uninstall} macros written by glen@pld-linux.org. | |
624 | # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada | |
625 | # | |
626 | # The config is installed/removed inside trigger, this means that you can any | |
627 | # time install apache1 or apache package and the configuration file is updated. | |
628 | # if you don't need the config for various reason for specific apache, just | |
629 | # remove the symlink from apache config directory. the trigger will not put the | |
630 | # config again to that version of apache. In other words the config is linked | |
631 | # to apache config directory on first install of PACKAGE or apache. | |
632 | # | |
633 | # should be called in trigger body: | |
634 | # %triggerin -- apache1 >= 1.3.33-2 | |
635 | # %apache_config_install -v 1 | |
636 | # | |
637 | # Add package's apache config to apache config. | |
638 | # | |
639 | # Usage: | |
640 | # %apache_config_install -v {1|2} -c %{_sysconfdir}/apache-%{name}.conf -n 99 | |
641 | # | |
642 | # -v REQUIRED: specify apache version. can be 1 or 2. | |
643 | # -c OPTIONAL: specify full path to PACKAGE's config. Defaults to %{_sysconfdir}/apache-%{name}.conf. | |
644 | # -n OPTIONAL: specify config "slot". defaults to 99 | |
645 | # | |
646 | # Internal macros. don't use ;). | |
647 | # expands apache config dir by apache version at build time. | |
648 | %__apache_confdir() %(if [ %{1} = 1 ]; then echo /etc/apache/conf.d; elif [ %{1} = 2 ]; then echo /etc/httpd/httpd.conf; else echo >&2 Unknown apache version specified; fi) | |
649 | # expands apache service name by apache version at build time. | |
650 | %__apache_svcname() %(if [ %{1} = 1 ]; then echo apache; elif [ %{1} = 2 ]; then echo httpd; else echo >&2 Unknown apache version specified; fi) | |
651 | ||
652 | %apache_config_install(v:c:n:) \ | |
653 | %{!-v:%{error:apache_config_install: Required argument -v missing}} \ | |
654 | %{?debug:set -x; echo "apache_config_install:%{-v*} %{name}-%{version}-%{release} 1:[$1]; 2:[$2]"} \ | |
655 | if [ "$1" = "1" ] && [ "$2" = "1" ] && [ -d %{__apache_confdir %{-v*}} ]; then\ | |
656 | ln -sf %{-c*}%{!-c:%{_sysconfdir}/apache-%{name}.conf} %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf\ | |
657 | fi\ | |
7e4c6837 | 658 | # reload apache if the config symlink is there\ |
1d90410b | 659 | if [ -L %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf ]; then\ |
71d37358 ER |
660 | # additionally don't reload if target package (the webserver) is upgraded, as webserver is restarted anyway in %post \ |
661 | if [ "$2" != "2" ] && [ -f /var/lock/subsys/%{__apache_svcname %{-v*}} ]; then\ | |
7e4c6837 | 662 | /etc/rc.d/init.d/%{__apache_svcname %{-v*}} reload 1>&2\ |
053b8de1 ER |
663 | fi\ |
664 | fi\ | |
665 | %{nil} | |
666 | ||
667 | # Remove package's apache config from apache config. | |
668 | # | |
669 | # Usage: | |
670 | # %apache_config_uninstall -v {1|2} -n 99 | |
671 | # | |
672 | # -v REQUIRED: specify apache version. can be 1 or 2. | |
673 | # -n OPTIONAL: specify config "slot". defaults to 99 | |
674 | %apache_config_uninstall(v:n:) \ | |
675 | %{!-v:%{error:apache_config_uninstall: Required argument -v missing}} \ | |
676 | %{?debug:set -x; echo "apache_config_uninstall:%{-v*} %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"} \ | |
9e0d77bc | 677 | # remove link if either of the packages are gone \ |
053b8de1 ER |
678 | if [ "$1" = "0" ] || [ "$2" = "0" ]; then \ |
679 | if [ -L %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf ]; then \ | |
680 | rm -f %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf \ | |
681 | if [ -f /var/lock/subsys/%{__apache_svcname %{-v*}} ]; then \ | |
7e4c6837 | 682 | /etc/rc.d/init.d/%{__apache_svcname %{-v*}} reload 1>&2 \ |
053b8de1 ER |
683 | fi \ |
684 | fi \ | |
685 | fi \ | |
686 | %{nil} | |
687 | ||
745c4676 ER |
688 | # see browser-plugins.spec / template-browser-plugin.spec |
689 | # written by glen@pld-linux.org. | |
f6565dd0 | 690 | %nsplugin_install(d:f) { \ |
745c4676 | 691 | # create link if it's first install of either of the packages \ |
f6565dd0 | 692 | if [ -n "%{-f:1}" ] || ([ "$1" = "1" ] && [ "$2" = "1" ] && [ -d %{-d*} ]); then \ |
745c4676 ER |
693 | ( \ |
694 | %( \ | |
695 | for file in %{*}; do \ | |
696 | echo echo Installing $file to %{-d*}; \ | |
697 | echo "ln -sf %{_libdir}/browser-plugins/$file %{-d*};"; \ | |
698 | done ) \ | |
699 | ) | ( %banner -t 5 -e %{name}-in ); fi; \ | |
700 | } | |
701 | ||
3e680cb6 | 702 | %nsplugin_uninstall(d:) { \ |
745c4676 ER |
703 | # remove link if either of the packages are gone \ |
704 | if [ "$1" = "0" ] || [ "$2" = "0" ]; then \ | |
705 | ( \ | |
706 | %( \ | |
707 | for file in %{*}; do \ | |
708 | echo echo Removing $file from %{-d*}; \ | |
709 | echo "rm -f %{-d*}/$file;"; \ | |
710 | done ) \ | |
711 | ) | ( %banner -t 5 -e %{name}-un ); fi; \ | |
712 | } | |
8edf8498 ER |
713 | |
714 | # service macro. | |
715 | # | |
716 | # calls usual service restart on package %post, but skips the restart if | |
717 | # administrator has disabled automatic service restarts in either global | |
718 | # /etc/sysconfig/rpm or per service /etc/sysconfig/SERVICE file. | |
719 | # | |
720 | # written by glen@pld-linux.org. | |
721 | # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada | |
722 | # | |
723 | # Usage: | |
524e081b | 724 | # %service [-q] SERVICE ACTION ["SERVICE NICE DESCRIPTION"] |
8edf8498 ER |
725 | # |
726 | # -q be silent when service isn't started (for postun scriplets) | |
727 | # | |
1873cbca | 728 | %service(q) {{ \ |
8edf8498 ER |
729 | # we use function, not to globber namespace with useless variables \ |
730 | skip_auto_restart() { \ | |
1873cbca ER |
731 | . /etc/sysconfig/rpm; # global setting \ |
732 | [ -f /etc/sysconfig/%1 ] && . /etc/sysconfig/%1; # per service setting \ | |
733 | echo ${RPM_SKIP_AUTO_RESTART:-no}; \ | |
734 | }; \ | |
8edf8498 ER |
735 | if [ -f /var/lock/subsys/%1 ]; then \ |
736 | if [ $(skip_auto_restart) = no ]; then \ | |
1873cbca | 737 | /etc/rc.d/init.d/%1 %2 1>&2; \ |
4e00b353 ER |
738 | %{!-q:else} \ |
739 | %{!-q:echo 'Run "/etc/rc.d/init.d/%1 %2" to %2 %{!?3:%1 service}%{?3:%(set -- %{*}; echo "$3")}.';} \ | |
8edf8498 | 740 | fi \ |
53fb05ff | 741 | %{!-q:else} \ |
524e081b | 742 | %{!-q:echo 'Run "/etc/rc.d/init.d/%1 start" to start %{!?3:%1 service}%{?3:%(set -- %{*}; echo "$3")}.';} \ |
ecbbaf61 | 743 | fi }; } |
8edf8498 | 744 |