diff options
| author | Otavio Salvador <otavio@ossystems.com.br> | 2012-04-04 12:32:54 +0000 |
|---|---|---|
| committer | Koen Kooi <koen@dominion.thruhere.net> | 2012-04-04 20:36:47 +0200 |
| commit | 3f79074a70a0476b0b66cbd374f2359cc9c09fb7 (patch) | |
| tree | 548092ddf0ae26bc115f681299e02a3ce4c7d1e8 /meta-oe/recipes-core/systemd | |
| parent | 294a0b5cee0ccb752a73092d4548dac0ecc6c4c4 (diff) | |
| download | meta-openembedded-3f79074a70a0476b0b66cbd374f2359cc9c09fb7.tar.gz | |
systemd-systemctl-native: add support to disable services
This adds support to disable services making possible to it to be done
during rootfs generation.
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Diffstat (limited to 'meta-oe/recipes-core/systemd')
| -rw-r--r-- | meta-oe/recipes-core/systemd/systemd-systemctl-native.bb | 2 | ||||
| -rwxr-xr-x | meta-oe/recipes-core/systemd/systemd-systemctl-native/systemctl | 32 |
2 files changed, 26 insertions, 8 deletions
diff --git a/meta-oe/recipes-core/systemd/systemd-systemctl-native.bb b/meta-oe/recipes-core/systemd/systemd-systemctl-native.bb index dcd67ee547..78eb8f36bb 100644 --- a/meta-oe/recipes-core/systemd/systemd-systemctl-native.bb +++ b/meta-oe/recipes-core/systemd/systemd-systemctl-native.bb | |||
| @@ -3,7 +3,7 @@ DESCRIPTION = "Wrapper to enable of systemd services" | |||
| 3 | LICENSE = "MIT" | 3 | LICENSE = "MIT" |
| 4 | LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58" | 4 | LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58" |
| 5 | 5 | ||
| 6 | PR = "r1" | 6 | PR = "r2" |
| 7 | 7 | ||
| 8 | inherit native | 8 | inherit native |
| 9 | 9 | ||
diff --git a/meta-oe/recipes-core/systemd/systemd-systemctl-native/systemctl b/meta-oe/recipes-core/systemd/systemd-systemctl-native/systemctl index b86f3cd742..c4a0a3fade 100755 --- a/meta-oe/recipes-core/systemd/systemd-systemctl-native/systemctl +++ b/meta-oe/recipes-core/systemd/systemd-systemctl-native/systemctl | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | ROOT= | 3 | ROOT= |
| 4 | 4 | ||
| 5 | # parse command line params | 5 | # parse command line params |
| 6 | action= | ||
| 6 | while [ $# != 0 ]; do | 7 | while [ $# != 0 ]; do |
| 7 | opt="$1" | 8 | opt="$1" |
| 8 | 9 | ||
| @@ -10,17 +11,26 @@ while [ $# != 0 ]; do | |||
| 10 | enable) | 11 | enable) |
| 11 | shift | 12 | shift |
| 12 | 13 | ||
| 14 | action="$opt" | ||
| 13 | services="$1" | 15 | services="$1" |
| 14 | in_enable="1" | 16 | cmd_args="1" |
| 17 | shift | ||
| 18 | ;; | ||
| 19 | disable) | ||
| 20 | shift | ||
| 21 | |||
| 22 | action="$opt" | ||
| 23 | services="$1" | ||
| 24 | cmd_args="1" | ||
| 15 | shift | 25 | shift |
| 16 | ;; | 26 | ;; |
| 17 | --root=*) | 27 | --root=*) |
| 18 | ROOT=${opt##--root=} | 28 | ROOT=${opt##--root=} |
| 19 | in_enable="0" | 29 | cmd_args="0" |
| 20 | shift | 30 | shift |
| 21 | ;; | 31 | ;; |
| 22 | *) | 32 | *) |
| 23 | if [ "$in_enable" = "1" ]; then | 33 | if [ "$cmd_args" = "1" ]; then |
| 24 | services="$services $opt" | 34 | services="$services $opt" |
| 25 | shift | 35 | shift |
| 26 | else | 36 | else |
| @@ -53,9 +63,15 @@ for service in $services; do | |||
| 53 | | grep '\.target$') | 63 | | grep '\.target$') |
| 54 | 64 | ||
| 55 | for r in $wanted_by; do | 65 | for r in $wanted_by; do |
| 56 | mkdir -p $ROOT/etc/systemd/system/$r.wants | 66 | if [ "$action" = "enable" ]; then |
| 57 | ln -s $service_file $ROOT/etc/systemd/system/$r.wants | 67 | mkdir -p $ROOT/etc/systemd/system/$r.wants |
| 58 | echo "Enabled $service for $wanted_by." | 68 | ln -s $service_file $ROOT/etc/systemd/system/$r.wants |
| 69 | echo "Enabled $service for $wanted_by." | ||
| 70 | else | ||
| 71 | rm -f $ROOT/etc/systemd/system/$r.wants/$service_file | ||
| 72 | rmdirs -p $ROOT/etc/systemd/system/$r.wants | ||
| 73 | echo "Disabled $service for $wanted_by." | ||
| 74 | fi | ||
| 59 | done | 75 | done |
| 60 | 76 | ||
| 61 | # call us for the other required scripts | 77 | # call us for the other required scripts |
| @@ -63,6 +79,8 @@ for service in $services; do | |||
| 63 | | sed 's,Also=,,g' \ | 79 | | sed 's,Also=,,g' \ |
| 64 | | tr ',' '\n') | 80 | | tr ',' '\n') |
| 65 | for a in $also; do | 81 | for a in $also; do |
| 66 | $0 --root=$ROOT enable $a | 82 | if [ "$action" = "enable" ]; then |
| 83 | $0 --root=$ROOT enable $a | ||
| 84 | fi | ||
| 67 | done | 85 | done |
| 68 | done | 86 | done |
