-# Reload init system configuration, to make systemd honour changed
-# or deleted unit files
-/bin/systemctl daemon-reload >/dev/null 2>&1 || :
-if [ $1 -ge 1 ] ; then
- # On upgrade (not uninstall), optionally, restart the daemon
- /bin/systemctl try-restart foobar.service >/dev/null 2>&1 || :
-fi</programlisting>
-
- <para>Depending on whether your service should
- or should not be started/stopped/restarted
- during package installation, deinstallation or
- upgrade, a different set of commands may be
- specified. See
- <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
- for details.</para>
+%systemd_postun</programlisting>
+
+ <para>If the service shall be restarted during
+ upgrades replace the
+ <literal>%postun</literal> scriptlet above
+ with the following:</para>
+
+ <programlisting>%postun
+%systemd_postun_with_restart foobar.service</programlisting>
+
+ <para>Note that
+ <literal>%systemd_post</literal> and
+ <literal>%systemd_preun</literal> expect the
+ names of all units that are installed/removed
+ as arguments, separated by
+ spaces. <literal>%systemd_postun</literal>
+ expects no
+ arguments. <literal>%systemd_postun_with_restart</literal>
+ expects the units to restart as
+ arguments.</para>