config: handle multiple WantedBy targets in enable_service

This commit is contained in:
Matt DeVillier 2016-02-19 18:01:24 -06:00 committed by chewitt
parent 1e3a6b12bf
commit 06cfa30851

View File

@ -224,11 +224,13 @@ enable_service () {
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/
if [ -z "$target" ] ; then
for target in `grep '^WantedBy' $target_dir/$unit_dir/$unit | cut -f2 -d=` ; do
if [ -n "$target" ]; then
mkdir -p ${target_dir}/$unit_dir/${target}.wants
ln -sf ../${unit} ${target_dir}/$unit_dir/${target}.wants/
fi
done
fi
}