- Provide (Lua-based) file triggers and adapt systemd.spec accordingly (boo#1133764)
More specifically, file triggers handle automatically installations or updates
of files for sysusers, tmpfiles, hwdb, journal catalog, udev rules, sysctl and
binfmt.
Therefore it makes a bunch of systemd rpm macros (such as %udev_hwdb_update,
%udev_rules_update, %journal_catalog_update, %tmpfiles_create,
%sysusers_create and so on) not needed anymore. However before considering
simplifying your spec files beware that these changes are not available in SLE
yet and will probably never reach the current releases (latest one being
SLE15-SP5 as of this writing).
Macros dealing with unit restart/enabling (such as %systemd_pre,
%service_add_pre, %service_del_postun, ...) are still needed though. However
reloading of systemd instances (and thus restarting of units) are delayed
until the very end of the package install/update transaction and is now done
only once.
Nevertheless to fully take advantage of file triggers, users have to activate
a specific zypper transaction backend which is still considered as
experimental, see bsc#1041742 for details.
- Provide a (slighlty) customized version of systemd-update-helper. Some of the
systemd rpm macros rely now on the helper and delegate their work to it. Hence
we don't need to rebuild all packages anymore when the content of the rpm
macros must be updated/fixed.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1390
2023-05-09 14:01:32 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
|
|
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
|
#
|
|
|
|
|
# This helper is aimed at being used by the systemd rpm macros only.
|
|
|
|
|
#
|
|
|
|
|
set -eu
|
|
|
|
|
set -o pipefail
|
|
|
|
|
|
|
|
|
|
command="${1:?}"
|
|
|
|
|
shift
|
|
|
|
|
|
|
|
|
|
command -v systemctl >/dev/null || exit 0
|
|
|
|
|
|
2024-12-26 11:16:56 +00:00
|
|
|
UPDATE_HELPER_USER_TIMEOUT_SEC=15
|
|
|
|
|
|
2025-04-22 15:15:46 +00:00
|
|
|
do_mark_install_units() {
|
|
|
|
|
mode=$1
|
|
|
|
|
shift
|
|
|
|
|
mkdir -p /run/systemd/rpm/$mode/{needs-preset,dont-disable}
|
|
|
|
|
|
|
|
|
|
for unit in "$@" ; do
|
2025-07-15 17:33:51 +00:00
|
|
|
# Clean any leftovers that might remain from a previous transaction
|
|
|
|
|
# which exited abnormally.
|
|
|
|
|
rm -f /run/systemd/rpm/$mode/*/"$unit"
|
|
|
|
|
|
2025-04-22 15:15:46 +00:00
|
|
|
if [ ! -e /usr/lib/systemd/$mode/"$unit" ]; then
|
|
|
|
|
# The unit is being introduced: remember we need to apply preset on
|
|
|
|
|
# this new unit regardless of whether it's a package update or
|
|
|
|
|
# installation.
|
|
|
|
|
touch /run/systemd/rpm/$mode/needs-preset/"$unit"
|
|
|
|
|
fi
|
- Provide (Lua-based) file triggers and adapt systemd.spec accordingly (boo#1133764)
More specifically, file triggers handle automatically installations or updates
of files for sysusers, tmpfiles, hwdb, journal catalog, udev rules, sysctl and
binfmt.
Therefore it makes a bunch of systemd rpm macros (such as %udev_hwdb_update,
%udev_rules_update, %journal_catalog_update, %tmpfiles_create,
%sysusers_create and so on) not needed anymore. However before considering
simplifying your spec files beware that these changes are not available in SLE
yet and will probably never reach the current releases (latest one being
SLE15-SP5 as of this writing).
Macros dealing with unit restart/enabling (such as %systemd_pre,
%service_add_pre, %service_del_postun, ...) are still needed though. However
reloading of systemd instances (and thus restarting of units) are delayed
until the very end of the package install/update transaction and is now done
only once.
Nevertheless to fully take advantage of file triggers, users have to activate
a specific zypper transaction backend which is still considered as
experimental, see bsc#1041742 for details.
- Provide a (slighlty) customized version of systemd-update-helper. Some of the
systemd rpm macros rely now on the helper and delegate their work to it. Hence
we don't need to rebuild all packages anymore when the content of the rpm
macros must be updated/fixed.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1390
2023-05-09 14:01:32 +00:00
|
|
|
|
2025-04-22 15:15:46 +00:00
|
|
|
# All passed units are part of a package being installed or updated and
|
|
|
|
|
# therefore should not be disabled by the removal of a different package
|
|
|
|
|
# part of the same rpm transaction. This can happen when the package
|
|
|
|
|
# shipping the unit is being renamed (e.g. from "A" to "B"), where "A"
|
|
|
|
|
# is installed first, followed by the removal "B". In that case, "B" is
|
|
|
|
|
# removed and its %preun scriptlet runs %systemd_preun on the unit.
|
|
|
|
|
touch /run/systemd/rpm/$mode/dont-disable/"$unit"
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
do_install_units() {
|
|
|
|
|
mode=$1
|
|
|
|
|
shift
|
|
|
|
|
units=()
|
|
|
|
|
|
|
|
|
|
for unit in "$@" ; do
|
|
|
|
|
if [ -e /run/systemd/rpm/$mode/needs-preset/"$unit" ]; then
|
2026-01-08 16:27:47 +00:00
|
|
|
rm /run/systemd/rpm/$mode/needs-preset/"$unit"
|
2025-04-22 15:15:46 +00:00
|
|
|
units+=("$unit")
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
[ ${#units[*]} -gt 0 ] && {
|
|
|
|
|
case $mode in
|
|
|
|
|
system)
|
|
|
|
|
systemctl --no-reload preset "${units[@]}" ;;
|
|
|
|
|
user)
|
|
|
|
|
systemctl --no-reload preset --global "${units[@]}" ;;
|
|
|
|
|
esac
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
do_remove_units() {
|
|
|
|
|
mode=$1
|
|
|
|
|
shift
|
|
|
|
|
units=()
|
|
|
|
|
|
|
|
|
|
for unit in "$@" ; do
|
|
|
|
|
if [ ! -e /run/systemd/rpm/$mode/dont-disable/"$unit" ]; then
|
|
|
|
|
units+=("$unit")
|
2026-01-08 16:27:47 +00:00
|
|
|
else
|
|
|
|
|
rm /run/systemd/rpm/$mode/dont-disable/"$unit"
|
2025-04-22 15:15:46 +00:00
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
[ ${#units[*]} -eq 0 ] && return
|
|
|
|
|
|
|
|
|
|
case $mode in
|
|
|
|
|
system)
|
|
|
|
|
if [ -d /run/systemd/system ]; then
|
|
|
|
|
systemctl --no-reload disable --now --no-warn "${units[@]}"
|
|
|
|
|
else
|
|
|
|
|
systemctl --no-reload disable --no-warn "${units[@]}"
|
|
|
|
|
fi
|
- Provide (Lua-based) file triggers and adapt systemd.spec accordingly (boo#1133764)
More specifically, file triggers handle automatically installations or updates
of files for sysusers, tmpfiles, hwdb, journal catalog, udev rules, sysctl and
binfmt.
Therefore it makes a bunch of systemd rpm macros (such as %udev_hwdb_update,
%udev_rules_update, %journal_catalog_update, %tmpfiles_create,
%sysusers_create and so on) not needed anymore. However before considering
simplifying your spec files beware that these changes are not available in SLE
yet and will probably never reach the current releases (latest one being
SLE15-SP5 as of this writing).
Macros dealing with unit restart/enabling (such as %systemd_pre,
%service_add_pre, %service_del_postun, ...) are still needed though. However
reloading of systemd instances (and thus restarting of units) are delayed
until the very end of the package install/update transaction and is now done
only once.
Nevertheless to fully take advantage of file triggers, users have to activate
a specific zypper transaction backend which is still considered as
experimental, see bsc#1041742 for details.
- Provide a (slighlty) customized version of systemd-update-helper. Some of the
systemd rpm macros rely now on the helper and delegate their work to it. Hence
we don't need to rebuild all packages anymore when the content of the rpm
macros must be updated/fixed.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1390
2023-05-09 14:01:32 +00:00
|
|
|
;;
|
2025-04-22 15:15:46 +00:00
|
|
|
user)
|
|
|
|
|
systemctl --global disable --no-warn "${units[@]}"
|
- Provide (Lua-based) file triggers and adapt systemd.spec accordingly (boo#1133764)
More specifically, file triggers handle automatically installations or updates
of files for sysusers, tmpfiles, hwdb, journal catalog, udev rules, sysctl and
binfmt.
Therefore it makes a bunch of systemd rpm macros (such as %udev_hwdb_update,
%udev_rules_update, %journal_catalog_update, %tmpfiles_create,
%sysusers_create and so on) not needed anymore. However before considering
simplifying your spec files beware that these changes are not available in SLE
yet and will probably never reach the current releases (latest one being
SLE15-SP5 as of this writing).
Macros dealing with unit restart/enabling (such as %systemd_pre,
%service_add_pre, %service_del_postun, ...) are still needed though. However
reloading of systemd instances (and thus restarting of units) are delayed
until the very end of the package install/update transaction and is now done
only once.
Nevertheless to fully take advantage of file triggers, users have to activate
a specific zypper transaction backend which is still considered as
experimental, see bsc#1041742 for details.
- Provide a (slighlty) customized version of systemd-update-helper. Some of the
systemd rpm macros rely now on the helper and delegate their work to it. Hence
we don't need to rebuild all packages anymore when the content of the rpm
macros must be updated/fixed.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1390
2023-05-09 14:01:32 +00:00
|
|
|
|
2025-05-15 13:27:08 +00:00
|
|
|
[ -d /run/systemd/system ] || return
|
- Provide (Lua-based) file triggers and adapt systemd.spec accordingly (boo#1133764)
More specifically, file triggers handle automatically installations or updates
of files for sysusers, tmpfiles, hwdb, journal catalog, udev rules, sysctl and
binfmt.
Therefore it makes a bunch of systemd rpm macros (such as %udev_hwdb_update,
%udev_rules_update, %journal_catalog_update, %tmpfiles_create,
%sysusers_create and so on) not needed anymore. However before considering
simplifying your spec files beware that these changes are not available in SLE
yet and will probably never reach the current releases (latest one being
SLE15-SP5 as of this writing).
Macros dealing with unit restart/enabling (such as %systemd_pre,
%service_add_pre, %service_del_postun, ...) are still needed though. However
reloading of systemd instances (and thus restarting of units) are delayed
until the very end of the package install/update transaction and is now done
only once.
Nevertheless to fully take advantage of file triggers, users have to activate
a specific zypper transaction backend which is still considered as
experimental, see bsc#1041742 for details.
- Provide a (slighlty) customized version of systemd-update-helper. Some of the
systemd rpm macros rely now on the helper and delegate their work to it. Hence
we don't need to rebuild all packages anymore when the content of the rpm
macros must be updated/fixed.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1390
2023-05-09 14:01:32 +00:00
|
|
|
|
2025-04-22 15:15:46 +00:00
|
|
|
users=$(systemctl list-units 'user@*' --legend=no | sed -n -r 's/.*user@([0-9]+).service.*/\1/p')
|
|
|
|
|
for user in $users; do
|
|
|
|
|
SYSTEMD_BUS_TIMEOUT=${UPDATE_HELPER_USER_TIMEOUT_SEC}s \
|
|
|
|
|
systemctl --user -M "$user@" disable --now --no-warn "${units[@]}" &
|
|
|
|
|
done
|
|
|
|
|
wait
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
}
|
- Provide (Lua-based) file triggers and adapt systemd.spec accordingly (boo#1133764)
More specifically, file triggers handle automatically installations or updates
of files for sysusers, tmpfiles, hwdb, journal catalog, udev rules, sysctl and
binfmt.
Therefore it makes a bunch of systemd rpm macros (such as %udev_hwdb_update,
%udev_rules_update, %journal_catalog_update, %tmpfiles_create,
%sysusers_create and so on) not needed anymore. However before considering
simplifying your spec files beware that these changes are not available in SLE
yet and will probably never reach the current releases (latest one being
SLE15-SP5 as of this writing).
Macros dealing with unit restart/enabling (such as %systemd_pre,
%service_add_pre, %service_del_postun, ...) are still needed though. However
reloading of systemd instances (and thus restarting of units) are delayed
until the very end of the package install/update transaction and is now done
only once.
Nevertheless to fully take advantage of file triggers, users have to activate
a specific zypper transaction backend which is still considered as
experimental, see bsc#1041742 for details.
- Provide a (slighlty) customized version of systemd-update-helper. Some of the
systemd rpm macros rely now on the helper and delegate their work to it. Hence
we don't need to rebuild all packages anymore when the content of the rpm
macros must be updated/fixed.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1390
2023-05-09 14:01:32 +00:00
|
|
|
|
2025-04-22 15:15:46 +00:00
|
|
|
case "$command" in
|
2025-07-15 17:33:51 +00:00
|
|
|
mark-install-system-units) # called from %pre (on install or upgrade)
|
2025-04-22 15:15:46 +00:00
|
|
|
do_mark_install_units system "$@"
|
- Provide (Lua-based) file triggers and adapt systemd.spec accordingly (boo#1133764)
More specifically, file triggers handle automatically installations or updates
of files for sysusers, tmpfiles, hwdb, journal catalog, udev rules, sysctl and
binfmt.
Therefore it makes a bunch of systemd rpm macros (such as %udev_hwdb_update,
%udev_rules_update, %journal_catalog_update, %tmpfiles_create,
%sysusers_create and so on) not needed anymore. However before considering
simplifying your spec files beware that these changes are not available in SLE
yet and will probably never reach the current releases (latest one being
SLE15-SP5 as of this writing).
Macros dealing with unit restart/enabling (such as %systemd_pre,
%service_add_pre, %service_del_postun, ...) are still needed though. However
reloading of systemd instances (and thus restarting of units) are delayed
until the very end of the package install/update transaction and is now done
only once.
Nevertheless to fully take advantage of file triggers, users have to activate
a specific zypper transaction backend which is still considered as
experimental, see bsc#1041742 for details.
- Provide a (slighlty) customized version of systemd-update-helper. Some of the
systemd rpm macros rely now on the helper and delegate their work to it. Hence
we don't need to rebuild all packages anymore when the content of the rpm
macros must be updated/fixed.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1390
2023-05-09 14:01:32 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
mark-install-user-units)
|
2025-04-22 15:15:46 +00:00
|
|
|
do_mark_install_units user "$@"
|
|
|
|
|
;;
|
- Provide (Lua-based) file triggers and adapt systemd.spec accordingly (boo#1133764)
More specifically, file triggers handle automatically installations or updates
of files for sysusers, tmpfiles, hwdb, journal catalog, udev rules, sysctl and
binfmt.
Therefore it makes a bunch of systemd rpm macros (such as %udev_hwdb_update,
%udev_rules_update, %journal_catalog_update, %tmpfiles_create,
%sysusers_create and so on) not needed anymore. However before considering
simplifying your spec files beware that these changes are not available in SLE
yet and will probably never reach the current releases (latest one being
SLE15-SP5 as of this writing).
Macros dealing with unit restart/enabling (such as %systemd_pre,
%service_add_pre, %service_del_postun, ...) are still needed though. However
reloading of systemd instances (and thus restarting of units) are delayed
until the very end of the package install/update transaction and is now done
only once.
Nevertheless to fully take advantage of file triggers, users have to activate
a specific zypper transaction backend which is still considered as
experimental, see bsc#1041742 for details.
- Provide a (slighlty) customized version of systemd-update-helper. Some of the
systemd rpm macros rely now on the helper and delegate their work to it. Hence
we don't need to rebuild all packages anymore when the content of the rpm
macros must be updated/fixed.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1390
2023-05-09 14:01:32 +00:00
|
|
|
|
2025-07-15 17:33:51 +00:00
|
|
|
install-system-units) # called from %post (on install or upgrade)
|
2025-04-22 15:15:46 +00:00
|
|
|
do_install_units system "$@"
|
- Provide (Lua-based) file triggers and adapt systemd.spec accordingly (boo#1133764)
More specifically, file triggers handle automatically installations or updates
of files for sysusers, tmpfiles, hwdb, journal catalog, udev rules, sysctl and
binfmt.
Therefore it makes a bunch of systemd rpm macros (such as %udev_hwdb_update,
%udev_rules_update, %journal_catalog_update, %tmpfiles_create,
%sysusers_create and so on) not needed anymore. However before considering
simplifying your spec files beware that these changes are not available in SLE
yet and will probably never reach the current releases (latest one being
SLE15-SP5 as of this writing).
Macros dealing with unit restart/enabling (such as %systemd_pre,
%service_add_pre, %service_del_postun, ...) are still needed though. However
reloading of systemd instances (and thus restarting of units) are delayed
until the very end of the package install/update transaction and is now done
only once.
Nevertheless to fully take advantage of file triggers, users have to activate
a specific zypper transaction backend which is still considered as
experimental, see bsc#1041742 for details.
- Provide a (slighlty) customized version of systemd-update-helper. Some of the
systemd rpm macros rely now on the helper and delegate their work to it. Hence
we don't need to rebuild all packages anymore when the content of the rpm
macros must be updated/fixed.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1390
2023-05-09 14:01:32 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
install-user-units)
|
2025-04-22 15:15:46 +00:00
|
|
|
do_install_units user "$@"
|
- Provide (Lua-based) file triggers and adapt systemd.spec accordingly (boo#1133764)
More specifically, file triggers handle automatically installations or updates
of files for sysusers, tmpfiles, hwdb, journal catalog, udev rules, sysctl and
binfmt.
Therefore it makes a bunch of systemd rpm macros (such as %udev_hwdb_update,
%udev_rules_update, %journal_catalog_update, %tmpfiles_create,
%sysusers_create and so on) not needed anymore. However before considering
simplifying your spec files beware that these changes are not available in SLE
yet and will probably never reach the current releases (latest one being
SLE15-SP5 as of this writing).
Macros dealing with unit restart/enabling (such as %systemd_pre,
%service_add_pre, %service_del_postun, ...) are still needed though. However
reloading of systemd instances (and thus restarting of units) are delayed
until the very end of the package install/update transaction and is now done
only once.
Nevertheless to fully take advantage of file triggers, users have to activate
a specific zypper transaction backend which is still considered as
experimental, see bsc#1041742 for details.
- Provide a (slighlty) customized version of systemd-update-helper. Some of the
systemd rpm macros rely now on the helper and delegate their work to it. Hence
we don't need to rebuild all packages anymore when the content of the rpm
macros must be updated/fixed.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1390
2023-05-09 14:01:32 +00:00
|
|
|
;;
|
|
|
|
|
|
2025-07-15 17:33:51 +00:00
|
|
|
remove-system-units) # called from %preun (on removal)
|
2025-04-22 15:15:46 +00:00
|
|
|
do_remove_units system "$@"
|
- Provide (Lua-based) file triggers and adapt systemd.spec accordingly (boo#1133764)
More specifically, file triggers handle automatically installations or updates
of files for sysusers, tmpfiles, hwdb, journal catalog, udev rules, sysctl and
binfmt.
Therefore it makes a bunch of systemd rpm macros (such as %udev_hwdb_update,
%udev_rules_update, %journal_catalog_update, %tmpfiles_create,
%sysusers_create and so on) not needed anymore. However before considering
simplifying your spec files beware that these changes are not available in SLE
yet and will probably never reach the current releases (latest one being
SLE15-SP5 as of this writing).
Macros dealing with unit restart/enabling (such as %systemd_pre,
%service_add_pre, %service_del_postun, ...) are still needed though. However
reloading of systemd instances (and thus restarting of units) are delayed
until the very end of the package install/update transaction and is now done
only once.
Nevertheless to fully take advantage of file triggers, users have to activate
a specific zypper transaction backend which is still considered as
experimental, see bsc#1041742 for details.
- Provide a (slighlty) customized version of systemd-update-helper. Some of the
systemd rpm macros rely now on the helper and delegate their work to it. Hence
we don't need to rebuild all packages anymore when the content of the rpm
macros must be updated/fixed.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1390
2023-05-09 14:01:32 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
remove-user-units)
|
2025-04-22 15:15:46 +00:00
|
|
|
do_remove_units user "$@"
|
- Provide (Lua-based) file triggers and adapt systemd.spec accordingly (boo#1133764)
More specifically, file triggers handle automatically installations or updates
of files for sysusers, tmpfiles, hwdb, journal catalog, udev rules, sysctl and
binfmt.
Therefore it makes a bunch of systemd rpm macros (such as %udev_hwdb_update,
%udev_rules_update, %journal_catalog_update, %tmpfiles_create,
%sysusers_create and so on) not needed anymore. However before considering
simplifying your spec files beware that these changes are not available in SLE
yet and will probably never reach the current releases (latest one being
SLE15-SP5 as of this writing).
Macros dealing with unit restart/enabling (such as %systemd_pre,
%service_add_pre, %service_del_postun, ...) are still needed though. However
reloading of systemd instances (and thus restarting of units) are delayed
until the very end of the package install/update transaction and is now done
only once.
Nevertheless to fully take advantage of file triggers, users have to activate
a specific zypper transaction backend which is still considered as
experimental, see bsc#1041742 for details.
- Provide a (slighlty) customized version of systemd-update-helper. Some of the
systemd rpm macros rely now on the helper and delegate their work to it. Hence
we don't need to rebuild all packages anymore when the content of the rpm
macros must be updated/fixed.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1390
2023-05-09 14:01:32 +00:00
|
|
|
;;
|
|
|
|
|
|
2025-07-15 17:33:51 +00:00
|
|
|
mark-restart-system-units) # called from %postun (on upgrade)
|
- Provide (Lua-based) file triggers and adapt systemd.spec accordingly (boo#1133764)
More specifically, file triggers handle automatically installations or updates
of files for sysusers, tmpfiles, hwdb, journal catalog, udev rules, sysctl and
binfmt.
Therefore it makes a bunch of systemd rpm macros (such as %udev_hwdb_update,
%udev_rules_update, %journal_catalog_update, %tmpfiles_create,
%sysusers_create and so on) not needed anymore. However before considering
simplifying your spec files beware that these changes are not available in SLE
yet and will probably never reach the current releases (latest one being
SLE15-SP5 as of this writing).
Macros dealing with unit restart/enabling (such as %systemd_pre,
%service_add_pre, %service_del_postun, ...) are still needed though. However
reloading of systemd instances (and thus restarting of units) are delayed
until the very end of the package install/update transaction and is now done
only once.
Nevertheless to fully take advantage of file triggers, users have to activate
a specific zypper transaction backend which is still considered as
experimental, see bsc#1041742 for details.
- Provide a (slighlty) customized version of systemd-update-helper. Some of the
systemd rpm macros rely now on the helper and delegate their work to it. Hence
we don't need to rebuild all packages anymore when the content of the rpm
macros must be updated/fixed.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1390
2023-05-09 14:01:32 +00:00
|
|
|
[ -d /run/systemd/system ] || exit 0
|
|
|
|
|
|
|
|
|
|
for unit in "$@"; do
|
|
|
|
|
systemctl set-property "$unit" Markers=+needs-restart &
|
|
|
|
|
done
|
|
|
|
|
wait
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
mark-restart-user-units)
|
|
|
|
|
[ -d /run/systemd/system ] || exit 0
|
|
|
|
|
|
|
|
|
|
users=$(systemctl list-units 'user@*' --legend=no | sed -n -r 's/.*user@([0-9]+).service.*/\1/p')
|
|
|
|
|
for user in $users; do
|
|
|
|
|
for unit in "$@"; do
|
2024-12-26 11:16:56 +00:00
|
|
|
SYSTEMD_BUS_TIMEOUT=${UPDATE_HELPER_USER_TIMEOUT_SEC}s \
|
- Provide (Lua-based) file triggers and adapt systemd.spec accordingly (boo#1133764)
More specifically, file triggers handle automatically installations or updates
of files for sysusers, tmpfiles, hwdb, journal catalog, udev rules, sysctl and
binfmt.
Therefore it makes a bunch of systemd rpm macros (such as %udev_hwdb_update,
%udev_rules_update, %journal_catalog_update, %tmpfiles_create,
%sysusers_create and so on) not needed anymore. However before considering
simplifying your spec files beware that these changes are not available in SLE
yet and will probably never reach the current releases (latest one being
SLE15-SP5 as of this writing).
Macros dealing with unit restart/enabling (such as %systemd_pre,
%service_add_pre, %service_del_postun, ...) are still needed though. However
reloading of systemd instances (and thus restarting of units) are delayed
until the very end of the package install/update transaction and is now done
only once.
Nevertheless to fully take advantage of file triggers, users have to activate
a specific zypper transaction backend which is still considered as
experimental, see bsc#1041742 for details.
- Provide a (slighlty) customized version of systemd-update-helper. Some of the
systemd rpm macros rely now on the helper and delegate their work to it. Hence
we don't need to rebuild all packages anymore when the content of the rpm
macros must be updated/fixed.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1390
2023-05-09 14:01:32 +00:00
|
|
|
systemctl --user -M "$user@" set-property "$unit" Markers=+needs-restart &
|
|
|
|
|
done
|
|
|
|
|
done
|
|
|
|
|
wait
|
|
|
|
|
;;
|
|
|
|
|
|
2026-01-08 17:49:29 +00:00
|
|
|
system-reload-restart|system-reload|system-restart|system-reexec) # called once from %transfiletriggerin or %transfiletriggerpostun
|
- Provide (Lua-based) file triggers and adapt systemd.spec accordingly (boo#1133764)
More specifically, file triggers handle automatically installations or updates
of files for sysusers, tmpfiles, hwdb, journal catalog, udev rules, sysctl and
binfmt.
Therefore it makes a bunch of systemd rpm macros (such as %udev_hwdb_update,
%udev_rules_update, %journal_catalog_update, %tmpfiles_create,
%sysusers_create and so on) not needed anymore. However before considering
simplifying your spec files beware that these changes are not available in SLE
yet and will probably never reach the current releases (latest one being
SLE15-SP5 as of this writing).
Macros dealing with unit restart/enabling (such as %systemd_pre,
%service_add_pre, %service_del_postun, ...) are still needed though. However
reloading of systemd instances (and thus restarting of units) are delayed
until the very end of the package install/update transaction and is now done
only once.
Nevertheless to fully take advantage of file triggers, users have to activate
a specific zypper transaction backend which is still considered as
experimental, see bsc#1041742 for details.
- Provide a (slighlty) customized version of systemd-update-helper. Some of the
systemd rpm macros rely now on the helper and delegate their work to it. Hence
we don't need to rebuild all packages anymore when the content of the rpm
macros must be updated/fixed.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1390
2023-05-09 14:01:32 +00:00
|
|
|
if [ -n "$*" ]; then
|
|
|
|
|
echo >&2 "Unexpected arguments for '$command': $*"
|
|
|
|
|
exit 2
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
[ -d /run/systemd/system ] || exit 0
|
|
|
|
|
|
2026-01-08 17:49:29 +00:00
|
|
|
if [[ "$command" =~ reexec ]]; then
|
|
|
|
|
systemctl daemon-reexec
|
|
|
|
|
fi
|
|
|
|
|
|
- Provide (Lua-based) file triggers and adapt systemd.spec accordingly (boo#1133764)
More specifically, file triggers handle automatically installations or updates
of files for sysusers, tmpfiles, hwdb, journal catalog, udev rules, sysctl and
binfmt.
Therefore it makes a bunch of systemd rpm macros (such as %udev_hwdb_update,
%udev_rules_update, %journal_catalog_update, %tmpfiles_create,
%sysusers_create and so on) not needed anymore. However before considering
simplifying your spec files beware that these changes are not available in SLE
yet and will probably never reach the current releases (latest one being
SLE15-SP5 as of this writing).
Macros dealing with unit restart/enabling (such as %systemd_pre,
%service_add_pre, %service_del_postun, ...) are still needed though. However
reloading of systemd instances (and thus restarting of units) are delayed
until the very end of the package install/update transaction and is now done
only once.
Nevertheless to fully take advantage of file triggers, users have to activate
a specific zypper transaction backend which is still considered as
experimental, see bsc#1041742 for details.
- Provide a (slighlty) customized version of systemd-update-helper. Some of the
systemd rpm macros rely now on the helper and delegate their work to it. Hence
we don't need to rebuild all packages anymore when the content of the rpm
macros must be updated/fixed.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1390
2023-05-09 14:01:32 +00:00
|
|
|
if [[ "$command" =~ reload ]]; then
|
|
|
|
|
systemctl daemon-reload
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [[ "$command" =~ restart ]]; then
|
|
|
|
|
systemctl reload-or-restart --marked
|
|
|
|
|
fi
|
|
|
|
|
;;
|
2026-01-07 16:19:05 +00:00
|
|
|
|
2026-01-08 16:27:47 +00:00
|
|
|
user-reload-restart|user-reload|user-restart|user-reexec) # called once from %transfiletriggerin or %transfiletriggerpostun
|
- Provide (Lua-based) file triggers and adapt systemd.spec accordingly (boo#1133764)
More specifically, file triggers handle automatically installations or updates
of files for sysusers, tmpfiles, hwdb, journal catalog, udev rules, sysctl and
binfmt.
Therefore it makes a bunch of systemd rpm macros (such as %udev_hwdb_update,
%udev_rules_update, %journal_catalog_update, %tmpfiles_create,
%sysusers_create and so on) not needed anymore. However before considering
simplifying your spec files beware that these changes are not available in SLE
yet and will probably never reach the current releases (latest one being
SLE15-SP5 as of this writing).
Macros dealing with unit restart/enabling (such as %systemd_pre,
%service_add_pre, %service_del_postun, ...) are still needed though. However
reloading of systemd instances (and thus restarting of units) are delayed
until the very end of the package install/update transaction and is now done
only once.
Nevertheless to fully take advantage of file triggers, users have to activate
a specific zypper transaction backend which is still considered as
experimental, see bsc#1041742 for details.
- Provide a (slighlty) customized version of systemd-update-helper. Some of the
systemd rpm macros rely now on the helper and delegate their work to it. Hence
we don't need to rebuild all packages anymore when the content of the rpm
macros must be updated/fixed.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1390
2023-05-09 14:01:32 +00:00
|
|
|
if [ -n "$*" ]; then
|
|
|
|
|
echo >&2 "Unexpected arguments for '$command': $*"
|
|
|
|
|
exit 2
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
[ -d /run/systemd/system ] || exit 0
|
|
|
|
|
|
2024-12-26 11:16:56 +00:00
|
|
|
if [[ "$command" =~ reexec|reload ]]; then
|
|
|
|
|
SYSTEMD_BUS_TIMEOUT=${UPDATE_HELPER_USER_TIMEOUT_SEC}s systemctl reload "user@*.service"
|
- Provide (Lua-based) file triggers and adapt systemd.spec accordingly (boo#1133764)
More specifically, file triggers handle automatically installations or updates
of files for sysusers, tmpfiles, hwdb, journal catalog, udev rules, sysctl and
binfmt.
Therefore it makes a bunch of systemd rpm macros (such as %udev_hwdb_update,
%udev_rules_update, %journal_catalog_update, %tmpfiles_create,
%sysusers_create and so on) not needed anymore. However before considering
simplifying your spec files beware that these changes are not available in SLE
yet and will probably never reach the current releases (latest one being
SLE15-SP5 as of this writing).
Macros dealing with unit restart/enabling (such as %systemd_pre,
%service_add_pre, %service_del_postun, ...) are still needed though. However
reloading of systemd instances (and thus restarting of units) are delayed
until the very end of the package install/update transaction and is now done
only once.
Nevertheless to fully take advantage of file triggers, users have to activate
a specific zypper transaction backend which is still considered as
experimental, see bsc#1041742 for details.
- Provide a (slighlty) customized version of systemd-update-helper. Some of the
systemd rpm macros rely now on the helper and delegate their work to it. Hence
we don't need to rebuild all packages anymore when the content of the rpm
macros must be updated/fixed.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1390
2023-05-09 14:01:32 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [[ "$command" =~ restart ]]; then
|
2024-12-26 11:16:56 +00:00
|
|
|
users=$(systemctl list-units 'user@*' --legend=no | sed -n -r 's/.*user@([0-9]+).service.*/\1/p')
|
|
|
|
|
|
- Provide (Lua-based) file triggers and adapt systemd.spec accordingly (boo#1133764)
More specifically, file triggers handle automatically installations or updates
of files for sysusers, tmpfiles, hwdb, journal catalog, udev rules, sysctl and
binfmt.
Therefore it makes a bunch of systemd rpm macros (such as %udev_hwdb_update,
%udev_rules_update, %journal_catalog_update, %tmpfiles_create,
%sysusers_create and so on) not needed anymore. However before considering
simplifying your spec files beware that these changes are not available in SLE
yet and will probably never reach the current releases (latest one being
SLE15-SP5 as of this writing).
Macros dealing with unit restart/enabling (such as %systemd_pre,
%service_add_pre, %service_del_postun, ...) are still needed though. However
reloading of systemd instances (and thus restarting of units) are delayed
until the very end of the package install/update transaction and is now done
only once.
Nevertheless to fully take advantage of file triggers, users have to activate
a specific zypper transaction backend which is still considered as
experimental, see bsc#1041742 for details.
- Provide a (slighlty) customized version of systemd-update-helper. Some of the
systemd rpm macros rely now on the helper and delegate their work to it. Hence
we don't need to rebuild all packages anymore when the content of the rpm
macros must be updated/fixed.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1390
2023-05-09 14:01:32 +00:00
|
|
|
for user in $users; do
|
2024-12-26 11:16:56 +00:00
|
|
|
SYSTEMD_BUS_TIMEOUT=${UPDATE_HELPER_USER_TIMEOUT_SEC}s \
|
- Provide (Lua-based) file triggers and adapt systemd.spec accordingly (boo#1133764)
More specifically, file triggers handle automatically installations or updates
of files for sysusers, tmpfiles, hwdb, journal catalog, udev rules, sysctl and
binfmt.
Therefore it makes a bunch of systemd rpm macros (such as %udev_hwdb_update,
%udev_rules_update, %journal_catalog_update, %tmpfiles_create,
%sysusers_create and so on) not needed anymore. However before considering
simplifying your spec files beware that these changes are not available in SLE
yet and will probably never reach the current releases (latest one being
SLE15-SP5 as of this writing).
Macros dealing with unit restart/enabling (such as %systemd_pre,
%service_add_pre, %service_del_postun, ...) are still needed though. However
reloading of systemd instances (and thus restarting of units) are delayed
until the very end of the package install/update transaction and is now done
only once.
Nevertheless to fully take advantage of file triggers, users have to activate
a specific zypper transaction backend which is still considered as
experimental, see bsc#1041742 for details.
- Provide a (slighlty) customized version of systemd-update-helper. Some of the
systemd rpm macros rely now on the helper and delegate their work to it. Hence
we don't need to rebuild all packages anymore when the content of the rpm
macros must be updated/fixed.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1390
2023-05-09 14:01:32 +00:00
|
|
|
systemctl --user -M "$user@" reload-or-restart --marked &
|
|
|
|
|
done
|
|
|
|
|
wait
|
|
|
|
|
fi
|
|
|
|
|
;;
|
|
|
|
|
|
2025-04-22 15:15:46 +00:00
|
|
|
clean-state)
|
2025-07-15 17:33:51 +00:00
|
|
|
# Not used anymore, to be removed
|
2025-04-22 15:15:46 +00:00
|
|
|
;;
|
|
|
|
|
|
- Provide (Lua-based) file triggers and adapt systemd.spec accordingly (boo#1133764)
More specifically, file triggers handle automatically installations or updates
of files for sysusers, tmpfiles, hwdb, journal catalog, udev rules, sysctl and
binfmt.
Therefore it makes a bunch of systemd rpm macros (such as %udev_hwdb_update,
%udev_rules_update, %journal_catalog_update, %tmpfiles_create,
%sysusers_create and so on) not needed anymore. However before considering
simplifying your spec files beware that these changes are not available in SLE
yet and will probably never reach the current releases (latest one being
SLE15-SP5 as of this writing).
Macros dealing with unit restart/enabling (such as %systemd_pre,
%service_add_pre, %service_del_postun, ...) are still needed though. However
reloading of systemd instances (and thus restarting of units) are delayed
until the very end of the package install/update transaction and is now done
only once.
Nevertheless to fully take advantage of file triggers, users have to activate
a specific zypper transaction backend which is still considered as
experimental, see bsc#1041742 for details.
- Provide a (slighlty) customized version of systemd-update-helper. Some of the
systemd rpm macros rely now on the helper and delegate their work to it. Hence
we don't need to rebuild all packages anymore when the content of the rpm
macros must be updated/fixed.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1390
2023-05-09 14:01:32 +00:00
|
|
|
*)
|
|
|
|
|
echo >&2 "Unknown verb '$command'"
|
|
|
|
|
exit 3
|
|
|
|
|
;;
|
|
|
|
|
esac
|