SHA256
1
0
forked from pool/systemd
systemd/macros.systemd
Stephan Kulow 8f6010ffdf Accepting request 215598 from Base:System
- Change patch 0001-add-hdflush-for-reboot-or-hddown-for-poweroff.patch
  to skip already by the kernel managed devices 

- fix timeout stopping user@.service (bnc#841544)
  * 0001-core-introduce-new-KillMode-mixed-which-sends-SIGTER.patch
  * 0002-service-allow-KillMode-mixed-in-conjunction-with-PAM.patch
  * 0003-core-make-sure-to-always-go-through-both-SIGTERM-and.patch

- Add patch 0001-upstream-systemctl-halt-reboot-error-handling.patch
  to be able to detect if the sysctl reboot() returns.
- Add patch 0001-add-hdflush-for-reboot-or-hddown-for-poweroff.patch
  A check for unmaintained disk like devices is added to be able to
  flush and maybe shut them down.  Also the missing sync() system
  call is added for the direct halt/reboot systemctl command. Then
  the system halt is used as fallback if poweroff fails for both
  the direct poweroff systemctl command as well as for the
  systemd-shutdown utility.

- Make systemd-mini build 

- Make requires bash-completion a recommends

- Add patch 1017-skip-native-unit-handling-if-sysv-already-handled.patch
  to avoid that enabled boot scripts will be handled as unit files
  by systemctl status command (bnc#818044)

- Drop patch 1017-enforce-sufficient-shutdown-warnings.patch
  as the original code behaves exactly as the shutdown code of
  the old SysVinit (bnc#750845)
- Rename support-powerfail-with-powerstatus.patch to

OBS-URL: https://build.opensuse.org/request/show/215598
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=173
2014-01-31 12:36:06 +00:00

130 lines
4.2 KiB
Plaintext

# -*- Mode: makefile; indent-tabs-mode: t -*- */
# RPM macros for packages installing systemd unit files
#
###
#
# When a package install systemd unit files, it should use the following macros:
#
# add %systemd_requires in the specfile
#
# %pre
# %service_add_pre demo.service demo1.service
#
# %post
# %service_add_post demo.service demo1.service
#
# %preun
# %service_del_preun demo.service
#
# %postun
# %service_del_postun demo.service
#
###
# This is for systemctl
%systemd_requires \
Requires(pre): systemd \
Requires(post): systemd \
Requires(preun): systemd \
Requires(postun): systemd \
%_unitdir /usr/lib/systemd/system
%_presetdir /usr/lib/systemd/system-preset
%_udevhwdbdir /usr/lib/udev/hwdb.d
%_udevrulesdir /usr/lib/udev/rules.d
%_journalcatalogdir /usr/lib/systemd/catalog
%_tmpfilesdir /usr/lib/tmpfiles.d
%_sysctldir /usr/lib/sysctl.d
%service_add_pre() \
test -n "$FIRST_ARG" || FIRST_ARG=$1 \
# disable migration if initial install under systemd \
[ -d /var/lib/systemd/migrated ] || mkdir -p /var/lib/systemd/migrated || : \
if [ $FIRST_ARG -eq 1 ]; then \
for service in %{?*} ; do \
sysv_service=${service%.*} \
touch "/var/lib/systemd/migrated/$sysv_service" || : \
done \
else \
if [ $FIRST_ARG -gt 1 ]; then \
for service in %{?*} ; do \
if [ ! -e "/usr/lib/systemd/system/$service" ]; then \
touch "/run/rpm-%{name}-update-$service-new-in-upgrade" \
fi \
done \
fi \
for service in %{?*} ; do \
sysv_service=${service%.*} \
if [ ! -e "/var/lib/systemd/migrated/$sysv_service" ]; then \
services_to_migrate="$services_to_migrate $sysv_service" \
fi \
done \
if [ -n "$services_to_migrate" ]; then \
/usr/sbin/systemd-sysv-convert --save $services_to_migrate >/dev/null 2>&1 || : \
fi \
fi \
%{nil}
# On install, tell systemd to reload its unit files
%service_add_post() \
test -n "$FIRST_ARG" || FIRST_ARG=$1 \
[ -d /var/lib/systemd/migrated ] || mkdir -p /var/lib/systemd/migrated || : \
for service in %{?*} ; do \
sysv_service=${service%.*} \
if [ ! -e "/var/lib/systemd/migrated/$sysv_service" ]; then \
services_to_migrate="$services_to_migrate $sysv_service" \
touch "/var/lib/systemd/migrated/$sysv_service" || : \
fi \
done \
/usr/bin/systemctl daemon-reload >/dev/null 2>&1 || : \
if [ -n "$services_to_migrate" ]; then \
/usr/sbin/systemd-sysv-convert --apply $services_to_migrate >/dev/null 2>&1 || : \
elif [ $FIRST_ARG -eq 1 ]; then \
/usr/bin/systemctl preset %{?*} >/dev/null 2>&1 || : \
elif [ $FIRST_ARG -gt 1 ]; then \
for service in %{?*} ; do \
if [ -e "/run/rpm-%{name}-update-$service-new-in-upgrade" ]; then \
rm -f "/run/rpm-%{name}-update-$service-new-in-upgrade" \
/usr/bin/systemctl preset "$service" >/dev/null 2>&1 || : \
fi \
done \
fi \
%{nil}
# On uninstall, disable and stop services
%service_del_preun() \
test -n "$FIRST_ARG" || FIRST_ARG=$1 \
if [ $FIRST_ARG -eq 0 ]; then \
# Package removal, not upgrade \
/usr/bin/systemctl --no-reload disable %{?*} > /dev/null 2>&1 || : \
/usr/bin/systemctl stop %{?*} > /dev/null 2>&1 || : \
fi \
%{nil}
# On uninstall, tell systemd to reload its unit files
%service_del_postun() \
test -n "$FIRST_ARG" || FIRST_ARG=$1 \
if [ $FIRST_ARG -ge 1 ]; then \
# Package upgrade, not uninstall \
/usr/bin/systemctl try-restart %{?*} >/dev/null 2>&1 || : \
else # package uninstall \
for service in %{?*} ; do \
sysv_service=${service%.*} \
rm -f "/var/lib/systemd/migrated/$sysv_service" 2> /dev/null || : \
done \
/usr/bin/systemctl daemon-reload >/dev/null 2>&1 || : \
fi \
%{nil}
%udev_hwdb_update() \
/usr/bin/udevadm hwdb --update >/dev/null 2>&1 || : \
%{nil}
%udev_rules_update() \
/usr/bin/udevadm control --reload >/dev/null 2>&1 || : \
%{nil}
%journal_catalog_update() \
/usr/bin/journalctl --update-catalog >/dev/null 2>&1 || : \
%{nil}