#
%_missing_doc_files_terminate_build 1%{nil}
%_unpackaged_files_terminate_build %{nil}
-# (X)emacs support
-%___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;}'
-%_emacs_lispdir %{expand:%%global _emacs_lispdir %(Z=$(emacs %___emacs_lispdir_helper); echo ${Z:-ERROR})}%_emacs_lispdir
-%_xemacs_lispdir %{expand:%%global _xemacs_lispdir %(Z=$(xemacs %___emacs_lispdir_helper); echo ${Z:-ERROR})}%_xemacs_lispdir
-
-%__perl_provides %{nil}
-%__perl_requires %{nil}
-%__mono_provides %{nil}
-%__mono_requires %{nil}
-
-# Perl specific macro definitions.
-%perl_privlib %{expand:%%global perl_privlib %(eval $(%{__perl} -V:installprivlib 2>/dev/null); echo ${installprivlib:-ERROR})}%perl_privlib
-%perl_archlib %{expand:%%global perl_archlib %(eval $(%{__perl} -V:installarchlib 2>/dev/null); echo ${installarchlib:-ERROR})}%perl_archlib
-%perl_vendorlib %{expand:%%global perl_vendorlib %(eval $(%{__perl} -V:installvendorlib 2>/dev/null); echo ${installvendorlib:-ERROR})}%perl_vendorlib
-%perl_vendorarch %{expand:%%global perl_vendorarch %(eval $(%{__perl} -V:installvendorarch 2>/dev/null); echo ${installvendorarch:-ERROR})}%perl_vendorarch
-%perl_sitelib %{expand:%%global perl_sitelib %(eval $(%{__perl} -V:installsitelib 2>/dev/null); echo ${installsitelib:-ERROR})}%perl_sitelib
-%perl_sitearch %{expand:%%global perl_sitearch %(eval $(%{__perl} -V:installsitearch 2>/dev/null); echo ${installsitearch:-ERROR})}%perl_sitearch
-
-# X.org helper macros
-%__xorg_abi_requires_ge() Requires: xorg-xserver-server(%{expand:%1}-abi) >= %{expand:%{%2}}
-%__xorg_abi_requires_lt() Requires: xorg-xserver-server(%{expand:%1}-abi) < %(awk -vv=%{expand:%{%2}} 'BEGIN{split(v, a, "."); printf("%s.0", a[1] + 1); exit}')
-
-%xorg_xserver_ansic_abi %{expand:%%global xorg_xserver_ansic_abi %(awk '/#define ABI_ANSIC_VERSION/ { split($0,A,/[(,)]/); printf("%d.%d",A[2], A[3]); }' /usr/include/xorg/xf86Module.h 2> /dev/null || echo ERROR)}%xorg_xserver_ansic_abi
-%xorg_xserver_extension_abi %{expand:%%global xorg_xserver_extension_abi %(awk '/#define ABI_EXTENSION_VERSION/ { split($0,A,/[(,)]/); printf("%d.%d",A[2], A[3]); }' /usr/include/xorg/xf86Module.h 2> /dev/null || echo ERROR)}%xorg_xserver_extension_abi
-%xorg_xserver_font_abi %{expand:%%global xorg_xserver_font_abi %(awk '/#define ABI_FONT_VERSION/ { split($0,A,/[(,)]/); printf("%d.%d",A[2], A[3]); }' /usr/include/xorg/xf86Module.h 2> /dev/null | echo ERROR)}%xorg_xserver_font_abi
-%xorg_xserver_videodrv_abi %{expand:%%global xorg_xserver_videodrv_abi %(awk '/#define ABI_VIDEODRV_VERSION/ { split($0,A,/[(,)]/); printf("%d.%d",A[2], A[3]); }' /usr/include/xorg/xf86Module.h 2> /dev/null || echo ERROR)}%xorg_xserver_videodrv_abi
-%xorg_xserver_xinput_abi %{expand:%%global xorg_xserver_xinput_abi %(awk '/#define ABI_XINPUT_VERSION/ { split($0,A,/[(,)]/); printf("%d.%d",A[2], A[3]); }' /usr/include/xorg/xf86Module.h 2> /dev/null || echo ERROR)}%xorg_xserver_xinput_abi
-# vim: '
-
-%requires_xorg_xserver_extension \
-%{__xorg_abi_requires_ge ansic xorg_xserver_ansic_abi} \
-%{__xorg_abi_requires_lt ansic xorg_xserver_ansic_abi} \
-%{__xorg_abi_requires_ge extension xorg_xserver_extension_abi} \
-%{__xorg_abi_requires_lt extension xorg_xserver_extension_abi} \
-%{nil}
-
-%requires_xorg_xserver_xinput \
-%{__xorg_abi_requires_ge ansic xorg_xserver_ansic_abi} \
-%{__xorg_abi_requires_lt ansic xorg_xserver_ansic_abi} \
-%{__xorg_abi_requires_ge xinput xorg_xserver_xinput_abi} \
-%{__xorg_abi_requires_lt xinput xorg_xserver_xinput_abi} \
-%{nil}
-
-%requires_xorg_xserver_font \
-%{__xorg_abi_requires_ge ansic xorg_xserver_ansic_abi} \
-%{__xorg_abi_requires_lt ansic xorg_xserver_ansic_abi} \
-%{__xorg_abi_requires_ge font xorg_xserver_font_abi} \
-%{__xorg_abi_requires_lt font xorg_xserver_font_abi} \
-%{nil}
-
-%requires_xorg_xserver_videodrv \
-%{__xorg_abi_requires_ge ansic xorg_xserver_ansic_abi} \
-%{__xorg_abi_requires_lt ansic xorg_xserver_ansic_abi} \
-%{__xorg_abi_requires_ge videodrv xorg_xserver_videodrv_abi} \
-%{__xorg_abi_requires_lt videodrv xorg_xserver_videodrv_abi} \
-%{nil}
-
-# TCL specific macro definitions.
-# TODO: when th tcl is fixed use tclsh to get version: %(echo 'puts $tcl_version' | tclsh)
-%tcl_version %{expand:%%global tcl_version %(v=$(rpm -q --qf %{V} tcl | cut -d. -f1,2); echo ${v:-ERROR})}%tcl_version
-%tcl_sitearch %{_libdir}/tcl%{tcl_version}
-%tcl_sitelib %{_datadir}/tcl%{tcl_version}
-
-# Python specific macro definitions.
-# python main version
-%py_ver %{expand:%%global py_ver %(%{__python} -c "import sys; print sys.version[:3]" 2>/dev/null || echo ERROR)}%py_ver
-
-# directories
-%py_prefix %{expand:%%global py_prefix %(%{__python} -c "import sys; print sys.prefix" 2>/dev/null || echo ERROR)}%py_prefix
-%py_libdir %{py_prefix}/%{_lib}/python%{py_ver}
-%py_scriptdir %{py_prefix}/share/python%{py_ver}
-%py_incdir /usr/include/python%{py_ver}
-%py_sitedir %{py_libdir}/site-packages
-%py_sitescriptdir %{py_scriptdir}/site-packages
-%py_dyndir %{py_libdir}/lib-dynload
-
-# pure python modules compilation
-%py_comp python -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
-
-%py_ocomp python -O -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
-
-# Software written in Python language require Python with main version
-%pyrequires_eq() Requires: %1
-
-# Python 3.x
-# python main version
-%__python3 /usr/bin/python3
-%py3_ver %{expand:%%global py3_ver %(%{__python3} -c "import sys; print(sys.version[:3])" 2>/dev/null || echo ERROR)}%py3_ver
-
-# directories
-%py3_prefix %{expand:%%global py3_prefix %(%{__python3} -c "import sys; print(sys.prefix)" 2>/dev/null || echo ERROR)}%py3_prefix
-%py3_incdir %{expand:%%global py3_incdir %(%{__python3} -c "import sysconfig; print(sysconfig.get_path('include'))" 2>/dev/null || echo ERROR)}%py3_incdir
-%py3_libdir %{py3_prefix}/%{_lib}/python%{py3_ver}
-%py3_sitedir %{py3_libdir}/site-packages
-%py3_sitescriptdir %{py3_prefix}/share/python%{py3_ver}/site-packages
-%py3_dyndir %{py3_libdir}/lib-dynload
-
-# pure python modules compilation
-%py3_comp %{__python3} -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
-
-%py3_ocomp %{__python3} -O -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
-
-%py_build { \
- LDFLAGS="${LDFLAGS:-%rpmldflags}"; export LDFLAGS; \
- CFLAGS="${CFLAGS:-%rpmcppflags %rpmcflags}"; export CFLAGS; \
- CXXFLAGS="${CXXFLAGS:-%rpmcppflags %rpmcxxflags}"; export CXXFLAGS; \
- %{?__cc:CC="%{__cc}"; export CC;} \
- %{?__cxx:CXX="%{__cxx}"; export CXX;} \
- %{__python} setup.py \
- build --build-base=build-2 \
-}
-
-# "shrink" filter to keep this macro without newlines,
-# so it could be used as make arguments
-%py_install_opts() %{shrink: \
- --prefix=%{_prefix} \
- --install-purelib=%{py_sitescriptdir} \
- --install-platlib=%{py_sitedir} \
- --optimize=2 \
-}
-
-%py_install { \
- LDFLAGS="${LDFLAGS:-%rpmldflags}"; export LDFLAGS; \
- CFLAGS="${CFLAGS:-%rpmcppflags %rpmcflags}"; export CFLAGS; \
- CXXFLAGS="${CXXFLAGS:-%rpmcppflags %rpmcxxflags}"; export CXXFLAGS; \
- %{?__cc:CC="%{__cc}"; export CC;} \
- %{?__cxx:CXX="%{__cxx}"; export CXX;} \
- %{__python} setup.py \
- build --build-base=build-2 \
- install --skip-build \
- %{py_install_opts} \
- --root=$RPM_BUILD_ROOT \
-}
-
-%py3_build { \
- LDFLAGS="${LDFLAGS:-%rpmldflags}"; export LDFLAGS; \
- CFLAGS="${CFLAGS:-%rpmcppflags %rpmcflags}"; export CFLAGS; \
- CXXFLAGS="${CXXFLAGS:-%rpmcppflags %rpmcxxflags}"; export CXXFLAGS; \
- %{?__cc:CC="%{__cc}"; export CC;} \
- %{?__cxx:CXX="%{__cxx}"; export CXX;} \
- %{__python3} setup.py build --build-base=build-3 \
-}
-
-# "shrink" filter to keep this macro without newlines,
-# so it could be used as make arguments
-%py3_install_opts() %{shrink: \
- --prefix=%{_prefix} \
- --install-purelib=%{py3_sitescriptdir} \
- --install-platlib=%{py3_sitedir} \
- --optimize=2 \
-}
-
-%py3_install { \
- LDFLAGS="${LDFLAGS:-%rpmldflags}"; export LDFLAGS; \
- CFLAGS="${CFLAGS:-%rpmcppflags %rpmcflags}"; export CFLAGS; \
- CXXFLAGS="${CXXFLAGS:-%rpmcppflags %rpmcxxflags}"; export CXXFLAGS; \
- %{?__cc:CC="%{__cc}"; export CC;} \
- %{?__cxx:CXX="%{__cxx}"; export CXX;} \
- %{__python3} setup.py \
- build --build-base=build-3 \
- install --skip-build \
- %{py3_install_opts} \
- --root=$RPM_BUILD_ROOT \
-}
# node.js libdir
# Requirements:
# BuildRequires: rpmbuild(macros) >= 1.719
%zsh_compdir /usr/share/zsh/site-functions
-# Hardlink binary identical .pyc and .pyo files
-%__spec_install_post_py_hardlink {\
-%{!?no_install_post_py_hardlink: __spec_install_post_py_hardlink() { \
-%{!?debug:set +x;} \
-local a b c=0 t=0 pyc=%{tmpdir}/%{name}-%{version}-%{release}__rpm_pyc; \
-if [ -d "$RPM_BUILD_ROOT" ]; then \
- find "$RPM_BUILD_ROOT" -name '*.pyc' > $pyc; \
- while read a; do \
- b="${a%.pyc}.pyo"; \
- if cmp -s "$a" "$b"; then \
- ln -f "$a" "$b"; \
- c=$((c + 1)); \
- fi; \
- t=$((t + 1)); \
- done < $pyc; \
- [ $t -gt 0 ] && printf "Hardlink Python files: %d/%d files hardlinked\n" $c $t; \
- rm -f $pyc; \
-fi; \
-}; __spec_install_post_py_hardlink } }
-
-# Remove Python 2.x sources,
-# PLD Linux policy is to package only compiled .py[co] for Python 2.x libraries.
-# Author: Elan Ruusamäe <glen@pld-linux.org>
-#
-# Usage:
-# %py_postclean /usr/share/extra -x keepme.py,keeptoo.py
-# Options:
-# -x - comma separated of file basenames to preserve (rpmbuild(macros) >= 1.658)
-# ARGS - extra directories to clean for .py sources
-#
-# BuildRequires: rpmbuild(macros) >= 1.189
-#
-%py_postclean(x:) \
-for d in %{py_sitescriptdir} %{py_sitedir} %*; do \
- [ ! -d "$RPM_BUILD_ROOT$d" ] || find "$RPM_BUILD_ROOT$d" -name '*.py' -print0 %{-x:| grep -ZzvE '/(%(echo '%{-x*}' | tr ',' '|'))$'} | xargs -0r -l512 rm;\
-done \
-%{nil}
-
# depmod macro
%depmod() { \
umask 022; \
fi; \
}
-# XMMS specific macros
-%xmms_prefix %{expand:%%global xmms_prefix %(xmms-config --prefix 2>/dev/null || echo ERROR)}%xmms_prefix
-%xmms_exec_prefix %{expand:%%global xmms_exec_prefix %(xmms-config --exec-prefix 2>/dev/null || echo ERROR)}%xmms_exec_prefix
-%xmms_version %{expand:%%global xmms_version %(xmms-config --version 2>/dev/null || echo ERROR)}%xmms_version
-%xmms_datadir %{expand:%%global xmms_datadir %(xmms-config --data-dir 2>/dev/null || echo ERROR)}%xmms_datadir
-%xmms_plugindir %{expand:%%global xmms_plugindir %(xmms-config --plugin-dir 2>/dev/null || echo ERROR)}%xmms_plugindir
-%xmms_visualization_plugindir %{expand:%%global xmms_visualization_plugindir %(xmms-config --visualization-plugin-dir 2>/dev/null || echo ERROR)}%xmms_visualization_plugindir
-%xmms_input_plugindir %{expand:%%global xmms_input_plugindir %(xmms-config --input-plugin-dir 2>/dev/null || echo ERROR)}%xmms_input_plugindir
-%xmms_output_plugindir %{expand:%%global xmms_output_plugindir %(xmms-config --output-plugin-dir 2>/dev/null || echo ERROR)}%xmms_output_plugindir
-%xmms_effect_plugindir %{expand:%%global xmms_effect_plugindir %(xmms-config --effect-plugin-dir 2>/dev/null || echo ERROR)}%xmms_effect_plugindir
-%xmms_general_plugindir %{expand:%%global xmms_general_plugindir %(xmms-config --general-plugin-dir 2>/dev/null || echo ERROR)}%xmms_general_plugindir
-
# user/group checking macros
#
# Usage:
[ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i group || : \
fi;
-# webapp macros
-# Author: Elan Ruusamäe <glen@pld-linux.org>
-#
-# The config is installed/removed inside trigger, this means that you can any
-# time install apache1/apache/lighttpd package and the configuration file is
-# updated. if you don't need the config for various reason for specific
-# webserver, just remove the symlink from config directory using webapp
-# program. the trigger will not recreate the symlink on upgrades. In other
-# words the config is linked to webserver config directory on first install of
-# PACKAGE or WEBSERVER.
-#
-# Add package's webserver config to webserver webapps dir.
-# Usage:
-# %webapp_register [-f] WEBSERVER WEBAPP
-#
-%webapp_register(f) \
-%{?debug:set -x; echo "webapp_register: %{name}-%{version}-%{release} 1:[$1]; 2:[$2]"} \
-if [ -n "%{-f:1}" ] || ([ "$1" = "1" ] && [ "$2" = "1" ]); then\
- /usr/sbin/webapp register %1 %2\
-fi\
-# reload webserver if the config symlink is there and skip reload if webserver is upgraded\
-if [ -L /etc/%1/webapps.d/%(echo "%2" | tr '/' '-').conf ] && [ "$2" -lt "2" ]; then\
- %{expand:%service -q %%1 reload}\
-fi\
-%{nil}
-
-# Remove package's config from webserver webapps dir.
-# Usage:
-# %webapp_register [-f] WEBSERVER WEBAPP
-%webapp_unregister(f) \
-%{?debug:set -x; echo "webapp_unregister: %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"} \
-# remove link if either of the packages are gone \
-if [ -n "%{-f:1}" ] || ([ "$1" = "0" ] || [ "$2" = "0" ] && [ -L /etc/%1/webapps.d/%(echo "%2" | tr '/' '-').conf ]); then \
- /usr/sbin/webapp unregister %1 %2\
- %{expand:%service -q %%1 reload}\
-fi \
-%{nil}
-
# service macro.
# Author: Elan Ruusamäe <glen@pld-linux.org>
#
# BuildRequires: rpmbuild(macros) >= 1.450
%service(qn) {{%(export noop=%{-n:1} quiet=%{-q:1} RPM_BUILD_ROOT=%{buildroot}; /usr/lib/rpm/service_generator.sh %{*}) };}
-# Register OpenLDAP schema.
-# Author: Elan Ruusamäe <glen@pld-linux.org>
-#
-# Usage:
-# %%openldap_schema_register [-d core,nis] %{schemadir}/horde.schema
-#
-# -d specify dependant schemas, separated by comma
-#
-%openldap_schema_register(d:) \
-for schema in %*; do \
- if ! grep -q "$schema" /etc/openldap/slapd.conf; then \
- %{__sed} -i -e " \
- /^include.*local.schema/{ \
- iinclude\\t $schema\
- } \
- " /etc/openldap/slapd.conf \
- fi \
-done \
-# enable dependant schemas \
-if [ "%{-d*}" ]; then \
- %{__sed} -i -e ' \
- /^#include.*\\(%(echo '%{-d*}' | %{__sed} -e 's/,/\\\\|/g')\\)\\.schema/{ \
- s/^#// \
- }' /etc/openldap/slapd.conf \
-fi \
-%{nil}
-
-# Unregister OpenLDAP schema.
-# Author: Elan Ruusamäe <glen@pld-linux.org>
-#
-# Usage:
-# %%openldap_schema_unregister %{schemadir}/horde.schema
-#
-%openldap_schema_unregister() \
-for schema in %*; do \
- if grep -q "$schema" /etc/openldap/slapd.conf; then \
- %{__sed} -i -e " \
- /^include.*$(echo "$schema" | %{__sed} -e 's,/,\\\\/,g')/d \
- # for symmetry it would be nice if we disable enabled schemas in post, \
- # but we really can not do that, it would break something else. \
- " /etc/openldap/slapd.conf \
- fi \
-done \
-%{nil}
-
%env_update [ ! -x /sbin/env-update ] || /sbin/env-update -u || :
# patchset macros
# return EXPANDED source url N from current spec
%sourceurl(n:) %(test "$IN_RPM" = 1 && exit 1; export IN_RPM=1; rpmbuild --nodigest --nosignature --nobuild -D "prep %%dump" %{_specdir}/%{name}.spec 2>&1 | awk '$2 ~ /^SOURCEURL%{-n*}/ {print $3}')
-# browser plugins v2
-# Author: Elan Ruusamäe <glen@pld-linux.org>
-#
-# Usage:
-# %browser_plugins_add_browser <name> -p <plugindir>
-#
-# <name> (required) -- name of the browser. usually %{name}.
-# -p <plugindir> (required) -- in what directory browser searches for its plugins.
-# -b -- default blacklists
-# -a <arch> override arch
-#
-# Example:
-# %browser_plugins_add_browser %{name} -p %{_firefoxdir}/plugins
-
-%_browserpluginsconfdir /etc/browser-plugins
-%_browserpluginsdir %{_libdir}/browser-plugins
-%update_browser_plugins /usr/sbin/update-browser-plugins || :
-
-%browser_plugins_add_browser(p:b:a:) \
- browser=%1.%{!-a:%{_target_base_arch}}%{-a*} \
- install -d $RPM_BUILD_ROOT%{_browserpluginsconfdir}/{blacklist,browsers}.d \
- ln -s %{-p*} $RPM_BUILD_ROOT%{_browserpluginsconfdir}/browsers.d/$browser \
- blacklist_file=$RPM_BUILD_ROOT%{_browserpluginsconfdir}/blacklist.d/$browser.blacklist \
- echo '# This file format is shell globs at base dir of plugindir' > $blacklist_file \
- %{-b:cat >> $blacklist_file %{-b*}} \
-%{nil}
-
# Helper for LUA.
# split string separated by space into quoted list
#
%{-p:end} \
%{nil}
-# Check syntax for Python files
-#
-# Author: Elan Ruusamäe <glen@pld-linux.org>
-# Author: Arkadiusz Miśkiewicz <arekm@pld-linux.org>
-#
-# Usage:
-# %py_lint src
-#
-# Requirements:
-# BuildRequires: python
-# BuildRequires: rpmbuild(macros) >= 1.602
-
-%py_lint() \
-__py_lint() { \
-%{!?debug:set +x;} \
-find "$@" -type f -name '*.py' | python -c ' \
-import sys \
-import compiler \
-\
-found = err = 0\
-for f in sys.stdin: \
- fd = open(f.rstrip()) \
- c = fd.read() \
- fd.close() \
- found = found + 1 \
- try: \
- compiler.parse(c) \
- except SyntaxError, e: \
- print "py_lint: %s: %s" % (f.rstrip(), e) \
- err = err + 1\
-\
-if not found:\
- print >> sys.stderr, "\\npy_lint: ERROR: No files processed.\\n" \
- sys.exit(1) \
-elif err: \
- print >> sys.stderr, "\\npy_lint: ERROR: Syntax errors in %d files.\\n" % err \
- sys.exit(1) \
-else: \
- print >> sys.stderr, "py_lint: %d files scanned, found no syntax errors." % found \
-' \
-}; __py_lint %* \
-%{nil}
-
# Undos files
#
# Author: Paweł Zuzelski <pawelz@pld-linux.org>
%undos(f:i) %{-f:%{__find} -type f -regextype posix-extended -%{-i:i}regex '^.+\\.(%(echo %{-f*} | tr ',' '|'))$' -print0 | xargs -0} %{__sed} -i -e 's,\\r$,,' %* \
%{nil}
-# Hook to register nagios object based plugins in Nagios NRPE daemon config.
-#
-# Author: Elan Ruusamäe <glen@pld-linux.org>
-#
-# Usage:
-# -a NAME -- add command named NAME
-# -d NAME -- remove command named NAME
-# -f FILE -- specify plugin configuration FILE to extract command definition from
-#
-# Sample:
-# %triggerin -- nagios-nrpe
-# %nagios_nrpe -a %{plugin} -f %{_sysconfdir}/%{plugin}.cfg
-#
-# %triggerun -- nagios-nrpe
-# %nagios_nrpe -d %{plugin} -f %{_sysconfdir}/%{plugin}.cfg
-#
-# Requirements:
-# Requires: grep
-# Requires: sed >= 4.0
-# BuildRequires: rpmbuild(macros) >= 1.685
-%nagios_nrpe(a:d:c:f:) {\
- if %{__grep} -q '^include_dir=/etc/nagios/nrpe.d' /etc/nagios/nrpe.cfg && [ -d /etc/nagios/nrpe.d ]; then \
- file=/etc/nagios/nrpe.d/%{-a*}%{-d*}.cfg; \
- else \
- file=/etc/nagios/nrpe.cfg; \
- fi; \
- m=$(test -f $file && md5sum < $file); \
- %{-a:# on -a and config exists \
- if [ -f /etc/nagios/nrpe.cfg ]; then \
- if [ ! -f $file ] || ! %{__grep} -q '^command\[%{-a*}\]' $file; then \
- %{__sed} -ne 's/^[ \t]*command_line[ \t]\+\(.\+\)/command[%{-a*}]=\1/p' %{-f*} >> $file; \
- fi; \
- fi;} \
- %{-d:# on package remove, -d and config exists \
- if [ "$1" = "0" -a -f $file ]; then \
- %{__sed} -i -e '/^[ \t]*command\[%{-d*}\]/d' $file; \
- fi;} \
- if [ "$m" != "$(md5sum < $file)" ]; then \
- %service -q nrpe restart; \
- fi; \
-}%{nil}
-
-# Import or update Cacti template.
-#
-# Author: Elan Ruusamäe <glen@pld-linux.org>
-#
-# Usage:
-# %cacti_import_template XMLFILE
-# XMLFILE -- XML template to import
-#
-# Sample:
-# %post
-# %cacti_import_template %{resourcedir}/cacti_host_template_varnish.xml
-#
-# Requires: cacti >= 0.8.7e-8
-# BuildRequires: rpmbuild(macros) >= 1.630
-# Note: 1.1 (cacti-0.8.7h) adds requirement for --with-template-rras or --with-user-rras option
-
-%cacti_import_template() {\
-v=$(%{__sed} -rne 's/.+Add Graphs Script ([0-9\.]+).+/\1/p' /usr/share/cacti/cli/import_template.php); \
-if [ "$v" != "1.0" ]; then \
- rra="--with-template-rras"; \
-fi; \
-/usr/share/cacti/cli/import_template.php --filename=%1 $rra || :; \
-}%{nil}
-
-# pre/post script for -upstart subpackages
-#
-# Author: Jacek Konieczny <jajcus@jajcus.net>
-# Author: Elan Ruusamäe <glen@pld-linux.org>
-#
-# Usage:
-# %upstart_post service_name
-# %upstart_postun service_name
-#
-# Sample:
-# %post upstart
-# %upstart_post %{name}
-#
-# %postun upstart
-# %upstart_postun %{name}
-#
-# Requirements:
-# BuildRequires: rpmbuild(macros) >= 1.690
-# Requires: rc-scripts >= 0.4.3
-
-# migrate from init script to upstart job
-%upstart_post() \
- if [ -x /sbin/initctl ] && [ -f /var/lock/subsys/%1 ]; then \
- /sbin/service --no-upstart %1 stop \
- /sbin/service %1 start \
- fi \
-%{nil}
-
-# restart the job after upgrade or migrate to init script on removal
-# cannot be stopped with 'service' as /etc/init/$name.conf may be missing
-# at this point
-%upstart_postun() \
- if [ -x /sbin/initctl ] && /sbin/initctl status %1 2>/dev/null | grep -q 'running' ; then \
- /sbin/initctl stop %1 >/dev/null 2>&1 \
- [ -f /etc/rc.d/init.d/%1 -o -f /etc/init/%1.conf ] && { echo -n "Re-"; /sbin/service %1 start; }; \
- fi \
-%{nil}
-
-# Haskell Macros
-# BuildRequires: rpmbuild(macros) >= 1.608
-%ghcdir ghc-%(/usr/bin/ghc --numeric-version 2>/dev/null || echo ERROR)
-
-# update /usr/lib*/ghc-*/package.conf.d/package.cache
-# Requires: ghc
-# BuildRequires: rpmbuild(macros) >= 1.607
-#
-%ghc_pkg_recache() {{ \
- umask 022; \
- [ ! -x /usr/bin/ghc-pkg ] || /usr/bin/ghc-pkg recache; \
-};} \
-%{nil}
-
-
-# pre/post script for packages supporting systemd units
-#
-# Authors: Bartlomiej Zimon <uzi18@o2.pl>
-# Jan Rękorajski <baggins@mimuw.edu.pl>
-#
-# Usage:
-# %systemd_reload
-# %systemd_service <unit command> service_name1.service service_name2.service
-# %systemd_service_enable service_name1.service service_name2.service
-# %systemd_service_disable service_name1.service service_name2.service
-# %systemd_service_start service_name1.service service_name2.service
-# %systemd_service_stop service_name1.service service_name2.service
-# %systemd_service_restart service_name1.service service_name2.service
-# %systemd_service_reload service_name1.service service_name2.service
-#
-# %systemd_post service_name1.service service_name2.service
-# %systemd_preun service_name1.service service_name2.service
-# %systemd_trigger service_name1.service service_name2.service
-#
-# Sample:
-# %post
-# %systemd_post %{name}.service
-#
-# %preun
-# %systemd_preun %{name}.service
-#
-# %postun
-# %systemd_reload
-#
-# %triggerpostun -- %{name} < first-version-with-systemd-units
-# %systemd_trigger %{name}.service
-#
-# Requirements:
-# BuildRequires: rpmbuild(macros) >= 1.671
-# Requires: systemd-units >= 38
-
-%systemd_reload /bin/systemd_booted && SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog /bin/systemctl daemon-reload || :
-
-%systemd_service_enable() \
- export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \
- /bin/systemctl preset --preset-mode=enable-only %{*} || : \
- /bin/systemd_booted && echo 'Run "/bin/systemctl start %{*}" to start %{*}.' || : \
-%{nil}
-
-%systemd_service_disable() \
- export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \
- /bin/systemctl --quiet disable %{*} || : \
-%{nil}
-
-%systemd_service() \
- export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \
- /bin/systemd_booted && /bin/systemctl %{*} || : \
-%{nil}
-
-%systemd_service_start() \
- export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \
- /bin/systemd_booted && /bin/systemctl start %{*} || : \
-%{nil}
-
-%systemd_service_stop() \
- export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \
- /bin/systemd_booted && /bin/systemctl stop %{*} || : \
-%{nil}
-
-# NOTE: doesn't honour RPM_SKIP_AUTO_RESTART, avoid using
-%systemd_service_restart() \
- export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \
- /bin/systemd_booted && /bin/systemctl try-restart %{*} || : \
-%{nil}
-
-# NOTE: doesn't honour RPM_SKIP_AUTO_RESTART, avoid using
-%systemd_service_reload() \
- export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \
- /bin/systemd_booted && /bin/systemctl reload %{*} || : \
-%{nil}
-
-# NOTE: this trigger disobeys systemd.preset in favour of RPM_ENABLE_SYSTEMD_SERVICE
-%systemd_trigger() \
-want_enable_service() { \
- [ -f /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm \
- [ ${RPM_ENABLE_SYSTEMD_SERVICE:-yes} = no ] && return 1 \
- [ "$(echo /etc/rc.d/rc[0-6].d/S[0-9][0-9]${1%.service})" = "/etc/rc.d/rc[0-6].d/S[0-9][0-9]${1%.service}" ] && return 1 \
- return 0 \
-}\
- export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \
- for s in %{*}; do \
- if want_enable_service $s; then \
- /bin/systemctl enable $s || : \
- fi \
- done \
-%{nil}
-
-%systemd_post() \
- export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \
- /bin/systemd_booted && /bin/systemctl daemon-reload || : \
- if [ $1 -eq 1 ]; then \
- /bin/systemctl preset --preset-mode=enable-only %{*} >/dev/null || : \
- /bin/systemd_booted && echo 'Run "/bin/systemctl start %{*}" to start %{*}.' || : \
- elif [ -z "$NORESTART" ]; then \
- /bin/systemd_booted && /bin/systemctl try-restart %{*} || : \
- else \
- /bin/systemd_booted && echo 'Run "/bin/systemctl restart %{*}" to restart %{*}.' || : \
- fi \
-%{nil}
-
-%systemd_preun() \
- if [ $1 -eq 0 ]; then \
- export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \
- /bin/systemd_booted && /bin/systemctl stop %{*} || : \
- /bin/systemctl --quiet disable %{*} || : \
- fi \
-%{nil}
-
-%systemdunitdir /lib/systemd/system
-%systemduserunitdir /usr/lib/systemd/user
-%systemdtmpfilesdir /usr/lib/tmpfiles.d
-
-# BuildRequires: rpmbuild(macros) >= 1.721
-%journal_catalog_update() [ ! -x /bin/journalctl ] || /bin/journalctl --update-catalog >/dev/null 2>&1 || :
-
#-----------------------------------------------------------------
# Update hardware database index
#