View | Details | Raw Unified | Return to bug 24989
Collapse All | Expand All

(-)a/service/service (-3 / +13 lines)
Lines 8-14 PATH=/sbin:/usr/sbin:/bin:/usr/bin Link Here
8
export PATH
8
export PATH
9
9
10
VERSION="service version 0.91-alt"
10
VERSION="service version 0.91-alt"
11
SERVICEDIR="/etc/init.d"
11
SERVICEDIR=/etc/init.d
12
SYSTEMCTL=/bin/systemctl
13
SYSTEMD_SERVICE_DIR=/lib/systemd/system
14
SYSTEMD_CGROUP_DIR=/sys/fs/cgroup/systemd
12
SERVICE=
15
SERVICE=
13
OPTIONS=
16
OPTIONS=
14
17
Lines 36-41 check_service() Link Here
36
		fatal "$SERVICE: Invalid service name"
39
		fatal "$SERVICE: Invalid service name"
37
40
38
	[ -x "$SERVICEDIR/$SERVICE" ] ||
41
	[ -x "$SERVICEDIR/$SERVICE" ] ||
42
	[ -x "$SYSTEMCTL" -a \
43
	  -d "$SYSTEMD_CGROUP_DIR" -a \
44
	  -f "$SYSTEMD_SERVICE_DIR/$SERVICE.service" ] ||
39
		fatal "$SERVICE: Unrecognized service"
45
		fatal "$SERVICE: Unrecognized service"
40
}
46
}
41
47
Lines 69-75 case "$1" in Link Here
69
		shift
75
		shift
70
		check_service
76
		check_service
71
		cd / || exit
77
		cd / || exit
72
		"$SERVICEDIR/$SERVICE" "$@"
78
		if [ -x "$SYSTEMCTL" -a -d "$SYSTEMD_CGROUP_DIR" ]; then
73
		exit $?
79
			exec "$SYSTEMCTL" "$@" "$SERVICE.service"
80
		else
81
			exec "$SERVICEDIR/$SERVICE" "$@"
82
		fi
83
		exit
74
		;;
84
		;;
75
esac
85
esac

Return to bug 24989