Dominique Leuenberger 2018-03-09 09:35:57 +00:00 committed by Git OBS Bridge
commit debb4337d5
5 changed files with 13 additions and 179 deletions

View File

@ -1 +0,0 @@
disable *

View File

@ -1,120 +0,0 @@
#! /bin/bash
#
# Written by sbrabec@suse.com
#
declare -a PRESET_FILES
declare -A PRESETS
declare -A PRESETS_OLD
declare -A PRESETS_OLD_WILDCARD
declare -A PRESETS_WILDCARD
save_preset_states () {
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)
PRESETS[$SERVICE]=$ENABLE;;
esac
done
exec 3<&-
done
exec 3>systemd_preset-old.rpm-tmp
for PRESET in "${!PRESETS[@]}" ; do
echo >&3 "${PRESETS[$PRESET]} $PRESET"
done
exec 3>&-
}
apply_preset_state_changes () {
if ! test -f systemd_preset-old.rpm-tmp ; then
return
fi
exec 3<systemd_preset-old.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 >systemd_preset-states.rpm-tmp
exec 3<systemd_preset-states.rpm-tmp
read -u3 PAD
while read -u3 SERVICE ENABLE PAD ; do
if test -z "$SERVICE" ; then
break
fi
# FIXME: This is not strictly correct as associative
# arrays are not ordered.
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 systemd_preset-{old,states}.rpm-tmp
}
cd /usr/lib/systemd/system-preset
case $1 in
apply-changes)
apply_preset_state_changes ;;
save)
save_preset_states ;;
*)
echo >&2 "Unkown command '$1'"
exit 1
esac

View File

@ -1,50 +0,0 @@
enable YaST2-Firstboot.service
enable YaST2-Second-Stage.service
enable apparmor.service
enable auditd.service
enable avahi-daemon.service
enable backup-rpmdb.timer
enable backup-sysconfig.timer
enable btrfs-balance.timer
enable btrfs-defrag.timer
enable btrfs-scrub.timer
enable btrfs-trim.timer
enable btrfsmaintenance-refresh.service
enable ca-certificates.path
enable ca-certificates.service
enable check-battery.timer
enable cron.service
enable display-manager.service
enable dm-event.socket
disable fstrim.service
enable fstrim.timer
enable getty@.service
enable haveged.service
enable irqbalance.service
enable iscsi.service
enable iscsid.socket
enable issue-generator.service
enable kbdsettings.service
enable klog.service
enable logrotate.timer
enable lvm2-lvmetad.socket
enable lvm2-monitor.service
enable lvm2-lvmpolld.socket
enable mcelog.service
enable ModemManager.service
enable nscd.service
enable postfix.service
enable purge-kernels.service
enable remote-fs.target
enable rsyslog.service
enable shadow.timer
enable smartd.service
enable snapper-cleanup.timer
enable snapper-timeline.timer
enable storage-fixup.service
enable updatedb.timer
enable uuidd.socket
enable vmblock-fuse.service
enable vmtoolsd.service
enable xencommons.service
enable pcscd.socket

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Feb 28 13:44:55 UTC 2018 - meissner@suse.com
- split out common service to be default enabled on all SUSE
distributions from the branding. FATE#322139
-------------------------------------------------------------------
Mon Feb 5 11:28:07 CET 2018 - kukuk@suse.de

View File

@ -22,16 +22,15 @@ Name: %{generic_name}-openSUSE
Version: 12.2
Release: 0
Summary: Systemd default presets for openSUSE
License: GPL-2.0+
License: GPL-2.0-or-later
Group: System/Base
Source0: default-SUSE.preset
Source1: default-openSUSE.preset
Source2: 99-default-disable.preset
Source3: branding-preset-states
# FIXME: why systemd is required ?
BuildRequires: systemd
#!BuildIgnore: systemd-presets-branding
PreReq: coreutils
BuildRequires: systemd-presets-common-SUSE
Requires(pre): systemd-presets-common-SUSE
Provides: %{generic_name} = %{version}
Supplements: packageand(systemd:branding-openSUSE)
Conflicts: otherproviders(%{generic_name})
@ -44,6 +43,10 @@ Requires(post): bash
%description
Default presets for systemd on openSUSE distribution.
These are the openSUSE specific presets. The default
presets needed for all SUSE based distributions can be
found in systemd-presets-branding-common-SUSE.
%prep
%setup -q -T -c
@ -53,12 +56,8 @@ Default presets for systemd on openSUSE distribution.
mkdir -p %{buildroot}%{_prefix}/lib/%{generic_name}
mkdir -p %{buildroot}%{_prefix}/lib/systemd/system-preset
# everything that must be enabled to have a working system.
# shared across all brands
install -m644 %{SOURCE0} %{buildroot}%{_prefix}/lib/systemd/system-preset/90-default-SUSE.preset
# everything that must be enabled only in openSUSE
install -m644 %{SOURCE1} %{buildroot}%{_prefix}/lib/systemd/system-preset/90-default-openSUSE.preset
install -m644 %{SOURCE2} %{buildroot}%{_prefix}/lib/systemd/system-preset/
install -m755 %{SOURCE3} %{buildroot}%{_prefix}/lib/%{generic_name}/
%pre
# On initial installation, branding-preset-states does not yet exist,