forked from pool/systemd
- Drop enablement symlink migration support of SysV init scripts
And let's finish reducing the support of SysV init scripts to its minimum. OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1252
This commit is contained in:
parent
53c0c58da9
commit
351e69e6e3
@ -1,8 +1,6 @@
|
||||
#
|
||||
# Please keep the list sorted (with `LC_ALL=C sort`).
|
||||
#
|
||||
%dir %{_localstatedir}/lib/systemd/migrated
|
||||
%dir %{_localstatedir}/lib/systemd/sysv-convert
|
||||
%dir %{_unitdir}/runlevel1.target.wants
|
||||
%dir %{_unitdir}/runlevel2.target.wants
|
||||
%dir %{_unitdir}/runlevel3.target.wants
|
||||
@ -19,55 +17,6 @@
|
||||
%{_sbindir}/runlevel
|
||||
%{_sbindir}/telinit
|
||||
%{_systemd_util_dir}/systemd-initctl
|
||||
%{_systemd_util_dir}/systemd-sysv-convert
|
||||
%{_systemd_util_dir}/systemd-sysv-install
|
||||
%{_systemdgeneratordir}/systemd-rc-local-generator
|
||||
%{_systemdgeneratordir}/systemd-sysv-generator
|
||||
%{_unitdir}/graphical.target.wants/systemd-update-utmp-runlevel.service
|
||||
%{_unitdir}/local-fs.target.wants/var-lock.mount
|
||||
%{_unitdir}/local-fs.target.wants/var-run.mount
|
||||
%{_unitdir}/multi-user.target.wants/systemd-update-utmp-runlevel.service
|
||||
%{_unitdir}/rc-local.service
|
||||
%{_unitdir}/rescue.target.wants/systemd-update-utmp-runlevel.service
|
||||
%{_unitdir}/runlevel0.target
|
||||
%{_unitdir}/runlevel1.target
|
||||
%{_unitdir}/runlevel2.target
|
||||
%{_unitdir}/runlevel3.target
|
||||
%{_unitdir}/runlevel4.target
|
||||
%{_unitdir}/runlevel5.target
|
||||
%{_unitdir}/runlevel6.target
|
||||
%{_unitdir}/sockets.target.wants/systemd-initctl.socket
|
||||
%{_unitdir}/systemd-initctl.service
|
||||
%{_unitdir}/systemd-initctl.socket
|
||||
%{_unitdir}/systemd-update-utmp-runlevel.service
|
||||
%{_unitdir}/var-lock.mount
|
||||
%{_unitdir}/var-run.mount
|
||||
%if %{with split_usr}
|
||||
/sbin/runlevel
|
||||
/sbin/telinit
|
||||
%endif
|
||||
#
|
||||
# Please keep the list sorted (with `LC_ALL=C sort`).
|
||||
#
|
||||
%dir %{_localstatedir}/lib/systemd/migrated
|
||||
%dir %{_localstatedir}/lib/systemd/sysv-convert
|
||||
%dir %{_unitdir}/runlevel1.target.wants
|
||||
%dir %{_unitdir}/runlevel2.target.wants
|
||||
%dir %{_unitdir}/runlevel3.target.wants
|
||||
%dir %{_unitdir}/runlevel4.target.wants
|
||||
%dir %{_unitdir}/runlevel5.target.wants
|
||||
%{_mandir}/man8/runlevel.8.gz
|
||||
%{_mandir}/man8/systemd-initctl.8.gz
|
||||
%{_mandir}/man8/systemd-initctl.service.8.gz
|
||||
%{_mandir}/man8/systemd-initctl.socket.8.gz
|
||||
%{_mandir}/man8/systemd-rc-local-generator.8.gz
|
||||
%{_mandir}/man8/systemd-sysv-generator.8.gz
|
||||
%{_mandir}/man8/systemd-update-utmp-runlevel.service.8.gz
|
||||
%{_mandir}/man8/telinit.8.gz
|
||||
%{_sbindir}/runlevel
|
||||
%{_sbindir}/telinit
|
||||
%{_systemd_util_dir}/systemd-initctl
|
||||
%{_systemd_util_dir}/systemd-sysv-convert
|
||||
%{_systemd_util_dir}/systemd-sysv-install
|
||||
%{_systemdgeneratordir}/systemd-rc-local-generator
|
||||
%{_systemdgeneratordir}/systemd-sysv-generator
|
||||
|
@ -1,120 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
info() {
|
||||
echo "$(basename $0): $*"
|
||||
}
|
||||
|
||||
warn() {
|
||||
echo >&2 "$(basename $0): warning, $*"
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo >&2 "usage: $(basename $0) --apply <service> [<service> ...]"
|
||||
}
|
||||
|
||||
if [ "$UID" != "0" ]; then
|
||||
warn "need to be root, aborting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $# -lt 2 ]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
database_lookup() {
|
||||
local service unused
|
||||
|
||||
# 'priority' field is not used but is kept for backward compat reason.
|
||||
while read service unused; do
|
||||
if [ $service == $1 ]; then
|
||||
return 0
|
||||
fi
|
||||
done </var/lib/systemd/sysv-convert/database
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
database_add() {
|
||||
# Write a dumb priority as it is not used.
|
||||
echo "$1 $2 50" >>/var/lib/systemd/sysv-convert/database
|
||||
}
|
||||
|
||||
# Initialize the database.
|
||||
if [ ! -e /var/lib/systemd/sysv-convert/database ]; then
|
||||
touch /var/lib/systemd/sysv-convert/database
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
--save)
|
||||
# --save is kept for backward compatibility.
|
||||
;;
|
||||
--apply)
|
||||
shift
|
||||
for service in $@; do
|
||||
# For backward compat we accept the name of the
|
||||
# service with or without the unit type suffix. If the
|
||||
# suffix is not there, assume .service type.
|
||||
case "$service" in
|
||||
*.*) initscript="${service%.*}" ;;
|
||||
*) initscript="$service"
|
||||
service="$service.service"
|
||||
esac
|
||||
|
||||
# Did we already migrate this service during a previous update ?
|
||||
database_lookup $initscript &&
|
||||
continue
|
||||
|
||||
# Sanity check.
|
||||
unit="/usr/lib/systemd/system/$service"
|
||||
if [ ! -f "$unit" ]; then
|
||||
warn "$unit not found, skipping"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Mark the service as processed to make sure we will do the migration only
|
||||
# once. This is important especially for packages that keep their init
|
||||
# scripts around even if they're no more used. Since the saved info won't
|
||||
# be reused again we simply use an invalid runlevel and add the service
|
||||
# in the db only once.
|
||||
database_add $initscript -1
|
||||
|
||||
# Some services were renamed during the transition from SySV init to
|
||||
# systemd (bsc#1181788). Rather than letting packages fixing that
|
||||
# themselves by hacking our database directly, let's hard-code renames
|
||||
# here. Not really nice but that's the least worst solution.
|
||||
case $initscript in
|
||||
ntpd) initscript=ntp ;;
|
||||
esac
|
||||
|
||||
# The package is introducing new services and never has any sysv init
|
||||
# scripts (bsc#982303).
|
||||
if [ ! -r /etc/init.d/$initscript ] &&
|
||||
[ ! -r /etc/init.d/boot.$initscript ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
for rcnd in rc2.d rc3.d rc4.d rc5.d boot.d; do
|
||||
# Was the sysvinit script enabled ? (bsc#982211)
|
||||
case $rcnd in
|
||||
boot.d) [ -L /etc/rc.d/boot.d/S??boot.$initscript ] || continue ;;
|
||||
*) [ -L /etc/rc.d/$rcnd/S??$initscript ] || continue
|
||||
esac
|
||||
|
||||
case $rcnd in
|
||||
boot.d) runlevel=3 ;;
|
||||
*) runlevel=${rcnd:2:1}
|
||||
esac
|
||||
|
||||
target=runlevel$runlevel.target
|
||||
info "enabling $unit (wanted by $target)..."
|
||||
|
||||
mkdir -p "/etc/systemd/system/$target.wants"
|
||||
ln -sf $unit /etc/systemd/system/$target.wants/$service
|
||||
done
|
||||
done
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
esac
|
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Feb 17 18:30:12 UTC 2022 - Franck Bui <fbui@suse.com>
|
||||
|
||||
- Drop enablement symlink migration support of SysV init scripts
|
||||
|
||||
And let's finish reducing the support of SysV init scripts to its minimum.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Feb 14 15:11:04 UTC 2022 - Franck Bui <fbui@suse.com>
|
||||
|
||||
|
@ -183,7 +183,6 @@ Source0: systemd-v%{version}%{suse_version}.tar.xz
|
||||
Source1: systemd-rpmlintrc
|
||||
Source2: systemd-user
|
||||
%if %{with sysvcompat}
|
||||
Source3: systemd-sysv-convert
|
||||
Source4: systemd-sysv-install
|
||||
%endif
|
||||
Source5: tmpfiles-suse.conf
|
||||
@ -720,10 +719,6 @@ rm %{buildroot}%{_mandir}/man1/resolvconf.1*
|
||||
%endif
|
||||
|
||||
%if %{with sysvcompat}
|
||||
mkdir -p %{buildroot}%{_localstatedir}/lib/systemd/sysv-convert
|
||||
mkdir -p %{buildroot}%{_localstatedir}/lib/systemd/migrated
|
||||
|
||||
install -m0755 -D %{SOURCE3} %{buildroot}/%{_systemd_util_dir}/systemd-sysv-convert
|
||||
install -m0755 -D %{SOURCE4} %{buildroot}/%{_systemd_util_dir}/systemd-sysv-install
|
||||
%endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user