systemd-systemctl-native: add multiple services support

Thanks to Otavio Salvador for helping hint [1]

[1] http://lists.linuxtogo.org/pipermail/openembedded-devel/2012-February/037856.html

Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
Acked-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
This commit is contained in:
Andreas Müller 2012-02-16 02:02:55 +00:00 committed by Koen Kooi
parent 2b402359f2
commit 9d72ff10c5

View File

@ -10,20 +10,28 @@ while [ $# != 0 ]; do
enable) enable)
shift shift
service="$1" services="$1"
in_enable="1"
shift shift
;; ;;
--root=*) --root=*)
ROOT=${opt##--root=} ROOT=${opt##--root=}
in_enable="0"
shift shift
;; ;;
*) *)
if [ "$in_enable" = "1" ]; then
services="$services $opt"
shift
else
echo "'$opt' is an unkown option; exiting with error" echo "'$opt' is an unkown option; exiting with error"
exit 1 exit 1
fi
;; ;;
esac esac
done done
for service in "$services"; do
# find service file # find service file
for p in $ROOT/etc/systemd/system \ for p in $ROOT/etc/systemd/system \
$ROOT/lib/systemd/system \ $ROOT/lib/systemd/system \
@ -57,3 +65,4 @@ also=$(grep Also $ROOT/$service_file \
for a in $also; do for a in $also; do
$0 --root=$ROOT enable $a $0 --root=$ROOT enable $a
done done
done