diff --git a/config/functions b/config/functions index 1532100303..d03b083684 100644 --- a/config/functions +++ b/config/functions @@ -191,6 +191,22 @@ fix_module_depends() { rm new.modinfo* } +# Usage: enable_service [target] +enable_service () { + local unit="$1" + local unit_dir="/lib/systemd/system" + local target="$2" + local target_dir=$INSTALL + + [ -f "$target_dir/$unit_dir/$unit" ] || exit 1 + [ -z "$target" ] && target=`grep '^WantedBy' $target_dir/$unit_dir/$unit | cut -f2 -d=` + + if [ -n "$target" ]; then + mkdir -p ${target_dir}/$unit_dir/${target}.wants + ln -sf ../${unit} ${target_dir}/$unit_dir/${target}.wants/ + fi +} + check_path() { dashes="===========================" if [ "${PWD##/usr}" != "${PWD}" ]; then