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

(-)a/service/service (-2 / +10 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 "$SYSTEMCTL" ]; then
75
			if [-f "$SYSTEMDSERVICEDIR/${SERVICE}.service" -o -x "$SERVICEDIR/$SERVICE" ]; then
76
				exec $SYSTEMCTL "$@" ${SERVICE}.service
77
			fi
78
		elif [ -x "$SERVICEDIR/$SERVICE" ]; then
79
			"$SERVICEDIR/$SERVICE" "$@"
80
		fi
73
		exit $?
81
		exit $?
74
		;;
82
		;;
75
esac
83
esac

Return to bug 24989