]> git.pld-linux.org Git - packages/rpm-build-macros.git/blobdiff - rpm.macros
- added %systemdunitdir macro
[packages/rpm-build-macros.git] / rpm.macros
index 3443913e2ef93a61a49a88d09f8274621bcbdd2a..c419c2232718fb6791f19644872d2d572f718151 100644 (file)
@@ -503,7 +503,7 @@ CXXFLAGS="%{rpmcxxflags}" \
 #%no_install_post_compress_docs        1
 %__spec_install_post_compress_docs { \
 %{!?no_install_post_compress_docs:__spec_install_post_compress_docs() { \
-       %{!?debug:set +x}; \
+       %{!?debug:set +x;} \
        for i in /usr/share/man /usr/X11R6/man; do \
                if [ -d "$RPM_BUILD_ROOT$i" ]; then \
                        echo "Compress man pages: $i"; \
@@ -552,7 +552,7 @@ CXXFLAGS="%{rpmcxxflags}" \
 #
 %__spec_install_post_strip {%{!?debug: \
 %{!?no_install_post_strip:__spec_install_post_strip() { \
-%{!?debug:set +x}; \
+%{!?debug:set +x;} \
 if [ -d "$RPM_BUILD_ROOT" ]; then \
        if [ -d $RPM_BUILD_ROOT/lib/modules ]; then \
                modulelist=$(find $RPM_BUILD_ROOT/lib/modules -name '*o' -type f -print); \
@@ -623,7 +623,7 @@ fi; }; __spec_install_post_strip } } }
 #
 %__spec_install_post_chrpath {%{!?debug: \
 %{!?no_install_post_chrpath: __spec_install_post_chrpath() { \
-%{!?debug:set +x}; \
+%{!?debug:set +x;} \
 if [ -d "$RPM_BUILD_ROOT" ]; then \
        files=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*" ! -regex ".*/lib/modules/.*" ! -regex ".*%{_docdir}/.*" ! -regex ".*%{_includedir}/.*" %{?_noautochrpath:! -regex "%{_noautochrpath}"}`; \
        if [ -n "$files" ]; then \
@@ -676,7 +676,7 @@ fi; }; __spec_install_post_chrpath } } }
 #
 %__spec_install_post_check_so { \
 __spec_install_post_check_so() { \
-%{!?debug:set +x}; \
+%{!?debug:set +x;} \
        fail=0; \
        printf "Searching for shared objects with unresolved symbols..."; \
        for f in $(find $RPM_BUILD_ROOT -type f -name '*.so.*' -print); do \
@@ -694,7 +694,7 @@ __spec_install_post_check_so() { \
 #%no_install_post_compress_modules     1
 %__spec_install_post_compress_modules { \
 %{!?no_install_post_compress_modules: __spec_install_post_compress_modules() { \
-%{!?debug:set +x}; \
+%{!?debug:set +x;} \
        if [ -d $RPM_BUILD_ROOT/lib/modules ]; then \
                q=$(find $RPM_BUILD_ROOT/lib/modules -name '*o' -type f -print); \
                if [ "$q" ]; then \
@@ -1007,7 +1007,7 @@ fi \
 # 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}; \
+%{!?debug:set +x;} \
 local a b c=0 t=0; \
 if [ -d "$RPM_BUILD_ROOT" ]; then \
        find "$RPM_BUILD_ROOT" -name '*.pyc' > __rpm_pyc; \
@@ -1651,13 +1651,13 @@ for cfg in ${cfgs:-dist}; do                                        \
        %endif                                                                                                                  \
                                                                                                                                        \
        %{!?-c:%{__make} -C %{_kernelsrcdir} clean                                              \\\
-               RCS_FIND_IGNORE="-name '*.ko' -o"                                                       \\\
+               RCS_FIND_IGNORE="-name '*.[ks]o' -o"                                                    \\\
                ${1+"$@"}                                                                                                       \\\
                M=$PWD %{MakeOpts}}                                                                                     \
                                                                                                                                        \
        %{__make} -C %{_kernelsrcdir} modules                                                   \\\
                ${1+"$@"}                                                                                                       \\\
-               M=$PWD %{MakeOpts}                                                                                      \
+               M=$PWD CONSTIFY_PLUGIN="" %{MakeOpts}                                           \
                                                                                                                                        \
        for MODULE in {%{-m*},}; do                                                                             \
                [ -z "${MODULE}" ] || mv ${MODULE}{,-$cfg}.ko                           \
@@ -1694,7 +1694,7 @@ compile %{*}\
 %define ModprobeD $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d/%{_kernel_ver} \
                                                                                                                                        \
 __install_kernel_modules() {                                                                           \
-%{!?debug:set +x}; \
+%{!?debug:set +x;} \
 local cfgs='%{?with_dist_kernel:%{?with_smp: smp}%{?with_up: up}}%{!?with_dist_kernel: nondist}' \
                                                                                                                                        \
 for MODULE in {%{-m*},}; do                                                                                    \
@@ -1875,7 +1875,7 @@ io.open("/etc/shells", "w"):write(s)\
 
 %py_lint() \
 __py_lint() { \
-%{!?debug:set +x}; \
+%{!?debug:set +x;} \
 find "$@" -type f -name '*.py' | python -c ' \
 import sys \
 import compiler \
@@ -2039,4 +2039,57 @@ else: \
 };} \
 %{nil}
 
+
+# pre/post script for -systemd subpackages
+#
+# Author: Bartlomiej Zimon <uzi18@o2.pl>
+#
+# Usage:
+# %systemd_post
+# %systemd_enable service_name.service
+# %systemd_preun  service_name.service
+# %systemd_postun service_name.service
+#
+# Sample:
+# %post systemd
+# %systemd_post
+# or if service must be enabled by default:
+# %post systemd
+# %systemd_post
+# %systemd_enable %{name}
+#
+# %preun systemd
+# %systemd_preun %{name}
+#
+# %postun systemd
+# %systemd_postun %{name}
+#
+# Requirements:
+# BuildRequires: rpmbuild(macros) >= 1.622
+# Requires:     rc-scripts >= ...
+
+%systemd_enable() \
+       if [ $1 -eq 1 ]; then  \
+               /bin/systemctl enable %1 >/dev/null 2>&1 || : \
+       fi
+
+%systemd_post() \
+       if [ $1 -eq 1 ]; then \
+               /bin/systemctl daemon-reload >/dev/null 2>&1 || : \
+       fi
+
+%systemd_preun() \
+       if [ $1 -eq 0 ]; then \
+               /bin/systemctl --no-reload disable %1 > /dev/null 2>&1 || : \
+               /bin/systemctl stop %1 > /dev/null 2>&1 || : \
+       fi
+
+%systemd_postun() \
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || : \
+    if [ $1 -ge 1 ]; then \
+               /bin/systemctl try-restart %1 >/dev/null 2>&1 || : \
+       fi
+
+%systemdunitdir /lib/systemd/system
+
 # EOF
This page took 0.032898 seconds and 4 git commands to generate.