From 765ab6453361ca8f0cdad27e84b57ef9c7027687 Mon Sep 17 00:00:00 2001 From: James Turton Date: Sun, 19 Jul 2026 22:34:41 +0200 Subject: [PATCH 1/3] Reset grumpyscreen config when needed --- .../grumyscreen/files/grumpyscreen.init | 37 ++++++++++++++++++- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/meta-opencentauri/recipes-apps/grumyscreen/files/grumpyscreen.init b/meta-opencentauri/recipes-apps/grumyscreen/files/grumpyscreen.init index ea6c2228..542a6ab5 100644 --- a/meta-opencentauri/recipes-apps/grumyscreen/files/grumpyscreen.init +++ b/meta-opencentauri/recipes-apps/grumyscreen/files/grumpyscreen.init @@ -10,13 +10,46 @@ GRUMPYSCREEN_EXEC=/usr/bin/grumpyscreen PIDFILE=/var/run/gui.pid +CONFIG_FILE="/etc/klipper/config/grumpyscreen.cfg" +CONFIG_VERSION="20260518" +CONFIG_VERSION_FILE="/etc/grumpyscreen-config.ver" +CONFIG_BACKUP_DIR="/etc/klipper/config/config-backups" -export CONFIG_FILE=/etc/klipper/config/grumpyscreen.cfg +export CONFIG_FILE + +ensure_grumpyscreen_config_version() { + current_version="" + + if [ -f "$CONFIG_VERSION_FILE" ]; then + current_version="$(tr -d '[:space:]' < "$CONFIG_VERSION_FILE" 2>/dev/null)" + else + current_version="" #reset configs + echo "$current_version" > "$CONFIG_VERSION_FILE" || return 1 + fi + + if [ "$current_version" = "$CONFIG_VERSION" ]; then + return 0 + fi + + if [ -f "$CONFIG_FILE" ]; then + backup_timestamp="$(date +%Y%m%d_%H%M%S)" || return 1 + backup_file="$CONFIG_BACKUP_DIR/grumpyscreen-$backup_timestamp.cfg" + + mkdir -p "$CONFIG_BACKUP_DIR" || return 1 + cp "$CONFIG_FILE" "$backup_file" || return 1 + rm -f /data/overlay-etc/upper/klipper/config/grumpyscreen.cfg && sync && echo 3 > /proc/sys/vm/drop_caches + fi + + printf '%s\n' "$CONFIG_VERSION" > "$CONFIG_VERSION_FILE" || return 1 +} case "$1" in start) echo "Starting grumpyscreen..." - # Start grumpyscreen in the background + if ! ensure_grumpyscreen_config_version; then + echo "Failed to update Grumpyscreen config version state" + exit 1 + fi start-stop-daemon -S -b -m -p "$PIDFILE" -x "$GRUMPYSCREEN_EXEC" ;; stop) From eaf388ae7dc3bb587d9fe4f049e3bb29aa19517e Mon Sep 17 00:00:00 2001 From: James Turton Date: Mon, 20 Jul 2026 00:04:07 +0200 Subject: [PATCH 2/3] Make grumpyscreen use CONFIG_OVERRIDE_FILE --- .../recipes-apps/grumyscreen/files/grumpyscreen.cfg | 5 +++++ .../recipes-apps/grumyscreen/files/grumpyscreen.init | 10 ++++++---- .../recipes-apps/grumyscreen/grumpyscreen_20260518.bb | 11 +++++++++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/meta-opencentauri/recipes-apps/grumyscreen/files/grumpyscreen.cfg b/meta-opencentauri/recipes-apps/grumyscreen/files/grumpyscreen.cfg index c5940678..78cbb71b 100644 --- a/meta-opencentauri/recipes-apps/grumyscreen/files/grumpyscreen.cfg +++ b/meta-opencentauri/recipes-apps/grumyscreen/files/grumpyscreen.cfg @@ -1,3 +1,8 @@ +# ----- +# PLEASE DO NOT EDIT THIS FILE. EDIT grumpyscreen.cfg INSTEAD. +# UPDATES WILL RESET THIS FILE. YOUR EDITS WILL BE LOST WHEN UPDATING. +# ----- + [default_macros] cooldown: TURN_OFF_HEATERS extrude: _GUPPYSCREEN_EXTRUDE EXTRUDER_TEMP={} EXTRUDE_LEN={} SPEED={} diff --git a/meta-opencentauri/recipes-apps/grumyscreen/files/grumpyscreen.init b/meta-opencentauri/recipes-apps/grumyscreen/files/grumpyscreen.init index 542a6ab5..eeb376c5 100644 --- a/meta-opencentauri/recipes-apps/grumyscreen/files/grumpyscreen.init +++ b/meta-opencentauri/recipes-apps/grumyscreen/files/grumpyscreen.init @@ -10,12 +10,14 @@ GRUMPYSCREEN_EXEC=/usr/bin/grumpyscreen PIDFILE=/var/run/gui.pid -CONFIG_FILE="/etc/klipper/config/grumpyscreen.cfg" +CONFIG_FILE="/etc/klipper/config/klipper-readonly/grumpyscreen.cfg" +CONFIG_OVERRIDE_FILE="/etc/klipper/config/grumpyscreen.cfg" CONFIG_VERSION="20260518" CONFIG_VERSION_FILE="/etc/grumpyscreen-config.ver" CONFIG_BACKUP_DIR="/etc/klipper/config/config-backups" export CONFIG_FILE +export CONFIG_OVERRIDE_FILE ensure_grumpyscreen_config_version() { current_version="" @@ -31,13 +33,13 @@ ensure_grumpyscreen_config_version() { return 0 fi - if [ -f "$CONFIG_FILE" ]; then + if [ -f "$CONFIG_OVERRIDE_FILE" ]; then backup_timestamp="$(date +%Y%m%d_%H%M%S)" || return 1 backup_file="$CONFIG_BACKUP_DIR/grumpyscreen-$backup_timestamp.cfg" mkdir -p "$CONFIG_BACKUP_DIR" || return 1 - cp "$CONFIG_FILE" "$backup_file" || return 1 - rm -f /data/overlay-etc/upper/klipper/config/grumpyscreen.cfg && sync && echo 3 > /proc/sys/vm/drop_caches + cp "$CONFIG_OVERRIDE_FILE" "$backup_file" || return 1 + echo "# Add other extra configuration here.\n" > "$CONFIG_OVERRIDE_FILE" fi printf '%s\n' "$CONFIG_VERSION" > "$CONFIG_VERSION_FILE" || return 1 diff --git a/meta-opencentauri/recipes-apps/grumyscreen/grumpyscreen_20260518.bb b/meta-opencentauri/recipes-apps/grumyscreen/grumpyscreen_20260518.bb index 11774c03..670636dd 100644 --- a/meta-opencentauri/recipes-apps/grumyscreen/grumpyscreen_20260518.bb +++ b/meta-opencentauri/recipes-apps/grumyscreen/grumpyscreen_20260518.bb @@ -87,7 +87,10 @@ do_install() { install -d ${D}${sysconfdir}/klipper install -d ${D}${sysconfdir}/klipper/config - install -m 0644 ${WORKDIR}/grumpyscreen.cfg ${D}${sysconfdir}/klipper/config/ + echo "# Add other extra configuration here.\n" > ${D}${sysconfdir}/klipper/config/grumpyscreen.cfg + + install -d ${D}${sysconfdir}/klipper/config/grumpyscreen-readonly + install -m 0644 ${WORKDIR}/grumpyscreen.cfg ${D}${sysconfdir}/klipper/config/grumpyscreen-readonly/ install -d ${D}${sysconfdir}/init.d install -m 0755 ${WORKDIR}/grumpyscreen.init ${D}${sysconfdir}/init.d/grumpyscreen @@ -97,7 +100,11 @@ FILES:${PN} = " \ ${bindir}/grumpyscreen \ ${datadir}/grumpyscreen \ ${sysconfdir}/klipper/config/grumpyscreen.cfg \ + ${sysconfdir}/klipper/config/grumpyscreen-readonly/grumpyscreen.cfg \ ${sysconfdir}/init.d/grumpyscreen \ " -CONFFILES:${PN} = "${sysconfdir}/klipper/config/grumpyscreen.cfg" +CONFFILES:${PN} = " \ + ${sysconfdir}/klipper/config/grumpyscreen.cfg \ + ${sysconfdir}/klipper/config/grumpyscreen-readonly/grumpyscreen.cfg \ +" From 214a14a8b93172670721540932f310eb37d47de4 Mon Sep 17 00:00:00 2001 From: James Turton Date: Wed, 29 Jul 2026 23:37:10 +0200 Subject: [PATCH 3/3] Grumpyscreen: Fix dir in service script --- .../recipes-apps/grumyscreen/files/grumpyscreen.init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta-opencentauri/recipes-apps/grumyscreen/files/grumpyscreen.init b/meta-opencentauri/recipes-apps/grumyscreen/files/grumpyscreen.init index eeb376c5..2220d1ed 100644 --- a/meta-opencentauri/recipes-apps/grumyscreen/files/grumpyscreen.init +++ b/meta-opencentauri/recipes-apps/grumyscreen/files/grumpyscreen.init @@ -10,7 +10,7 @@ GRUMPYSCREEN_EXEC=/usr/bin/grumpyscreen PIDFILE=/var/run/gui.pid -CONFIG_FILE="/etc/klipper/config/klipper-readonly/grumpyscreen.cfg" +CONFIG_FILE="/etc/klipper/config/grumpyscreen-readonly/grumpyscreen.cfg" CONFIG_OVERRIDE_FILE="/etc/klipper/config/grumpyscreen.cfg" CONFIG_VERSION="20260518" CONFIG_VERSION_FILE="/etc/grumpyscreen-config.ver"