Hello community,
here is the log from the commit of package systemd-rpm-macros for
openSUSE:Factory checked in at 2015-09-19 06:51:35
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/systemd-rpm-macros (Old)
and /work/SRC/openSUSE:Factory/.systemd-rpm-macros.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "systemd-rpm-macros"
Changes:
--------
--- /work/SRC/openSUSE:Factory/systemd-rpm-macros/systemd-rpm-macros.changes
2015-07-21 13:24:39.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.systemd-rpm-macros.new/systemd-rpm-macros.changes
2015-09-19 06:51:37.000000000 +0200
@@ -1,0 +2,9 @@
+Tue Aug 4 17:59:54 CEST 2015 - [email protected]
+
+- Add %systemd_preset_pre and %systemd_preset_posttrans that will
+ do one shot presetting of all services with changed system
+ preset. It makes possible to to fix bad default service state
+ (bnc#900935#c46, FATE#318949, FATE#317727, bnc#921075).
+- Increment version to 3.
+
+-------------------------------------------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ systemd-rpm-macros.spec ++++++
--- /var/tmp/diff_new_pack.gODXRY/_old 2015-09-19 06:51:39.000000000 +0200
+++ /var/tmp/diff_new_pack.gODXRY/_new 2015-09-19 06:51:39.000000000 +0200
@@ -17,7 +17,7 @@
Name: systemd-rpm-macros
-Version: 2
+Version: 3
Release: 0
Summary: RPM macros for systemd
License: LGPL-2.1+
++++++ macros.systemd ++++++
--- /var/tmp/diff_new_pack.gODXRY/_old 2015-09-19 06:51:39.000000000 +0200
+++ /var/tmp/diff_new_pack.gODXRY/_new 2015-09-19 06:51:39.000000000 +0200
@@ -18,7 +18,17 @@
#
# %postun
# %service_del_postun demo.service
-#
+#
+###
+#
+# When a package install systemd preset files, it should use the following
macros:
+#
+# %pre -p /bin/bash
+# %systemd_preset_pre
+#
+# %posttrans -p /bin/bash
+# %systemd_preset_posttrans
+#
###
# This is for systemctl
@@ -216,3 +226,108 @@
[ -x /usr/lib/systemd/systemd-binfmt ] && \
/usr/lib/systemd/systemd-binfmt %{?*} || : \
%{nil}
+
+%systemd_preset_pre() \
+cd /usr/lib/systemd/system-preset; \
+declare -a PRESET_FILES; \
+declare -A PRESETS; \
+PRESET_FILES=(*.preset); \
+if ! test -f presets-all.rpm-tmp ; then \
+ for ((i=${#PRESET_FILES[@]}-1 ; i>= 0 ; i-- )) ; do \
+ FILE=${PRESET_FILES[i]}; \
+ exec 3<"$FILE"; \
+ while read -u3 ENABLE SERVICE PAD ; do \
+ if test -z "$SERVICE" ; then \
+ continue; \
+ fi; \
+ case "$ENABLE" in \
+ enable|disable) \
+ PRESETS[$SERVICE]=$ENABLE;; \
+ esac; \
+ done; \
+ exec 3<&-; \
+ done; \
+ exec 3>presets-all.rpm-tmp; \
+ for PRESET in "${!PRESETS[@]}" ; do \
+ echo >&3 "${PRESETS[$PRESET]} $PRESET"; \
+ done; \
+ exec 3>&-; \
+fi; \
+%{nil}
+
+%systemd_preset_posttrans() \
+cd /usr/lib/systemd/system-preset; \
+declare -a PRESET_FILES; \
+declare -A PRESETS_OLD; \
+declare -A PRESETS_OLD_WILDCARD; \
+declare -A PRESETS; \
+declare -A PRESETS_WILDCARD; \
+if test -f presets-all.rpm-tmp ; then \
+ exec 3<presets-all.rpm-tmp; \
+ while read -u3 ENABLE SERVICE PAD ; do \
+ if test -z "$SERVICE" ; then \
+ continue; \
+ fi; \
+ case "$ENABLE" in \
+ enable|disable) \
+ case $SERVICE in \
+ *"*"*|*"?"*) PRESETS_OLD_WILDCARD[$SERVICE]=$ENABLE;; \
+ *) PRESETS_OLD[$SERVICE]=$ENABLE;; \
+ esac;; \
+ esac; \
+ done; \
+ exec 3<&-; \
+ PRESET_FILES=(*.preset); \
+ for ((i=${#PRESET_FILES[@]}-1 ; i>= 0 ; i-- )) ; do \
+ FILE=${PRESET_FILES[i]}; \
+ exec 3<"$FILE"; \
+ while read -u3 ENABLE SERVICE PAD ; do \
+ if test -z "$SERVICE" ; then \
+ continue; \
+ fi; \
+ case "$ENABLE" in \
+ enable|disable) \
+ case $SERVICE in \
+ *"*"*|*"?"*)
PRESETS_WILDCARD[$SERVICE]=$ENABLE;; \
+ *) PRESETS[$SERVICE]=$ENABLE;; \
+ esac;; \
+ esac; \
+ done; \
+ exec 3<&-; \
+ done; \
+ if test -x /usr/bin/systemctl ; then \
+ /usr/bin/systemctl --type=service,socket list-unit-files; \
+ fi >service-states.rpm-tmp; \
+ exec 3<service-states.rpm-tmp; \
+ read -u3 PAD; \
+ while read -u3 SERVICE ENABLE PAD ; do \
+ if test -z "$SERVICE" ; then \
+ break; \
+ fi; \
+ ENABLE_OLD=enable; \
+ for PRESET in "${!PRESETS_OLD_WILDCARD[@]}" ; do \
+ case "$SERVICE" in \
+ $PRESET) ENABLE_OLD=${PRESETS_OLD_WILDCARD[$PRESET]};; \
+ esac; \
+ done; \
+ if test -n "${PRESETS_OLD[$SERVICE]}" ; then \
+ ENABLE_OLD="${PRESETS_OLD[$SERVICE]}"; \
+ fi; \
+ ENABLE_NEW=enable; \
+ for PRESET in "${!PRESETS_WILDCARD[@]}" ; do \
+ case "$SERVICE" in \
+ $PRESET) ENABLE_NEW=${PRESETS_WILDCARD[$PRESET]};; \
+ esac; \
+ done; \
+ if test -n "${PRESETS[$SERVICE]}" ; then \
+ ENABLE_NEW="${PRESETS[$SERVICE]}"; \
+ fi; \
+ if test "$ENABLE_OLD" != "$ENABLE_NEW" ; then \
+ echo "Resetting $SERVICE to the new default:
$ENABLE_NEW"; \
+ /usr/bin/systemctl preset "$SERVICE" || :; \
+ fi; \
+ done; \
+ exec 3<&-; \
+ rm -f presets-all.rpm-tmp service-states.rpm-tmp; \
+fi; \
+%{nil}