View | Details | Raw Unified | Return to bug 968405
Collapse All | Expand All

(-)macros.systemd (-10 / +37 lines)
Lines 50-67 Link Here
50
%_ntpunitsdir /usr/lib/systemd/ntp-units.d
50
%_ntpunitsdir /usr/lib/systemd/ntp-units.d
51
%_binfmtdir /usr/lib/binfmt.d
51
%_binfmtdir /usr/lib/binfmt.d
52
52
53
%restart_on_update default
54
%stop_on_remove    default
55
53
%_restart_check_systemctl								\
56
%_restart_check_systemctl								\
54
	test "$DISABLE_RESTART_ON_UPDATE" = yes && exit 0				\
57
%if "%{restart_on_update}" == "never"							\
58
	exit 0										\
59
%else											\
60
	test "$YAST_IS_RUNNING" = instsys     && exit 0					\
61
%if "%{restart_on_update}" == "default"							\
62
	test "$DISABLE_RESTART_ON_UPDATE" = yes -o					\
63
	     "$DISABLE_RESTART_ON_UPDATE" = 1 && exit 0					\
55
	test -f /etc/sysconfig/services && . /etc/sysconfig/services			\
64
	test -f /etc/sysconfig/services && . /etc/sysconfig/services			\
56
	test "$YAST_IS_RUNNING" = instsys       && exit 0				\
65
	test "$DISABLE_RESTART_ON_UPDATE" = yes -o					\
57
	test "$DISABLE_RESTART_ON_UPDATE" = yes && exit 0				\
66
	     "$DISABLE_RESTART_ON_UPDATE" = 1 && exit 0					\
67
%endif											\
68
%endif											\
58
	/usr/bin/systemctl try-restart %{nil}
69
	/usr/bin/systemctl try-restart %{nil}
59
70
60
%_stop_check_systemctl									\
71
%_stop_check_systemctl									\
61
	test "$DISABLE_STOP_ON_REMOVAL" = yes && exit 0					\
72
%if "%{stop_on_remove}" == "never"							\
73
	exit 0										\
74
%else											\
75
	test "$YAST_IS_RUNNING" = instsys   && exit 0					\
76
%if "%{stop_on_remove}" == "default"							\
77
	test "$DISABLE_STOP_ON_REMOVAL" = yes -o					\
78
	     "$DISABLE_STOP_ON_REMOVAL" = 1 && exit 0					\
62
	test -f /etc/sysconfig/services && . /etc/sysconfig/services			\
79
	test -f /etc/sysconfig/services && . /etc/sysconfig/services			\
63
	test "$YAST_IS_RUNNING" = instsys     && exit 0					\
80
	test "$DISABLE_STOP_ON_REMOVAL" = yes -o					\
64
	test "$DISABLE_STOP_ON_REMOVAL" = yes && exit 0					\
81
	     "$DISABLE_STOP_ON_REMOVAL" = 1 && exit 0					\
82
%endif											\
83
%endif											\
65
	/usr/bin/systemctl stop %{nil}
84
	/usr/bin/systemctl stop %{nil}
66
85
67
%service_add_pre()									\
86
%service_add_pre()									\
Lines 130-136 Link Here
130
%{nil}
149
%{nil}
131
150
132
# On uninstall, disable and stop services
151
# On uninstall, disable and stop services
133
%service_del_preun()									\
152
%service_del_preun(fn)									\
153
%{-f:%global stop_on_remove force}							\
154
%{-n:%global stop_on_remove never}							\
134
test -n "$FIRST_ARG" || FIRST_ARG="$1"							\
155
test -n "$FIRST_ARG" || FIRST_ARG="$1"							\
135
if [ "$FIRST_ARG" -eq 0 -a -x /usr/bin/systemctl ]; then				\
156
if [ "$FIRST_ARG" -eq 0 -a -x /usr/bin/systemctl ]; then				\
136
	# Package removal, not upgrade							\
157
	# Package removal, not upgrade							\
Lines 140-146 Link Here
140
%{nil}
161
%{nil}
141
162
142
# On uninstall, tell systemd to reload its unit files
163
# On uninstall, tell systemd to reload its unit files
143
%service_del_postun()									\
164
%service_del_postun(fn)									\
165
%{-f:%global restart_on_update force}							\
166
%{-n:%global restart_on_update never}							\
144
test -n "$FIRST_ARG" || FIRST_ARG="$1"							\
167
test -n "$FIRST_ARG" || FIRST_ARG="$1"							\
145
if [ "$FIRST_ARG" -ge 1 ]; then								\
168
if [ "$FIRST_ARG" -ge 1 ]; then								\
146
	# Package upgrade, not uninstall						\
169
	# Package upgrade, not uninstall						\
Lines 159-165 Link Here
159
fi											\
182
fi											\
160
%{nil}
183
%{nil}
161
184
162
%systemd_post()										\
185
%systemd_post(fn)									\
186
%{-f:%global stop_on_remove force}							\
187
%{-n:%global stop_on_remove never}							\
163
if [ "$1" -eq 0 -a -x /usr/bin/systemctl ]; then					\
188
if [ "$1" -eq 0 -a -x /usr/bin/systemctl ]; then					\
164
	# Package removal, not upgrade							\
189
	# Package removal, not upgrade							\
165
	/usr/bin/systemctl --no-reload disable %{?*} || :				\
190
	/usr/bin/systemctl --no-reload disable %{?*} || :				\
Lines 169-175 Link Here
169
194
170
%systemd_user_post() %systemd_post --user --global %{?*}
195
%systemd_user_post() %systemd_post --user --global %{?*}
171
196
172
%systemd_preun()									\
197
%systemd_preun(fn)									\
198
%{-f:%global stop_on_remove force}							\
199
%{-n:%global stop_on_remove never}							\
173
if [ "$1" -eq 0 -a -x /usr/bin/systemctl ]; then					\
200
if [ "$1" -eq 0 -a -x /usr/bin/systemctl ]; then					\
174
	# Package removal, not upgrade							\
201
	# Package removal, not upgrade							\
175
	/usr/bin/systemctl --no-reload disable %{?*} || :				\
202
	/usr/bin/systemctl --no-reload disable %{?*} || :				\

Return to bug 968405