mirror of
https://git.yoctoproject.org/meta-arm
synced 2026-07-16 15:57:19 +00:00
optee-client: Add sysVinit service
Adds a sysVinit service to start tee-supplicant so that the optee-client
package can be used on distros where systemd is not used. Also does some
cleanup of the recipe including:
1) Using @path@ tokens for replacemane in the .service file instead of
paths
2) Replacing tokens in the .service file after it is installed instead
of editing the source file in ${WORKDIR}
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Reviewed-by: Diego Sueiro <diego.sueiro@arm.com>
Reviewed-by: Denys Dmytriyenko <denys@ti.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
@@ -3,8 +3,8 @@ Description=TEE Supplicant
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
User=root
|
User=root
|
||||||
EnvironmentFile=-/etc/default/tee-supplicant
|
EnvironmentFile=-@sysconfdir@/default/tee-supplicant
|
||||||
ExecStart=/usr/sbin/tee-supplicant $OPTARGS
|
ExecStart=@sbindir@/tee-supplicant $OPTARGS
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=basic.target
|
WantedBy=basic.target
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Source function library
|
||||||
|
. /etc/init.d/functions
|
||||||
|
|
||||||
|
NAME=tee-supplicant
|
||||||
|
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||||
|
DESC="OP-TEE Supplicant"
|
||||||
|
|
||||||
|
DAEMON=@sbindir@/$NAME
|
||||||
|
|
||||||
|
test -f $DAEMON || exit 0
|
||||||
|
|
||||||
|
test -f @sysconfdir@/default/$NAME && . @sysconfdir@/default/$NAME
|
||||||
|
test -f @sysconfdir@/default/rcS && . @sysconfdir@/default/rcS
|
||||||
|
|
||||||
|
SSD_OPTIONS="--oknodo --quiet --exec $DAEMON -- -d $OPTARGS"
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
start)
|
||||||
|
echo -n "Starting $DESC: "
|
||||||
|
start-stop-daemon --start $SSD_OPTIONS
|
||||||
|
echo "${DAEMON##*/}."
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
echo -n "Stopping $DESC: "
|
||||||
|
start-stop-daemon --stop $SSD_OPTIONS
|
||||||
|
echo "${DAEMON##*/}."
|
||||||
|
;;
|
||||||
|
restart|force-reload)
|
||||||
|
$0 stop
|
||||||
|
sleep 1
|
||||||
|
$0 start
|
||||||
|
;;
|
||||||
|
status)
|
||||||
|
status ${DAEMON} || exit $?
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
||||||
@@ -9,19 +9,18 @@ PV = "3.8.0+git${SRCPV}"
|
|||||||
|
|
||||||
require optee.inc
|
require optee.inc
|
||||||
|
|
||||||
inherit python3native systemd
|
inherit python3native systemd update-rc.d
|
||||||
|
|
||||||
SRCREV = "be4fa2e36f717f03ca46e574aa66f697a897d090"
|
SRCREV = "be4fa2e36f717f03ca46e574aa66f697a897d090"
|
||||||
SRC_URI = " \
|
SRC_URI = " \
|
||||||
git://github.com/OP-TEE/optee_client.git \
|
git://github.com/OP-TEE/optee_client.git \
|
||||||
file://tee-supplicant.service \
|
file://tee-supplicant.service \
|
||||||
|
file://tee-supplicant.sh \
|
||||||
"
|
"
|
||||||
|
|
||||||
S = "${WORKDIR}/git"
|
S = "${WORKDIR}/git"
|
||||||
B = "${WORKDIR}/build"
|
B = "${WORKDIR}/build"
|
||||||
|
|
||||||
SYSTEMD_SERVICE_${PN} = "tee-supplicant.service"
|
|
||||||
|
|
||||||
EXTRA_OEMAKE = "O=${B}"
|
EXTRA_OEMAKE = "O=${B}"
|
||||||
|
|
||||||
do_compile() {
|
do_compile() {
|
||||||
@@ -43,9 +42,20 @@ do_install() {
|
|||||||
install -d ${D}${includedir}
|
install -d ${D}${includedir}
|
||||||
install -p -m0644 ${B}/export/usr/include/*.h ${D}${includedir}
|
install -p -m0644 ${B}/export/usr/include/*.h ${D}${includedir}
|
||||||
|
|
||||||
sed -i -e s:/etc:${sysconfdir}:g \
|
|
||||||
-e s:/usr/bin:${bindir}:g \
|
|
||||||
${WORKDIR}/tee-supplicant.service
|
|
||||||
|
|
||||||
install -D -p -m0644 ${WORKDIR}/tee-supplicant.service ${D}${systemd_system_unitdir}/tee-supplicant.service
|
install -D -p -m0644 ${WORKDIR}/tee-supplicant.service ${D}${systemd_system_unitdir}/tee-supplicant.service
|
||||||
|
|
||||||
|
install -D -p -m0755 ${WORKDIR}/tee-supplicant.sh ${D}${sysconfdir}/init.d/tee-supplicant
|
||||||
|
|
||||||
|
sed -i -e s:@sysconfdir@:${sysconfdir}:g \
|
||||||
|
-e s:@sbindir@:${sbindir}:g \
|
||||||
|
${D}${systemd_system_unitdir}/tee-supplicant.service \
|
||||||
|
${D}${sysconfdir}/init.d/tee-supplicant
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SYSTEMD_SERVICE_${PN} = "tee-supplicant.service"
|
||||||
|
|
||||||
|
INITSCRIPT_PACKAGES = "${PN}"
|
||||||
|
|
||||||
|
INITSCRIPT_NAME_${PN} = "tee-supplicant"
|
||||||
|
INITSCRIPT_PARAMS_${PN} = "start 10 1 2 3 4 5 . stop 90 0 6 ."
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user