From 5c0640025f3dae3c2551fdf38bfefb12d271b364 Mon Sep 17 00:00:00 2001
From: David Bauer <mail@david-bauer.net>
Date: Wed, 14 May 2025 19:33:55 +0200
Subject: [PATCH] gluon-setup-mode: execute bootcount initscript in setup-mode

Currently Gluon does not execute the bootcount scripts when booting in
setup-mode.

While this is usually not issue after the first installation ahs
completed, it might lead to devices with an A/B partition layout to
switch active partitions after the device has been rebooted multiple
times before the initial configuration.

Fix this by executing the bootcount reset initscript.

Signed-off-by: David Bauer <mail@david-bauer.net>
---
 .../files/lib/gluon/setup-mode/rc.d/S11bootcount           | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100755 package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S11bootcount

diff --git a/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S11bootcount b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S11bootcount
new file mode 100755
index 000000000..0c1ff1f2d
--- /dev/null
+++ b/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S11bootcount
@@ -0,0 +1,7 @@
+#!/bin/sh /etc/rc.common
+
+# shellcheck disable=SC1091
+
+if [ -x /etc/init.d/bootcount ] && /etc/init.d/bootcount enabled; then
+	. /etc/init.d/bootcount
+fi
-- 
GitLab