2011-09-11 19:42:54 +02:00
|
|
|
#!/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/ ;;
|
2011-10-08 11:44:34 +02:00
|
|
|
*) ln -s -f /lib/systemd/system/${facilities[${stripped_dep:1}]:-${stripped_dep}.service} $1/$target.requires/ ;;
|
2011-09-11 19:42:54 +02:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done < /etc/insserv.conf
|
|
|
|
|