Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalware.git;a=commitdiff;h=2ad588765a57dd2f76171c5dc24d193a9f2b879c
commit 2ad588765a57dd2f76171c5dc24d193a9f2b879c Author: Miklos Vajna <vmik...@frugalware.org> Date: Thu Dec 16 01:12:58 2010 +0100 service: add systemd support In case 'service foo bar' is used but no /etc/rc.d/rc.foo is available, give systemd a shot. diff --git a/var/service b/var/service index 1072b04..2caf8f9 100644 --- a/var/service +++ b/var/service @@ -1,6 +1,6 @@ #!/bin/sh -# (c) 2003, 2004, 2008 Miklos Vajna <vmik...@frugalware.org> +# (c) 2003, 2004, 2008, 2010 Miklos Vajna <vmik...@frugalware.org> # service for Frugalware # distributed under GPL License @@ -37,7 +37,7 @@ fi if [ "$1" = "--version" ]; then echo "service (pacman-tools) 0.2.1" echo - echo "Copyright (c) 2003-2008 by Miklos Vajna <vmik...@frugalware.org>" + echo "Copyright (c) 2003-2010 by Miklos Vajna <vmik...@frugalware.org>" echo "This is free software; see the source for copying conditions. There is NO" echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." exit 0 @@ -46,6 +46,7 @@ elif [ "$1" = "--help" ]; then fi if [ "$1" = "level" ]; then + # this is undocumented, so we can avoid adding systemd support here if [ "$2" != "" ]; then if [ "$3" != "" ]; then ## well just support english for now 'on' is not @@ -60,6 +61,7 @@ if [ "$1" = "level" ]; then exit 1 fi else + if [ -e /etc/rc.d/rc.$1 ]; then service=rc.$1 name=/etc/rc.d/$service if ! [ -z "$1" ]; then @@ -87,4 +89,21 @@ else else $name $2 fi + else + # no such init script? let's give systemd a try, then + service=$1.service + if [ "$2" = "add" ]; then + systemctl enable $service + elif [ "$2" = "del" ]; then + systemctl disable $service + elif [ "$2" = "list" ]; then + if systemctl is-enabled $service; then + echo enabled + else + echo disabled + fi + else + systemctl $2 $service + fi + fi fi _______________________________________________ Frugalware-git mailing list Frugalware-git@frugalware.org http://frugalware.org/mailman/listinfo/frugalware-git