diff mbox series

[meta-swupdate,2/2] New GUI for recovery mode

Message ID 20240616112436.50001-3-stefano.babic@swupdate.org
State Accepted
Headers show
Series New GUI for recovery mode | expand

Commit Message

Stefano Babic June 16, 2024, 11:24 a.m. UTC
The rescueGUI is based on a graphic library (TeKUI) that is not
maintained anymore. This is a replacement based on LVGL, with the same
interfaces and the same look, but open to extensions in the future.

Signed-off-by: Stefano Babic <stefano.babic@swupdate.org>
---
 recipes-support/rescuegui/files/swupdate-gui  | 72 +++++++++++++++++++
 .../rescuegui/files/swupdate-gui.service      | 11 +++
 recipes-support/rescuegui/swupdate-gui_git.bb | 45 ++++++++++++
 3 files changed, 128 insertions(+)
 create mode 100644 recipes-support/rescuegui/files/swupdate-gui
 create mode 100644 recipes-support/rescuegui/files/swupdate-gui.service
 create mode 100644 recipes-support/rescuegui/swupdate-gui_git.bb

--
2.34.1
diff mbox series

Patch

diff --git a/recipes-support/rescuegui/files/swupdate-gui b/recipes-support/rescuegui/files/swupdate-gui
new file mode 100644
index 0000000..4c8528f
--- /dev/null
+++ b/recipes-support/rescuegui/files/swupdate-gui
@@ -0,0 +1,72 @@ 
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides:          recovery_gui
+# Required-Start:    $local_fs
+# Should-Start:
+# Required-Stop:     $local_fs
+# Should-Stop:
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Start recovery_gui application
+### END INIT INFO
+
+# The definition of actions:
+# start         start the service
+# stop          stop the service
+# restart       stop and restart the service if the service is already running,
+#               otherwise start the service
+
+# The start, stop, and  restart, actions shall be supported
+# by all init scripts;
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+
+DESC="GUI for SWUpdate"
+NAME="recovery_gui"
+DAEMON=/usr/bin/recovery_gui
+PIDFILE=/var/run/$NAME.pid
+
+# Exit if the package is not installed
+[ -x "$DAEMON" ] || exit 0
+
+# Function that starts the daemon/service
+#
+do_start() {
+	echo "Starting $DESC ..."
+
+	#Export the the screen orientation
+	rotation=$(fw_printenv -n screen_orientation)
+	export SCREEN_ORIENTATION_ANGLE=${rotation}
+	echo 0 > /sys/class/graphics/fbcon/cursor_blink
+	export LD_PRELOAD=/lib/libpthread.so.0
+
+	#Start recovery_gui
+	start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile --exec $DAEMON
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop() {
+	echo "Stopping $DESC"
+	#Stop recovery_gui
+	start-stop-daemon --stop --pidfile $PIDFILE
+}
+
+case "$1" in
+start)
+	do_start
+	;;
+stop)
+	do_stop || exit $?
+	;;
+restart)
+	do_stop
+	do_start
+	;;
+*)
+	echo "Usage: $0 {start|stop|restart}" >&2
+	exit 3
+	;;
+esac
diff --git a/recipes-support/rescuegui/files/swupdate-gui.service b/recipes-support/rescuegui/files/swupdate-gui.service
new file mode 100644
index 0000000..fddfa31
--- /dev/null
+++ b/recipes-support/rescuegui/files/swupdate-gui.service
@@ -0,0 +1,11 @@ 
+[Unit]
+Description=SWUpdate Light GUI
+After=swupdate.service
+
+[Service]
+Type=Simple
+ExecStartPre=/bin/sh -c "echo 0 > /sys/class/graphics/fbcon/cursor_blink"
+ExecStart=/usr/bin/recovery_gui
+
+[Install]
+WantedBy=multi-user.target
diff --git a/recipes-support/rescuegui/swupdate-gui_git.bb b/recipes-support/rescuegui/swupdate-gui_git.bb
new file mode 100644
index 0000000..68875c3
--- /dev/null
+++ b/recipes-support/rescuegui/swupdate-gui_git.bb
@@ -0,0 +1,45 @@ 
+SUMMARY = "Recovery GUI application"
+DESCRIPTION = "This recipe provides the GUI for recovery system and works with LVGL and framebuffer."
+
+LICENSE = "GPL-2.0-or-later"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=de4b1111cc7f3c8bc81546de6f9b24e4"
+
+DEPENDS:append = " \
+	lvgl \
+	swupdate \
+	"
+
+SRC_URI = "git://github.com/sbabic/SWUpdateGUI.git;protocol=https;branch=main \
+	file://swupdate-gui \
+	file://swupdate-gui.service \
+	"
+SRCREV = "d6bd129b4cea1e5c53bcad077a7d25af8260ef84"
+
+S = "${WORKDIR}/git"
+
+inherit cmake update-rc.d systemd
+
+TARGET_CFLAGS:append = " -I${STAGING_INCDIR}/lvgl"
+TARGET_CFLAGS:append = " -I${STAGING_INCDIR}/lvgl/lv_drivers"
+
+INITSCRIPT_NAME = "swupdate-gui"
+INITSCRIPT_PARAMS = "defaults 90"
+SYSTEMD_SERVICE:${PN} = "swupdate-gui.service"
+
+do_install:append () {
+        install -d ${D}${sysconfdir}/init.d
+    	install -d ${D}${systemd_system_unitdir}
+        install -m 0755 ${WORKDIR}/swupdate-gui ${D}${sysconfdir}/init.d/
+    	install -m 644 ${WORKDIR}/swupdate-gui.service ${D}${systemd_system_unitdir}
+        install -d ${D}${sysconfdir}/recovery_gui
+        install -m 0644 ${S}/config/config.txt ${D}${sysconfdir}/recovery_gui/
+        install -m 0755 ${S}/scripts/recovery-check-bridge-interface.sh ${D}${bindir}
+        install -m 0755 ${S}/scripts/recovery-edit-default-gateway.sh ${D}${bindir}
+        install -m 0755 ${S}/scripts/recovery-get-dhcp-status.sh ${D}${bindir}
+        install -m 0755 ${S}/scripts/recovery-set-dhcp.sh ${D}${bindir}
+        install -m 0755 ${S}/scripts/recovery-set-static.sh ${D}${bindir}
+}
+
+RDEPENDS:${PN}:append = " \
+	swupdate \
+	"