5 %_enable_debug_packages 1
9 %__chown_Rhf @__CHOWN_RHF@
10 %__chgrp_Rhf @__CHGRP_RHF@
12 %_fixowner [ `%{__id_u}` = '0' ] && %{__chown_Rhf} root:@ROOT_GROUP@
14 %_fixperms %{__chmod} -Rf @FIXPERMS@
15 %_topdir %(echo $HOME)/rpm
16 #-----------------------------------------------------------------
17 # CFLAGS and LDFLAGS used to build
19 %debuginfocflags %{expand:%%define __dic_%{?_enable_debug_packages} 1}%{?__dic_1: -ggdb}%{expand:%%undefine __dic_%{?_enable_debug_packages}}
21 %debugcflags -O0 -g -Wall
22 %rpmcflags %{?debug:%debugcflags}%{!?debug:%optflags}%{?debuginfocflags}
23 %rpmcxxflags %{rpmcflags} -fvisibility-inlines-hidden
25 # %rpmldflags -Wl,--as-needed
31 # Build system path macros.
33 %__autoconf autoconf %{?debug:-Wall}
34 %__automake automake -a -c -f --foreign
35 %__autopoint autopoint --force
38 if ! gettextize --version | grep -q '0\.10\.' ; then \
39 if grep -qs 'AM_GNU_GETTEXT.*external' configure.{ac,in} ; then \
40 gettextize --copy --force --no-changelog; \
42 gettextize --copy --force --no-changelog --intl; \
44 if [ ! -f po/Makevars ]; then \
45 cp -f po/Makevars{.template,}; \
48 gettextize --copy --force; \
52 %__glib_gettextize glib-gettextize --copy --force
53 %__gnome_doc_common gnome-doc-common --copy
54 %__gtkdocize gtkdocize --copy
55 %__intltoolize intltoolize --copy --force
56 %__libtoolize libtoolize --copy --force
58 %dependencytracking %{nil}
59 #-----------------------------------------------------------------
61 if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \
62 LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \
63 CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \
64 CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" ; export CXXFLAGS ; \
65 FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \
66 CPPFLAGS="${CPPFLAGS:-}" ; export CPPFLAGS ; \
67 %{?__cc:CC="%{__cc}" ; export CC ; } \
68 %{?__cxx:CXX="%{__cxx}" ; export CXX ; } \
69 %{?configuredir:%{configuredir}}%{!?configuredir:.}/configure \
70 --host=%{_target_platform} \
72 --exec-prefix=%{_exec_prefix} \
74 --sbindir=%{_sbindir} \
75 --sysconfdir=%{_sysconfdir} \
76 --datadir=%{_datadir} \
77 --includedir=%{_includedir} \
79 --libexecdir=%{_libexecdir} \
80 --localstatedir=%{_localstatedir} \
81 --sharedstatedir=%{_sharedstatedir} \
83 --infodir=%{_infodir} \
84 --x-libraries=/usr/X11R6/%{_lib} \
85 %{dependencytracking} \
88 #----------------------------------------------------------------
89 %configure {./configure \
90 LDFLAGS="${LDFLAGS:-%rpmldflags}" \
91 CFLAGS="${CFLAGS:-%rpmcflags}" \
92 CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" \
93 FFLAGS="${FFLAGS:-%rpmcflags}" \
94 CPPFLAGS="${CPPFLAGS:-}" \
95 %{?__cc:CC="%{__cc}"} \
96 %{?__cxx:CXX="%{__cxx}"} \
97 --build=%{_target_platform} \
99 --exec-prefix=%{_exec_prefix} \
100 --bindir=%{_bindir} \
101 --sbindir=%{_sbindir} \
102 --sysconfdir=%{_sysconfdir} \
103 --datadir=%{_datadir} \
104 --includedir=%{_includedir} \
105 --libdir=%{_libdir} \
106 --libexecdir=%{_libexecdir} \
107 --localstatedir=%{_localstatedir} \
108 --sharedstatedir=%{_sharedstatedir} \
109 --mandir=%{_mandir} \
110 --infodir=%{_infodir} \
111 --x-libraries=/usr/X11R6/%{_lib} \
112 %{dependencytracking} \
115 # ------------------------------------------------------------------------
116 # Overloading of some basic macros
132 %install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}}\
140 # ------------------------------------------------------------------------
141 # Conditional build stuff.
143 # Check if symbol is defined.
144 # Example usage: %if %{defined with_foo} && %{undefined with_bar} ...
145 %defined() %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
146 %undefined() %{expand:%%{?%{1}:0}%%{!?%{1}:1}}
148 # Shorthand for %{defined with_...}
149 %with() %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}}
150 %without() %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}}
152 # Handle conditional builds. %bcond_with is for case when feature is
153 # default off and needs to be activated with --with ... command line
154 # switch. %bcond_without is for the dual case.
156 # %bcond_with foo defines symbol with_foo if --with foo was specified on
158 # %bcond_without foo defines symbol with_foo if --without foo was *not*
159 # specified on command line.
163 # %bcond_with extra_fonts
164 # %bcond_without static
165 # %if %{with extra_fonts}
168 # %ifdef %{with static}
171 # %{?with_static: ... }
172 # %{!?with_static: ... }
173 # %{?with_extra_fonts: ... }
174 # %{!?with_extra_fonts: ... }
176 # The bottom line: never use without_foo, _with_foo nor _without_foo, only
177 # with_foo. This way changing default set of bconds for given spec is just
178 # a matter of changing single line in it and syntax is more readable.
179 %bcond_with() %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}
180 %bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}
181 # ------------------------------------------------------------------------
183 # Location of autoconf macros
184 %_aclocaldir %(aclocal --print-ac-dir)
186 # Location of omf files
187 %_omf_dest_dir %(scrollkeeper-config --omfdir)
189 # Location of pkgconfig files
190 %_pkgconfigdir /usr/%{_lib}/pkgconfig
192 # Location of desktop files
193 %_desktopdir /usr/share/applications
194 %_applnkdir ERROR:_applnkdir_is_obsolete_use_desktopdir_instead
196 # Location of pixmaps for applnk/desktop files
197 %_pixmapsdir /usr/share/pixmaps
199 # Location of themable icons for applnk/desktop files
200 %_iconsdir /usr/share/icons
202 # Location of fonts directories
203 %_fontsdir /usr/share/fonts
205 # Location of Gtk and associated libraries documentation
206 %_gtkdocdir %{_defaultdocdir}/gtk-doc/html
208 # Location of KDE documentation
209 %_kdedocdir %{_defaultdocdir}/kde/HTML
212 %__unsermake /usr/share/unsermake/unsermake
215 %date %(LC_ALL="C" date +"%a %b %d %Y")
218 %tmpdir %(echo "${TMPDIR:-/tmp}")
220 # Example files, programs, scripts...
221 %_examplesdir /usr/src/examples
223 # The directory holding Linux kernel sources
224 %_kernelsrcdir /usr/src/linux
226 # If non-empty "debug" macro defined, add "dbg" suffix to release number
227 %_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm
229 # Requires name = version-release
230 %requires_releq() %(LC_ALL="C" echo '%*' | xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}-%%{release}\\n' | sed -e 's/ (none):/ /' | grep -v "is not")
232 %releq_kernel_up() %(LC_ALL="C" rpm -qf --qf 'kernel-up = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | grep -vE "(is not|no such)")
233 %releq_kernel_smp() %(LC_ALL="C" rpm -qf --qf 'kernel-smp = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | grep -vE "(is not|no such)")
234 %requires_releq_kernel_up() %(LC_ALL="C" rpm -qf --qf 'PreReq: kernel-up = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | grep -vE "(is not|no such)")
235 %requires_releq_kernel_smp() %(LC_ALL="C" rpm -qf --qf 'PreReq: kernel-smp = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | grep -vE "(is not|no such)")
237 %requires_eq_to() %(LC_ALL="C" rpm -q --qf 'Requires: %1 = %%{epoch}:%%{version}\\n' %2 | sed -e 's/ (none):/ /' | grep -v "is not")
239 %apache_modules_api %(awk '/#define MODULE_MAGIC_NUMBER_MAJOR/ {print $3}' /usr/include/apache/ap_mmn.h 2>/dev/null || echo ERROR)
241 # kernel version-release handling
242 %__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))
243 %__kernel_rel %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h --queryformat "%{RELEASE}" | grep -v "is not")
244 %__kernel_rpmvr %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h --queryformat "%{VERSION}-%{RELEASE}" | grep -v "is not")
245 %_kernel_ver %{__kernel_ver}%{?with_dist_kernel:%(echo %{__kernel_ver} | grep -q -e - || echo -%{__kernel_rel})}
246 %_kernel_ver_str %(echo %{!?_without_dist_kernel:%{__kernel_rpmvr}}%{?_without_dist_kernel:%{__kernel_ver}} | sed -e 's/-/_/g')
249 %xmlcat_add() /usr/bin/xmlcatalog --noout --add nextCatalog \"\" %1 /etc/xml/catalog ;
250 %xmlcat_del() /usr/bin/xmlcatalog --noout --del %1 /etc/xml/catalog ;
251 %xmlcat_add_rewrite /usr/bin/xmlcatalog --noout --add rewriteSystem
252 %xmlcat_create() /usr/bin/xmlcatalog --noout --create %1 ;
253 %sgmlcat_add() /usr/bin/install-catalog --add %1 %2 > /dev/null ;
254 %sgmlcat_del() /usr/bin/install-catalog --remove %1 %2 > /dev/null ;
255 %docbook_sgmlcat_fix() { for l in \
257 ' -- default decl --' \
258 'DTDDECL "-//OASIS//DTD DocBook XML V%2//EN" "../../xml.dcl"' \
259 ' -- hacks for opensp --' \
260 'SYSTEM "file://%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
261 'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
263 ; do echo $l; done >> %1 \
266 #-----------------------------------------------------------------
267 # find and gzip all files in %{_mandir} and %{infodir}
269 # Requires: xargs, find
271 #%no_install_post_compress_docs 1
272 %__spec_install_post_compress_docs { \
273 %{!?no_install_post_compress_docs: \
274 echo "Compress man and info pages."; \
275 %{?verbose:set -x;} \
276 for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \
277 if [ -d "$RPM_BUILD_ROOT$i" ]; then \
278 find "$RPM_BUILD_ROOT$i" -name \*.bz2 -print | xargs -r %{__bzip2} -df; \
279 find "$RPM_BUILD_ROOT$i" -name \*.gz -print | xargs -r %{__gzip} -dnf; \
280 find "$RPM_BUILD_ROOT$i" -type f -print | xargs -r %{__gzip} -9nf; \
285 #-----------------------------------------------------------------
286 # Strip executable binaries and shared object files
288 # Requires: find, awk, strip, cut, xargs
290 #%no_install_post_strip 1
291 %__spec_install_post_strip {%{!?debug: \
292 %{!?no_install_post_strip: \
293 %{?verbose:set -x;} \
294 if [ -d "$RPM_BUILD_ROOT" ]; then \
295 echo "Strip executable binaries, archives and shared object files."; \
296 filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" %{?_noautostrip:! -regex "%{_noautostrip}"}`; \
297 elfexelist=`echo $filelist | xargs -r file | \
298 awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \
299 elfsharedlist=`echo $filelist | xargs -r file | \
300 awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \
301 elfarchiveslist=`echo $filelist | xargs -r file | \
302 awk '/current ar archive/ {print $1}' | cut -d: -f1`; \
303 if [ -n "$elfexelist" ]; then \
304 %{__strip} --remove-section=.note --remove-section=.comment $elfexelist; \
306 if [ -n "$elfsharedlist" ]; then \
307 %{__strip} --strip-unneeded --remove-section=.note --remove-section=.comment $elfsharedlist; \
309 if [ -n "$elfarchiveslist" ]; then \
310 %{__strip} --strip-debug --remove-section=.note --remove-section=.comment $elfarchiveslist; \
314 #-----------------------------------------------------------------
315 # remove all RPATH from executable binaries and shared object files
317 # Requires: find, awk, cut, xargs, chrpath, uname
319 #%no_install_post_chrpath 1
320 %__spec_install_post_chrpath {%{!?debug: \
321 %{!?no_install_post_chrpath: \
322 %{?verbose:set -x;} \
323 if [ -d "$RPM_BUILD_ROOT" ]; then \
324 echo "Remove RPATH from executable binaries and shared object files."; \
325 find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*" %{?_noautochrpath:! -regex "%{_noautochrpath}"} | xargs -r file | \
326 awk '/ELF.*(executable.*dynamically linked|shared object)/ {print $1}' | cut -d: -f1 | \
327 while read file ; do \
330 for dir in `chrpath -l "$file" | \
331 awk '/RPATH=/ { gsub(/.*RPATH=/,""); gsub(/:/," "); print $0 }'` ; do \
333 /home/* | /tmp/* | /usr/lib | /usr/lib64 | /lib | /lib64 | /usr/local/lib | /usr/local/lib64 | /usr/X11R6/lib | /usr/X11R6/lib64 ) \
334 echo "remove-rpath: $dir in $file"; \
337 if [ "$rpath" = "" ] ; then rpath="$dir" ; \
338 else rpath="$rpath:$dir" ; fi ; \
342 if [ "$rpath" = "" ] ; then chrpath -d "$file" > /dev/null ; \
343 else chrpath -r "$rpath" "$file" > /dev/null ; fi ; \
347 #-----------------------------------------------------------------
348 # Find and gzip all kernel modules
352 #%no_install_post_compress_modules 1
353 %__spec_install_post_compress_modules { \
354 %{!?no_install_post_compress_modules: \
355 %{?verbose:set -x;} \
356 if [ -d "$RPM_BUILD_ROOT" ]; then \
357 echo "Compress kernel modules if any."; \
358 if test -d $RPM_BUILD_ROOT/lib/modules ; then \
359 find $RPM_BUILD_ROOT/lib/modules -name \*o -type f -print | \
360 xargs -r %{__gzip} -9nf; \
361 find $RPM_BUILD_ROOT/lib/modules -name \*o -type l -printf "%p %l\n" | \
362 while read a b; do ln -sf $b.gz $a.gz; rm -f $a; done; \
367 %_source_payload w9.gzdio
368 %_binary_payload w9.bzdio
370 #-----------------------------------------------------------------
371 # Update GConf2 schemas
375 %gconf_schema_install() \
377 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 \
380 %gconf_schema_uninstall() \
381 if [ $1 = 0 ]; then \
383 GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" /usr/bin/gconftool-2 --makefile-uninstall-rule /etc/gconf/schemas/%{?1} > /dev/null \
387 #-----------------------------------------------------------------
388 # Update desktop MIME database
389 # requries: desktop-file-utils
391 %update_desktop_database_post() {{\
393 /usr/bin/update-desktop-database; \
396 %update_desktop_database_postun() {{\
397 if [ $1 = 0 ]; then \
399 /usr/bin/update-desktop-database; \
403 #-----------------------------------------------------------------
404 # Update scrollkeeper database
405 # requires: scrollkeeper
407 %scrollkeeper_update_post() \
408 /usr/bin/scrollkeeper-update -q; \
411 %scrollkeeper_update_postun() \
412 if [ $1 = 0 ]; then \
413 /usr/bin/scrollkeeper-update -q; \
417 #-----------------------------------------------------------------
418 # Run ldconfig after installing/deinstalling libraries
428 #-----------------------------------------------------------------
429 # post %install sequence:
430 # - autodeps exceptions
431 # - compress all man and info pages,
432 # - strip all ELF executables and ELF shared objects if not %debug.
433 # - compress kernel modules if any
435 ###################################################################
436 # Requires/Provides automation
437 # exceptions system by Jacek Konieczny <jajcus@pld.org.pl>
439 %__noautoreqfiles %(sed -e s'/#.*//' /etc/rpm/noautoreqfiles)%{?_noautoreqfiles: %{_noautoreqfiles}}
440 %__noautoprovfiles %(sed -e s'/#.*//' /etc/rpm/noautoprovfiles)%{?_noautoprovfiles: %{_noautoprovfiles}}
441 %__noautoreq %(sed -e s'/#.*//' /etc/rpm/noautoreq)%{?_noautoreq: %{_noautoreq}}
442 %__noautoreqdep %(sed -e s'/#.*//' /etc/rpm/noautoreqdep)%{?_noautoreqdep: %{_noautoreqdep}}
443 %__noautoprov %(sed -e s'/#.*//' /etc/rpm/noautoprov)%{?_noautoprov: %{_noautoprov}}
444 #%_noautocompressdoc %{nil}
446 %_missing_doc_files_terminate_build 1%{nil}
447 %_unpackaged_files_terminate_build %{nil}
449 %___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;}'
450 %_emacs_lispdir %(emacs %___emacs_lispdir_helper)
451 %_xemacs_lispdir %(xemacs %___emacs_lispdir_helper)
453 %__php_provides %{nil}
454 %__php_requires %{nil}
455 %__perl_provides %{nil}
456 %__perl_requires %{nil}
458 # Perl specific macro definitions.
459 %perl_privlib %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib)
460 %perl_archlib %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib)
461 %perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib)
462 %perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch)
463 %perl_sitelib %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib)
464 %perl_sitearch %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch)
466 %php_pear_dir %{_datadir}/pear
468 # Python specific macro definitions.
469 # python main version
470 %py_ver %(echo `python -c "import sys; print sys.version[:3]"`)
473 %py_prefix %(echo `python -c "import sys; print sys.prefix"`)
474 %py_libdir %{py_prefix}/%{_lib}/python%{py_ver}
475 %py_scriptdir %{py_prefix}/share/python%{py_ver}
476 %py_incdir /usr/include/python%{py_ver}
477 %py_sitedir %{py_libdir}/site-packages
478 %py_sitescriptdir %{py_scriptdir}/site-packages
479 %py_dyndir %{py_libdir}/lib-dynload
481 # pure python modules compilation
482 %py_comp python -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
484 %py_ocomp python -O -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
486 # Software written in Python language require Python with main version
487 %pyrequires_eq() Requires: %1
490 # Hardlink binary identical .pyc and .pyo files
491 # (idea by glen <at> pld-linux <dot> org)
492 %__spec_install_post_py_hardlink {\
493 %{!?no_install_post_py_hardlink: \
494 [ ! -d "$RPM_BUILD_ROOT" ] || find "$RPM_BUILD_ROOT" -name '*.pyc' | while read a; do \
495 b="$(echo $a|sed -e 's/.pyc$/.pyo/')"; \
496 if cmp -s "$a" "$b"; then \
502 # remove python sources, so that check-files won't complain
503 # (idea by glen <at> pld-linux <dot> org)
505 for d in %{py_sitescriptdir} %{py_sitedir}; do \
506 [ ! -d "$RPM_BUILD_ROOT$d" ] || find "$RPM_BUILD_ROOT$d" -name '*.py' -exec rm {} \; ;\
513 if [ -e /boot/System.map-%1 ]; then \
514 /sbin/depmod -a -F /boot/System.map-%1 %1; \
516 if [ -e /boot/System.map ]; then \
517 /sbin/depmod -a -F /boot/System.map %1; \
519 /sbin/depmod -a %1; \
524 # XMMS specific macros
525 %xmms_prefix %(xmms-config --prefix)
526 %xmms_exec_prefix %(xmms-config --exec-prefix)
527 %xmms_version %(xmms-config --version)
528 %xmms_datadir %(xmms-config --data-dir)
529 %xmms_plugindir %(xmms-config --plugin-dir)
530 %xmms_visualization_plugindir %(xmms-config --visualization-plugin-dir)
531 %xmms_input_plugindir %(xmms-config --input-plugin-dir)
532 %xmms_output_plugindir %(xmms-config --output-plugin-dir)
533 %xmms_effect_plugindir %(xmms-config --effect-plugin-dir)
534 %xmms_general_plugindir %(xmms-config --general-plugin-dir)
536 %_target_base_arch %(echo %{_target_cpu} | sed 's/i.86/i386/;s/athlon/i386/;s/pentium./i386/;s/amd64/x86_64/')
538 # user/group checking macros
543 %userremove /usr/lib/rpm/user_group.sh user del
544 %groupremove /usr/lib/rpm/user_group.sh group del
547 # if %usertestrm myuser; then
548 # /usr/sbin/userdel -r myuser
550 # use these macros only if you need to call userdel/groupdel with
551 # a non-standard option or take an extra action; otherwise use the
552 # %userremove/%groupremove macros
554 %usertestrm /usr/lib/rpm/user_group.sh user testrm
555 %grouptestrm /usr/lib/rpm/user_group.sh group testrm
556 # user group membership management macros
559 # %addusertogroup myuser agroup
561 %addusertogroup /usr/lib/rpm/user_group.sh user addtogroup
563 # banner support (useful in {pre,post}{,un} and triggers)
566 # %banner name [-a] [-e] [-n] [-tn] <<EOF
567 # the banner text, the banner text
568 # the banner text, and following line
570 # You can use any form of here-document, <<'EOF' <<-EOT will do.
571 # NOTE: if your use "<<-EOF", then You can actually indent inside here-document.
573 # -a - append to the banner
574 # -e - send to stderr instead of stdout
575 # -n - no show banner (overrides -t)
576 # -t - show only, if RPM_SCRIPTVERBOSITY >= n; default n=5
578 RPM_SCRIPTVERBOSITY=5 \
579 [ -r /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm \
580 if [ -x /usr/bin/banner.sh ]; then \
581 CMD="/usr/bin/banner.sh %{-e:--stderr} %{!-n:$([ $RPM_SCRIPTVERBOSITY -ge %{-t:%{-t*}}%{!-t:5} ] && echo -s)} %{!-a:-m}%{-a:-M} %1" \
583 CMD="cat%{-e: >&2}" \
588 # useradd/groupadd macros written by glen@pld-linux.org.
589 # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada
592 # %useradd [-P package] [-u uid] [-d home_dir] [-s shell] [-c comment]
593 # [-g initial_group] [-G group[,...]] login
596 # -g gid/group. REQUIRED
597 # -s defaults to /bin/false
598 # -d defaults to /usr/share/empty
600 # -r is accepted but ignored (it's always set)
602 # -P package name. defaults to %{name}
604 %useradd(c:d:e:f:g:G:Mmk:op:s:u:rP:) \
605 %{!-u:%{error:useradd: Required argument -u missing}} \
606 %{!-g:%{error:useradd: Required argument -g missing}} \
607 %{!?1:%{error:useradd: Required parameter login missing}} \
608 if [ -n "`/bin/id -u %{expand:%{%{#}}} 2>/dev/null`" ]; then \
609 if [ "`/bin/id -u %{expand:%{%{#}}}`" != "%{-u*}" ]; then \
610 echo "Error: user %{expand:%{%{#}}} doesn't have uid=%{-u*}. Correct this before installing %{-P*}%{!?-P:%{name}}." 1>&2 \
614 echo "Adding user %{expand:%{%{#}}} UID=%{-u*}." \
615 /usr/sbin/useradd \\\
618 -d %{-d*}%{!-d:/usr/share/empty} \\\
619 -s %{-s*}%{!-s:/bin/false} \\\
620 %{-c:-c "%(set -- %{-c*} %{*}; echo $1)"}\\\
624 %{expand:%{%{#}}} 1>&2 \
628 # %groupadd [-P package] [-g gid] group
633 # %groupadd -P %{name}-base -g %{gid} %{name}
636 %{!-g:%{error:groupadd: Required argument -g missing}} \
637 %{!?1:%{error:groupadd: Required parameter group missing}} \
638 if [ -n "`/usr/bin/getgid %{1}`" ]; then \
639 if [ "`/usr/bin/getgid %{1}`" != "%{-g*}" ]; then \
640 echo "Error: group %{1} doesn't have gid=%{-g*}. Correct this before installing %{-P*}%{!?-P:%{name}}." 1>&2 \
644 echo "Adding group %{1} GID=%{-g*}." \
645 /usr/sbin/groupadd -g %{-g*} -r %{1} 1>&2 \