From d74b923847554cce139e201554fd4962434f779a Mon Sep 17 00:00:00 2001 From: Eugene Smirnov Date: Wed, 23 Oct 2019 17:34:19 +0200 Subject: Indicate an OSTree boot on start Signed-off-by: Mykhaylo Sul Signed-off-by: Patrick Vacek --- classes/sota.bbclass | 2 +- recipes-sota/ostree/files/touch-ostree | 21 +++++++++++++++++++++ recipes-sota/ostree/ostree-booted_1.0.bb | 15 +++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100755 recipes-sota/ostree/files/touch-ostree create mode 100644 recipes-sota/ostree/ostree-booted_1.0.bb diff --git a/classes/sota.bbclass b/classes/sota.bbclass index 5620b76..27b2765 100644 --- a/classes/sota.bbclass +++ b/classes/sota.bbclass @@ -21,7 +21,7 @@ python () { d.setVar("SOTA_CLIENT_PROV", "aktualizr-device-prov-hsm") } -IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT} ${SOTA_CLIENT_PROV}" +IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT} ${SOTA_CLIENT_PROV} ostree-booted" IMAGE_CLASSES += " image_types_ostree image_types_ota" IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'ostreepush garagesign garagecheck ota-ext4 wic', ' ', d)}" diff --git a/recipes-sota/ostree/files/touch-ostree b/recipes-sota/ostree/files/touch-ostree new file mode 100755 index 0000000..28cb672 --- /dev/null +++ b/recipes-sota/ostree/files/touch-ostree @@ -0,0 +1,21 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: touch-ostree +# Required-Start: $network $remote_fs +# Required-Stop: $network $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Indicate OSTree boot +### END INIT INFO + +case "$1" in + start) + touch /run/ostree-booted + ;; + stop) + ;; + *) + echo "Usage: /etc/init.d/touch-ostree {start|stop}" + exit 1 + ;; +esac diff --git a/recipes-sota/ostree/ostree-booted_1.0.bb b/recipes-sota/ostree/ostree-booted_1.0.bb new file mode 100644 index 0000000..d74cf24 --- /dev/null +++ b/recipes-sota/ostree/ostree-booted_1.0.bb @@ -0,0 +1,15 @@ +SUMMARY = "Indicate an OSTree boot" +DESCRIPTION = "Indicate an OSTree boot" +LICENSE = "MPL-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad" +SRC_URI = "file://touch-ostree" + +inherit allarch update-rc.d + +INITSCRIPT_NAME = "touch-ostree" +INITSCRIPT_PARAMS = "start 8 2 3 4 5 . stop 20 0 1 6 ." + +do_install() { + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/touch-ostree ${D}${sysconfdir}/init.d/touch-ostree +} -- cgit v1.2.3-54-g00ecf