systemd/scripts-systemd-upgrade-from-pre-210.sh

35 lines
1.2 KiB
Bash
Raw Normal View History

Accepting request 526193 from home:fbui:systemd:Factory - Import commit 58ea3c819cca1639ef8c922505c573ba5e262b3d 334945091 shutdown: fix incorrect fscanf() result check (#6806) 027202892 shutdown: don't remount,ro network filesystems. (#6588) (bsc#1035386) bc77b53a5 shutdown: don't be fooled when detaching DM devices with BTRFS (boo#1055641) d9d293847 util: make get_block_device() available 421ce7382 tmpfiles: silently ignore any path that passes through autofs (#6506) (bsc#1045472) ca8f90e62 device: make sure to remove all device units sharing the same sysfs path (#6679) - Make use of "%tmpfiles_create" in %post of the logger subpackage - Add scripts-udev-convert-lib-udev-path.sh (bsc#1050152) This script takes care of converting /lib/udev into a symlink pointing to /usr/lib/udev when upgrading a distro using an old version of udev. - Make use of "%make_build" rpm macro - Renumber scripts to start at index 100 - Introduce scripts-systemd-upgrade-from-pre-210.sh It collects all existing hacks done in %post to fix old/deprecated settings in systemd older than 210. This includes hacks needed to fix system that are migrating from SysV. There shouldn't be any functional changes. - Move scripts for packaging workaround/fixes in /usr/lib/systemd/scripts It also renames fix-machines-subvol-for-rollbacks.sh into scripts-systemd-fix-machines-btrfs-subvol.sh Note that the "scripts-systemd-" prefix is used for those scripts so we can gather them. Why not using a directory instead ? because osc OBS-URL: https://build.opensuse.org/request/show/526193 OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=988
2017-09-14 18:48:49 +02:00
#! /bin/bash
#
# This script is supposed to be executed from the %post section. It contains all
# hacks needed to update a system which was running systemd < v210. This also
# includes systems migrating from SysV.
#
# All hacks can potentially break the admin settings since they work in /etc...
Accepting request 526193 from home:fbui:systemd:Factory - Import commit 58ea3c819cca1639ef8c922505c573ba5e262b3d 334945091 shutdown: fix incorrect fscanf() result check (#6806) 027202892 shutdown: don't remount,ro network filesystems. (#6588) (bsc#1035386) bc77b53a5 shutdown: don't be fooled when detaching DM devices with BTRFS (boo#1055641) d9d293847 util: make get_block_device() available 421ce7382 tmpfiles: silently ignore any path that passes through autofs (#6506) (bsc#1045472) ca8f90e62 device: make sure to remove all device units sharing the same sysfs path (#6679) - Make use of "%tmpfiles_create" in %post of the logger subpackage - Add scripts-udev-convert-lib-udev-path.sh (bsc#1050152) This script takes care of converting /lib/udev into a symlink pointing to /usr/lib/udev when upgrading a distro using an old version of udev. - Make use of "%make_build" rpm macro - Renumber scripts to start at index 100 - Introduce scripts-systemd-upgrade-from-pre-210.sh It collects all existing hacks done in %post to fix old/deprecated settings in systemd older than 210. This includes hacks needed to fix system that are migrating from SysV. There shouldn't be any functional changes. - Move scripts for packaging workaround/fixes in /usr/lib/systemd/scripts It also renames fix-machines-subvol-for-rollbacks.sh into scripts-systemd-fix-machines-btrfs-subvol.sh Note that the "scripts-systemd-" prefix is used for those scripts so we can gather them. Why not using a directory instead ? because osc OBS-URL: https://build.opensuse.org/request/show/526193 OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=988
2017-09-14 18:48:49 +02:00
#
#
# During migration from sysvinit to systemd, we used to set the systemd default
# target to one of the 'runlevel*.target' after reading the default runlevel
# from /etc/inittab. We don't do that anymore because in most cases using the
# graphical.target target, which is the default, will do the right
# thing. Moreover the runlevel targets are considered as deprecated, so we
# convert them into "true" systemd targets instead here.
#
if target=$(readlink /etc/systemd/system/default.target); then
target=$(basename $target)
case "$target" in
runlevel?.target)
echo "Default systemd target is '$target' but use of runlevels is deprecated"
systemctl --no-reload set-default $target
esac
Accepting request 526193 from home:fbui:systemd:Factory - Import commit 58ea3c819cca1639ef8c922505c573ba5e262b3d 334945091 shutdown: fix incorrect fscanf() result check (#6806) 027202892 shutdown: don't remount,ro network filesystems. (#6588) (bsc#1035386) bc77b53a5 shutdown: don't be fooled when detaching DM devices with BTRFS (boo#1055641) d9d293847 util: make get_block_device() available 421ce7382 tmpfiles: silently ignore any path that passes through autofs (#6506) (bsc#1045472) ca8f90e62 device: make sure to remove all device units sharing the same sysfs path (#6679) - Make use of "%tmpfiles_create" in %post of the logger subpackage - Add scripts-udev-convert-lib-udev-path.sh (bsc#1050152) This script takes care of converting /lib/udev into a symlink pointing to /usr/lib/udev when upgrading a distro using an old version of udev. - Make use of "%make_build" rpm macro - Renumber scripts to start at index 100 - Introduce scripts-systemd-upgrade-from-pre-210.sh It collects all existing hacks done in %post to fix old/deprecated settings in systemd older than 210. This includes hacks needed to fix system that are migrating from SysV. There shouldn't be any functional changes. - Move scripts for packaging workaround/fixes in /usr/lib/systemd/scripts It also renames fix-machines-subvol-for-rollbacks.sh into scripts-systemd-fix-machines-btrfs-subvol.sh Note that the "scripts-systemd-" prefix is used for those scripts so we can gather them. Why not using a directory instead ? because osc OBS-URL: https://build.opensuse.org/request/show/526193 OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=988
2017-09-14 18:48:49 +02:00
fi
#
# Migrate any symlink which may refer to the old path.
#
Accepting request 526193 from home:fbui:systemd:Factory - Import commit 58ea3c819cca1639ef8c922505c573ba5e262b3d 334945091 shutdown: fix incorrect fscanf() result check (#6806) 027202892 shutdown: don't remount,ro network filesystems. (#6588) (bsc#1035386) bc77b53a5 shutdown: don't be fooled when detaching DM devices with BTRFS (boo#1055641) d9d293847 util: make get_block_device() available 421ce7382 tmpfiles: silently ignore any path that passes through autofs (#6506) (bsc#1045472) ca8f90e62 device: make sure to remove all device units sharing the same sysfs path (#6679) - Make use of "%tmpfiles_create" in %post of the logger subpackage - Add scripts-udev-convert-lib-udev-path.sh (bsc#1050152) This script takes care of converting /lib/udev into a symlink pointing to /usr/lib/udev when upgrading a distro using an old version of udev. - Make use of "%make_build" rpm macro - Renumber scripts to start at index 100 - Introduce scripts-systemd-upgrade-from-pre-210.sh It collects all existing hacks done in %post to fix old/deprecated settings in systemd older than 210. This includes hacks needed to fix system that are migrating from SysV. There shouldn't be any functional changes. - Move scripts for packaging workaround/fixes in /usr/lib/systemd/scripts It also renames fix-machines-subvol-for-rollbacks.sh into scripts-systemd-fix-machines-btrfs-subvol.sh Note that the "scripts-systemd-" prefix is used for those scripts so we can gather them. Why not using a directory instead ? because osc OBS-URL: https://build.opensuse.org/request/show/526193 OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=988
2017-09-14 18:48:49 +02:00
for f in $(find /etc/systemd/system -type l -xtype l); do
new_target="/usr$(readlink $f)"
[ -f "$new_target" ] && ln -s -f $new_target $f
done