forked from pool/systemd
35 lines
1010 B
Plaintext
35 lines
1010 B
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
[ -r /etc/insserv.conf ] || exit 0
|
||
|
|
||
|
declare -A facilities
|
||
|
facilities["local_fs"]="local-fs.target"
|
||
|
facilities["localfs"]="local-fs.target"
|
||
|
facilities["named"]="nss-lookup.target"
|
||
|
facilities["network"]="network.target"
|
||
|
# done in systemd code
|
||
|
#facilities["portmap"]="rpcbind.target"
|
||
|
facilities["remote_fs"]="remote-fs.target"
|
||
|
facilities["syslog"]="syslog.target"
|
||
|
facilities["time"]="time-sync.target"
|
||
|
|
||
|
while read line ; do
|
||
|
case "$line" in
|
||
|
\#*|"" ) continue;;
|
||
|
\<* ) continue;;
|
||
|
\$*) t=${line%% *}
|
||
|
target=${facilities[${t:1}]}
|
||
|
[ -z $target ] && continue
|
||
|
mkdir -p $1/$target.{requires,wants}
|
||
|
for dep in ${line##* } ; do
|
||
|
stripped_dep=${dep/boot./}
|
||
|
case "$stripped_dep" in
|
||
|
+*) ln -s -f /lib/systemd/system/${facilities[${stripped_dep:2}]:-${stripped_dep:1}.service} $1/$target.wants/ ;;
|
||
|
*) ln -s -f /lib/systemd/system/${facilities[${stripped_dep:1}]:-${stripped_dep}.service} $1/$target.wants/ ;;
|
||
|
esac
|
||
|
done
|
||
|
;;
|
||
|
esac
|
||
|
done < /etc/insserv.conf
|
||
|
|