Bugzilla – Attachment 667474 Details for
Bug 968405
xdm restarts the user session on update
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Forgot Password
Using lua interpreter to avoid define or global command
x (text/plain), 5.41 KB, created by
Dr. Werner Fink
on 2016-03-02 14:53:28 UTC
(
hide
)
Description:
Using lua interpreter to avoid define or global command
Filename:
MIME Type:
Creator:
Dr. Werner Fink
Created:
2016-03-02 14:53:28 UTC
Size:
5.41 KB
patch
obsolete
>Index: macros.systemd >=================================================================== >--- macros.systemd (revision 13) >+++ macros.systemd (working copy) >@@ -50,19 +50,67 @@ > %_ntpunitsdir /usr/lib/systemd/ntp-units.d > %_binfmtdir /usr/lib/binfmt.d > >-%_restart_check_systemctl \ >- test "$DISABLE_RESTART_ON_UPDATE" = yes && exit 0 \ >- test -f /etc/sysconfig/services && . /etc/sysconfig/services \ >- test "$YAST_IS_RUNNING" = instsys && exit 0 \ >- test "$DISABLE_RESTART_ON_UPDATE" = yes && exit 0 \ >- /usr/bin/systemctl try-restart %{nil} >- >-%_stop_check_systemctl \ >- test "$DISABLE_STOP_ON_REMOVAL" = yes && exit 0 \ >- test -f /etc/sysconfig/services && . /etc/sysconfig/services \ >- test "$YAST_IS_RUNNING" = instsys && exit 0 \ >- test "$DISABLE_STOP_ON_REMOVAL" = yes && exit 0 \ >- /usr/bin/systemctl stop %{nil} >+%_restart_check_systemctl(fn) %{lua: \ >+ local force = tonumber(rpm.expand("%{-f:1}%{!-f:0}")) \ >+ local never = tonumber(rpm.expand("%{-n:1}%{!-n:0}")) \ >+ local services = {} \ >+ local word \ >+ for word in string.gmatch(rpm.expand("%*"), "%S+") do \ >+ if word:byte(1) ~= 45 then \ >+ table.insert(services, 1, word) \ >+ end \ >+ end \ >+ if force == 1 then \ >+ print('(\\n') \ >+ print('\\t\\t\\ttest "$YAST_IS_RUNNING" = instsys && exit 0\\n') \ >+ print(string.format("\\t\\t\\t/usr/bin/systemctl try-restart %s || :\\n", \ >+ table.concat(services, " "))) \ >+ print('\\t\\t)\\n') \ >+ elseif never == 1 then \ >+ print(string.format("# Restart of %s skipped\\n", table.concat(services, " "))) \ >+ else \ >+ print('(\\n') \ >+ print('\\t\\t\\ttest "$YAST_IS_RUNNING" = instsys && exit 0\\n') \ >+ print('\\t\\t\\ttest -f /etc/sysconfig/services -a ') \ >+ print('-z "$DISABLE_RESTART_ON_UPDATE" && . /etc/sysconfig/services\\n') \ >+ print('\\t\\t\\ttest "$DISABLE_RESTART_ON_UPDATE" = yes -o ') \ >+ print('"$DISABLE_RESTART_ON_UPDATE" = 1 && exit 0\\n') \ >+ print(string.format("\\t\\t\\t/usr/bin/systemctl try-restart %s || :\\n", \ >+ table.concat(services, " "))) \ >+ print('\\t\\t)\\n') \ >+ end \ >+} %{nil} >+ >+%_stop_check_systemctl(fn) %{lua: \ >+ local force = tonumber(rpm.expand("%{-f:1}%{!-f:0}")) \ >+ local never = tonumber(rpm.expand("%{-n:1}%{!-n:0}")) \ >+ local services = {} \ >+ local word \ >+ for word in string.gmatch(rpm.expand("%*"), "%S+") do \ >+ if word:byte(1) ~= 45 then \ >+ table.insert(services, 1, word) \ >+ end \ >+ end \ >+ if force == 1 then \ >+ print('(\\n') \ >+ print('\\t\\ttest "$YAST_IS_RUNNING" = instsys && exit 0\\n') \ >+ print(string.format("\\t\\t/usr/bin/systemctl try-restart %s || :\\n", \ >+ table.concat(services, " "))) \ >+ print('\\t)\\n') \ >+ elseif never == 1 then \ >+ print(string.format("# Stop of %s skipped\\n", table.concat(services, " "))) \ >+ else \ >+ print('(\\n') \ >+ print('\\t\\ttest "$YAST_IS_RUNNING" = instsys && exit 0\\n') \ >+ print('\\t\\ttest -f /etc/sysconfig/services -a ') \ >+ print('-z "$DISABLE_STOP_ON_REMOVAL" && . /etc/sysconfig/services\\n') \ >+ print('\\t\\ttest "$DISABLE_STOP_ON_REMOVAL" = yes -o ') \ >+ print('"$DISABLE_STOP_ON_REMOVAL" = 1 && exit 0\\n') \ >+ print(string.format("\\t\\t/usr/bin/systemctl try-restart %s || :\\n", \ >+ table.concat(services, " "))) \ >+ print('\\t)\\n') \ >+ end \ >+} %{nil} > > %service_add_pre() \ > test -n "$FIRST_ARG" || FIRST_ARG="$1" \ >@@ -130,23 +178,23 @@ > %{nil} > > # On uninstall, disable and stop services >-%service_del_preun() \ >+%service_del_preun(fn) \ > test -n "$FIRST_ARG" || FIRST_ARG="$1" \ > if [ "$FIRST_ARG" -eq 0 -a -x /usr/bin/systemctl ]; then \ > # Package removal, not upgrade \ > /usr/bin/systemctl --no-reload disable %{?*} || : \ >- ( %_stop_check_systemctl %{?*} || : ) \ >+ %{expand:%_stop_check_systemctl %{-f} %{-n} %%{?*}} \ > fi \ > %{nil} > > # On uninstall, tell systemd to reload its unit files >-%service_del_postun() \ >+%service_del_postun(fn) \ > test -n "$FIRST_ARG" || FIRST_ARG="$1" \ > if [ "$FIRST_ARG" -ge 1 ]; then \ > # Package upgrade, not uninstall \ > if [ -x /usr/bin/systemctl ]; then \ > /usr/bin/systemctl daemon-reload || : \ >- ( %_restart_check_systemctl %{?*} || : ) \ >+ %{expand:%_restart_check_systemctl %{-f} %{-n} %%{?*}} \ > fi \ > else # package uninstall \ > for service in %{?*} ; do \ >@@ -159,21 +207,21 @@ > fi \ > %{nil} > >-%systemd_post() \ >+%systemd_post(fn) \ > if [ "$1" -eq 0 -a -x /usr/bin/systemctl ]; then \ > # Package removal, not upgrade \ > /usr/bin/systemctl --no-reload disable %{?*} || : \ >- ( %_stop_check_systemctl %{?*} || : ) \ >+ %{expand:%_stop_check_systemctl %{-f} %{-n} %%{?*}} \ > fi \ > %{nil} > > %systemd_user_post() %systemd_post --user --global %{?*} > >-%systemd_preun() \ >+%systemd_preun(fn) \ > if [ "$1" -eq 0 -a -x /usr/bin/systemctl ]; then \ > # Package removal, not upgrade \ > /usr/bin/systemctl --no-reload disable %{?*} || : \ >- ( %_stop_check_systemctl %{?*} || : ) \ >+ %{expand:%_stop_check_systemctl %{-f} %{-n} %%{?*}} \ > fi \ > %{nil} > >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
Attachments on
bug 968405
:
667084
|
667148
|
667154
|
667263
|
667293
|
667365
|
667474
|
667586