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

(-)a/service/service (-3 / +9 lines)
Lines 9-14 export PATH Link Here
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
SYSTEMDSERVICEDIR="/lib/systemd/system"
12
SERVICE=
14
SERVICE=
13
OPTIONS=
15
OPTIONS=
14
16
Lines 35-41 check_service() Link Here
35
	[ -n "${SERVICE##*/*}" ] ||
37
	[ -n "${SERVICE##*/*}" ] ||
36
		fatal "$SERVICE: Invalid service name"
38
		fatal "$SERVICE: Invalid service name"
37
39
38
	[ -x "$SERVICEDIR/$SERVICE" ] ||
40
	[ -x "$SERVICEDIR/$SERVICE" ] || [ -x "$SYSTEMCTL" -a -f "$SYSTEMDSERVICEDIR/${SERVICE}.service" ] ||
39
		fatal "$SERVICE: Unrecognized service"
41
		fatal "$SERVICE: Unrecognized service"
40
}
42
}
41
43
Lines 69-75 case "$1" in Link Here
69
		shift
71
		shift
70
		check_service
72
		check_service
71
		cd / || exit
73
		cd / || exit
72
		"$SERVICEDIR/$SERVICE" "$@"
74
		if [ -x "$SERVICEDIR/$SERVICE" ]; then
75
			"$SERVICEDIR/$SERVICE" "$@"
76
		elif [ -x "$SYSTEMCTL" -a -f "$SYSTEMDSERVICEDIR/${SERVICE}.service" ]; then
77
			echo "Redirecting to /bin/systemctl $OPTIONS $SERVICE.service" >/dev/stderr
78
			exec $SYSTEMCTL "$@" ${SERVICE}.service
79
		fi
73
		exit $?
80
		exit $?
74
		;;
81
		;;
75
esac
82
esac
76
- 

Return to bug 24989