Accepting request 684199 from Base:System
OBS-URL: https://build.opensuse.org/request/show/684199 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd-rpm-macros?expand=0&rev=28
This commit is contained in:
commit
d1fdb9ed76
@ -72,10 +72,9 @@ OrderWithRequires(postun): systemd \
|
|||||||
%{nil}
|
%{nil}
|
||||||
|
|
||||||
%service_add_pre() \
|
%service_add_pre() \
|
||||||
test -n "$FIRST_ARG" || FIRST_ARG="$1" \
|
|
||||||
# disable migration if initial install under systemd \
|
# disable migration if initial install under systemd \
|
||||||
[ -d /var/lib/systemd/migrated ] || mkdir -p /var/lib/systemd/migrated || : \
|
[ -d /var/lib/systemd/migrated ] || mkdir -p /var/lib/systemd/migrated || : \
|
||||||
if [ "$FIRST_ARG" -eq 1 ]; then \
|
if [ $1 -eq 1 ]; then \
|
||||||
for service in %{?*} ; do \
|
for service in %{?*} ; do \
|
||||||
sysv_service="${service%%.*}" \
|
sysv_service="${service%%.*}" \
|
||||||
touch "/var/lib/systemd/migrated/$sysv_service" || : \
|
touch "/var/lib/systemd/migrated/$sysv_service" || : \
|
||||||
@ -105,18 +104,17 @@ fi \
|
|||||||
|
|
||||||
# On install, tell systemd to reload its unit files
|
# On install, tell systemd to reload its unit files
|
||||||
%service_add_post() \
|
%service_add_post() \
|
||||||
test -n "$FIRST_ARG" || FIRST_ARG="$1" \
|
|
||||||
[ -d /var/lib/systemd/migrated ] || mkdir -p /var/lib/systemd/migrated || : \
|
[ -d /var/lib/systemd/migrated ] || mkdir -p /var/lib/systemd/migrated || : \
|
||||||
\
|
\
|
||||||
if [ -x /usr/bin/systemctl ]; then \
|
if [ -x /usr/bin/systemctl ]; then \
|
||||||
/usr/bin/systemctl daemon-reload || : \
|
/usr/bin/systemctl daemon-reload || : \
|
||||||
fi \
|
fi \
|
||||||
\
|
\
|
||||||
if [ "$FIRST_ARG" -eq 1 ]; then \
|
if [ $1 -eq 1 ]; then \
|
||||||
if [ -x /usr/bin/systemctl ]; then \
|
if [ -x /usr/bin/systemctl ]; then \
|
||||||
/usr/bin/systemctl preset %{?*} || : \
|
/usr/bin/systemctl preset %{?*} || : \
|
||||||
fi \
|
fi \
|
||||||
elif [ "$FIRST_ARG" -gt 1 ]; then \
|
elif [ $1 -gt 1 ]; then \
|
||||||
for service in %{?*} ; do \
|
for service in %{?*} ; do \
|
||||||
if [ ! -e "/run/rpm-%{name}-update-$service-new-in-upgrade" ]; then \
|
if [ ! -e "/run/rpm-%{name}-update-$service-new-in-upgrade" ]; then \
|
||||||
continue \
|
continue \
|
||||||
@ -150,8 +148,7 @@ fi \
|
|||||||
# variable if not found use the value read from /etc/sysconfig/services
|
# variable if not found use the value read from /etc/sysconfig/services
|
||||||
#
|
#
|
||||||
%service_del_preun(fn) \
|
%service_del_preun(fn) \
|
||||||
test -n "$FIRST_ARG" || FIRST_ARG="$1" \
|
if [ $1 -eq 0 -a -x /usr/bin/systemctl ]; then \
|
||||||
if [ "$FIRST_ARG" -eq 0 -a -x /usr/bin/systemctl ]; then \
|
|
||||||
# Package removal, not upgrade \
|
# Package removal, not upgrade \
|
||||||
/usr/bin/systemctl --no-reload disable %{?*} || : \
|
/usr/bin/systemctl --no-reload disable %{?*} || : \
|
||||||
%{expand:%%_stop_on_removal%{-f:_force}%{!-f:%{-n:_never}} %{?*}} \
|
%{expand:%%_stop_on_removal%{-f:_force}%{!-f:%{-n:_never}} %{?*}} \
|
||||||
@ -162,8 +159,7 @@ fi \
|
|||||||
# On update, tell systemd to reload its unit files but don't restart service.
|
# On update, tell systemd to reload its unit files but don't restart service.
|
||||||
#
|
#
|
||||||
%service_del_postun_without_restart() \
|
%service_del_postun_without_restart() \
|
||||||
test -n "$FIRST_ARG" || FIRST_ARG="$1" \
|
if [ $1 -eq 0 ]; then \
|
||||||
if [ "$FIRST_ARG" -eq 0 ]; then \
|
|
||||||
# Package removal \
|
# Package removal \
|
||||||
for service in %{?*} ; do \
|
for service in %{?*} ; do \
|
||||||
sysv_service="${service%.*}" \
|
sysv_service="${service%.*}" \
|
||||||
@ -184,9 +180,8 @@ fi \
|
|||||||
# variable if not found use the value read from /etc/sysconfig/services
|
# variable if not found use the value read from /etc/sysconfig/services
|
||||||
#
|
#
|
||||||
%service_del_postun(fn) \
|
%service_del_postun(fn) \
|
||||||
test -n "$FIRST_ARG" || FIRST_ARG="$1" \
|
|
||||||
%service_del_postun_without_restart %{?*} \
|
%service_del_postun_without_restart %{?*} \
|
||||||
if [ "$FIRST_ARG" -ge 1 ]; then \
|
if [ $1 -ge 1 ]; then \
|
||||||
# Package upgrade, not uninstall \
|
# Package upgrade, not uninstall \
|
||||||
if [ -x /usr/bin/systemctl ]; then \
|
if [ -x /usr/bin/systemctl ]; then \
|
||||||
%{expand:%%_restart_on_update%{-f:_force}%{!-f:%{-n:_never}} %{?*}} \
|
%{expand:%%_restart_on_update%{-f:_force}%{!-f:%{-n:_never}} %{?*}} \
|
||||||
@ -215,7 +210,7 @@ fi \
|
|||||||
# variable if not found use the value read from /etc/sysconfig/services
|
# variable if not found use the value read from /etc/sysconfig/services
|
||||||
#
|
#
|
||||||
%systemd_preun(fn) \
|
%systemd_preun(fn) \
|
||||||
if [ "$1" -eq 0 -a -x /usr/bin/systemctl ]; then \
|
if [ $1 -eq 0 -a -x /usr/bin/systemctl ]; then \
|
||||||
# Package removal, not upgrade \
|
# Package removal, not upgrade \
|
||||||
/usr/bin/systemctl --no-reload disable %{?*} || : \
|
/usr/bin/systemctl --no-reload disable %{?*} || : \
|
||||||
%{expand:%%_stop_on_removal%{-f:_force}%{!-f:%{-n:_never}} %{?*}} \
|
%{expand:%%_stop_on_removal%{-f:_force}%{!-f:%{-n:_never}} %{?*}} \
|
||||||
@ -223,7 +218,7 @@ fi \
|
|||||||
%{nil}
|
%{nil}
|
||||||
|
|
||||||
%systemd_user_preun() \
|
%systemd_user_preun() \
|
||||||
if [ "$1" -eq 0 -a -x /usr/bin/systemctl ]; then \
|
if [ $1 -eq 0 -a -x /usr/bin/systemctl ]; then \
|
||||||
# Package removal, not upgrade \
|
# Package removal, not upgrade \
|
||||||
/usr/bin/systemctl --global disable %{?*} || : \
|
/usr/bin/systemctl --global disable %{?*} || : \
|
||||||
fi \
|
fi \
|
||||||
@ -242,7 +237,7 @@ fi \
|
|||||||
if [ -x /usr/bin/systemctl ]; then \
|
if [ -x /usr/bin/systemctl ]; then \
|
||||||
/usr/bin/systemctl daemon-reload || : \
|
/usr/bin/systemctl daemon-reload || : \
|
||||||
fi \
|
fi \
|
||||||
if [ "$1" -ge 1 -a -x /usr/bin/systemctl ]; then \
|
if [ $1 -ge 1 -a -x /usr/bin/systemctl ]; then \
|
||||||
# Package upgrade, not uninstall \
|
# Package upgrade, not uninstall \
|
||||||
/usr/bin/systemctl try-restart %{?*} || : \
|
/usr/bin/systemctl try-restart %{?*} || : \
|
||||||
fi \
|
fi \
|
||||||
|
@ -1,3 +1,27 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Mar 12 08:17:25 UTC 2019 - Franck Bui <fbui@suse.com>
|
||||||
|
|
||||||
|
- $1 can never be empty or it's an rpm bug
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Mar 12 08:03:45 UTC 2019 - Franck Bui <fbui@suse.com>
|
||||||
|
|
||||||
|
- Get rid of $FIRST_ARG
|
||||||
|
|
||||||
|
$FIRST_ARG was probably introduced because the %service_* macros
|
||||||
|
were playing tricks on the shell positional parameters. This is bad
|
||||||
|
practice and error prone so let's assume that no macros should do
|
||||||
|
that anymore and hence it's safe to assume that positional
|
||||||
|
parameters remains unchanged after any rpm macro call.
|
||||||
|
|
||||||
|
All users of $FIRST_ARG should have been fixed by now and in most
|
||||||
|
cases the use of the variable was unneeded (since the macros don't
|
||||||
|
change the shell parameters) and thus confusing.
|
||||||
|
|
||||||
|
'net-snmp' has a different use of FIRST_ARG though as it tried to
|
||||||
|
fake an update during a package installation. Fortunately this could
|
||||||
|
have been fixed too.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Mar 1 08:18:07 UTC 2019 - Franck Bui <fbui@suse.com>
|
Fri Mar 1 08:18:07 UTC 2019 - Franck Bui <fbui@suse.com>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user