SHA256
1
0
forked from pool/systemd
systemd/scripts-systemd-upgrade-from-pre-210.sh

37 lines
1.4 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...
# Try to read default runlevel from the old inittab if it exists. If
# it fails fallback to runlevel 3 which should still be better than
# the rescue shell.
#
# Note: /etc/inittab was part of the aaa_base package which can be
# upgraded before systemd is. Therefore this file is likely to be
# missing.
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
if [ ! -e /etc/systemd/system/default.target -a -e /etc/inittab ]; then
runlevel=$(sed -n -r "s/^id:([[:digit:]]):initdefault:/\1/p" /etc/inittab)
: ${runlevel:=3}
echo "Initializing default.target to runlevel${runlevel}.target"
ln -s /usr/lib/systemd/system/runlevel${runlevel}.target /etc/systemd/system/default.target
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
# since v207 /etc/sysctl.conf is no longer parsed, however
# backward compatibility is provided by /etc/sysctl.d/99-sysctl.conf
if [ ! -L /etc/sysctl.d/99-sysctl.conf -a -e /etc/sysctl.conf ]; then
ln -sf /etc/sysctl.conf /etc/sysctl.d/99-sysctl.conf
fi
# migrate any symlink which may refer to the old path
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