summaryrefslogtreecommitdiff
path: root/sys-apps/systemd/files/update-etc-systemd-symlinks.sh
blob: ce81bba58f25104cd52571786a37a8af52278bf3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh
# Update symlinks to systemd units moved into /usr/systemd.
# (c) 2012 Michał Górny
# Released under the terms of the 2-clause BSD license

IFS_SAVE=${IFS}
IFS='
'
# follow + symlink type will match broken symlinks only
set -- $(find -L /etc/systemd/system -type l -print)
IFS=${IFS_SAVE}

for f; do
	old_path=$(readlink "${f}")
	new_path=/usr/lib${old_path#/lib}
	if [ -f "${new_path}" ]; then
		ln -v -s -f "${new_path}" "${f}"
	fi
done