Skip to content

Make fpp_uninstall.sh actually clean up plugin artifacts - #12

Open
pgianotto wants to merge 2 commits into
OnlineDynamic:masterfrom
pgianotto:fix/uninstall-cleanup
Open

pgianotto wants to merge 2 commits into
OnlineDynamic:masterfrom
pgianotto:fix/uninstall-cleanup

Conversation

@pgianotto

@pgianotto pgianotto commented Sep 9, 2026 •

Copy link
Copy Markdown

What

Replaces scripts/fpp_uninstall.sh (which only printed messages) with an idempotent cleanup that reverses the side effects this plugin creates outside its plugin directory, as required by the FPP plugin guidelines.

Fixes #11.

fpp_uninstall.sh now does

  • Stops mqtt_listener.py — it is started in postStart.sh, but FPP does not run preStop.sh on uninstall, so it would otherwise keep running against a deleted script until the next fppd stop/reboot.
  • Removes the SQLite database plugin.fpp-plugin-AdvancedStats.db plus its -journal/-wal/-shm sidecars.
  • Removes plugin.fpp-plugin-AdvancedStats.db.backup-* copies left in config/ by the restore and empty-database actions.
  • Removes the plugin log file (both the current fpp-plugin-AdvancedStats.log and the guideline-compliant plugin-fpp-plugin-AdvancedStats.log name).
  • Removes the plugin settings file config/plugin.fpp-plugin-AdvancedStats.

All removals use rm -f or are guarded, so the script is safe to run more than once. python3-paho-mqtt is intentionally left installed as a shared dependency.

Process match tightened (2nd commit)

pkill/pgrep -f "mqtt_listener.py" is scoped so it can only match this plugin's process:

  • postStart.sh — matches the absolute launch path ($MQTT_LISTENER)
  • preStop.sh / fpp_uninstall.sh — match fpp-plugin-AdvancedStats/mqtt_listener.py

This does not affect FPP's built-in MQTT (compiled into fppd) or the mosquitto broker service — neither has mqtt_listener.py in its command line.

Out of scope

Testing

sh -n passes on all three scripts. Paths reviewed against init_database.php, api.php, functions.inc.php, mqtt_listener.py, callbacks.py, and the scripts/ hooks.

🤖 Generated with Claude Code

pgianotto and others added 2 commits September 9, 2026 07:55
The previous script only printed messages. Per the FPP plugin guidelines,
uninstall must reverse every side effect created outside the plugin
directory and be safe to run repeatedly.

It now:
- stops the mqtt_listener.py process started in postStart.sh (FPP does not
  run preStop.sh on uninstall, so it would otherwise keep running)
- removes the SQLite database plus its -journal/-wal/-shm sidecars and the
  plugin.<repoName>.db.backup-* copies left in config/ by the restore and
  empty-database actions
- removes the plugin log file (both the current name and the
  plugin-<repoName>.log name)
- removes the plugin settings file

All removals use "rm -f" or are guarded, so re-running is safe.
python3-paho-mqtt is left installed as a shared dependency.

Refs OnlineDynamic#11

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
pkill/pgrep -f "mqtt_listener.py" could in principle match an unrelated
process of the same name. Scope the pattern to this plugin:

- postStart.sh: use the absolute launch path ($MQTT_LISTENER)
- preStop.sh / fpp_uninstall.sh: match "fpp-plugin-AdvancedStats/mqtt_listener.py"

This does not touch FPP's built-in MQTT (compiled into fppd) or the
mosquitto broker service - neither has mqtt_listener.py in its command line.

Refs OnlineDynamic#11

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fpp_uninstall.sh removes nothing; plugin data/log/DB and running listener left behind

1 participant