Skip to content

fix(fnos): resolve data directory dynamically instead of hardcoding paths - #1394

Open
lovelitchi wants to merge 5 commits into
TencentCloud:mainfrom
lovelitchi:fix/fnos-docker-data-dir
Open

lovelitchi wants to merge 5 commits into
TencentCloud:mainfrom
lovelitchi:fix/fnos-docker-data-dir

Conversation

@lovelitchi

Copy link
Copy Markdown

Summary

The fnOS Docker package hardcodes the data directory as /var/apps/octop/share/octop/data (or /vol1/@appshare/octop/data in uninstall). On devices where the app install root is on a different volume (e.g. /vol1/@appcenter/octop), the hardcoded path fails with permission errors because the actual data-share directory is elsewhere.

This PR resolves the data directory dynamically — matching the logic already used by the native fnOS package — by reading TRIM_DATA_SHARE_PATHS (provided by fnOS at install time) and falling back to deriving the path from TRIM_APPDEST.

Changes

  • docker-compose.yaml: Volume mount uses ${OCTOP_DATA_DIR:-/var/apps/octop/share/octop/data} so the host path is driven by an env var written at install/upgrade time.
  • config_callback: Replaces hardcoded DATA_DIR with dynamic resolution from TRIM_DATA_SHARE_PATHS / TRIM_APPDEST.
  • install_callback: Same dynamic DATA_DIR resolution + writes OCTOP_DATA_DIR to .env so docker-compose picks it up.
  • uninstall_callback: Replaces hardcoded /vol1/@appshare/octop/data with the same dynamic resolution.
  • upgrade_callback: Same dynamic DATA_DIR resolution + calls octop_env_set to keep OCTOP_DATA_DIR in .env in sync across upgrades.

Test plan

  • Install on a device where TRIM_APPDEST points to a non-default volume and verify the data directory is created at the correct location.
  • Upgrade an existing installation and verify OCTOP_DATA_DIR is written to .env and the volume mount resolves correctly.
  • Uninstall with "delete data" selected and verify the correct data directory is removed.

The Docker package hardcoded /var/apps/octop/share/octop/data as the data
directory, but fnOS devices may install to different paths (e.g.
/vol1/@appcenter/octop). Use TRIM_DATA_SHARE_PATHS from fnOS with a
TRIM_APPDEST fallback, matching the native package pattern.

This change updates docker-compose.yaml to use ${OCTOP_DATA_DIR} with
a fallback to the original hardcoded path.
Update data directory resolution logic to handle different app install roots and avoid permission errors.
Update data directory resolution logic to handle different app install roots and improve compatibility.
Dynamically resolve the data directory for uninstallation based on TRIM_DATA_SHARE_PATHS or TRIM_APPDEST.
Updated the data directory resolution logic to handle different installation paths and ensure compatibility with various devices. Added synchronization of OCTOP_DATA_DIR in the .env file.

This branch has not been deployed

No deployments
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.

1 participant