31 lines
1.1 KiB
Bash
31 lines
1.1 KiB
Bash
|
#! /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 [ ! -e /etc/systemd/system/default.target -a -e /etc/inittab ]; then
|
||
|
runlevel=$(awk -F ':' '$3 == "initdefault" && $1 !~ "^#" { print $2 }' /etc/inittab)
|
||
|
if [ -n "$runlevel" ] ; then
|
||
|
ln -sf /usr/lib/systemd/system/runlevel$runlevel.target /etc/systemd/system/default.target
|
||
|
fi
|
||
|
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
|
||
|
|