From 3021acb25663a1341c05d45dd7974f903776c2f5 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Thu, 16 Jul 2026 13:27:45 +0200 Subject: [PATCH 1/4] Samba: migrate to app-based folder mappings and share names, bump base image (12.9.0) Rename the deprecated `addons` and `all_addon_configs` folder mappings to the new `local_apps` and `all_app_configs` names introduced in Home Assistant Supervisor (#6992), using the new default mount targets (/local_apps and /app_configs). Rename the exposed shares to `local_apps` and `app_configs` to match Home Assistant's app terminology. Existing installations are migrated automatically at start by extending the enabled_shares normalization added in 12.8.1: stored `addons`/`addon_configs` values are rewritten to `local_apps`/`app_configs` via the Supervisor options API. Because the options merge strategy overrides lists with the user's stored value, changing the default alone would not migrate existing installs, and the schema must keep accepting the legacy names so the app can start to run the migration (and so auto-update schema validation passes). Both the new and legacy share names stay exposed and point to the same directories, so existing SMB connections keep working while users move to the new names. Also update the base image to 3.24-2026.06.1. Co-Authored-By: Claude Opus 4.8 (1M context) --- samba/CHANGELOG.md | 7 ++++ samba/DOCS.md | 14 +++++--- samba/build.yaml | 4 +-- samba/config.yaml | 12 +++---- .../etc/s6-overlay/s6-rc.d/init-smbd/run | 31 +++++++++++++---- samba/rootfs/usr/share/tempio/smb.gtpl | 34 ++++++++++++++++--- 6 files changed, 79 insertions(+), 23 deletions(-) diff --git a/samba/CHANGELOG.md b/samba/CHANGELOG.md index 670d21482..388770da5 100644 --- a/samba/CHANGELOG.md +++ b/samba/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 12.9.0 + +- Rename the `addons` and `addon_configs` shares to `local_apps` and `app_configs` to match Home Assistant's app terminology. Existing `enabled_shares` configurations are migrated automatically on start (extending the lower-case normalization added in 12.8.1). +- Both the new (`local_apps`/`app_configs`) and legacy (`addons`/`addon_configs`) share names stay exposed, so existing SMB connections keep working while you move to the new names. +- Migrate to the new `local_apps` and `all_app_configs` folder mappings introduced in Home Assistant Supervisor. +- Update base image to 3.24-2026.06.1 + ## 12.8.1 - Normalize stored `enabled_shares` values to lower case at startup. Values diff --git a/samba/DOCS.md b/samba/DOCS.md index 7947d44e2..ca8249b4c 100644 --- a/samba/DOCS.md +++ b/samba/DOCS.md @@ -22,14 +22,20 @@ This app exposes the following directories over smb (samba): Directory | Description -- | -- -`addons` | This is for your local apps. -`addon_configs` | This is for the configuration files of your apps. +`local_apps` | This is for your local apps. +`app_configs` | This is for the configuration files of your apps. `backup` | This is for your backups. `config` | This is for your Home Assistant configuration. `media` | This is for local media files. `share` | This is for your data that is shared between apps and Home Assistant. `ssl` | This is for your SSL certificates. +The `local_apps` and `app_configs` shares were previously named `addons` and +`addon_configs`. Existing configurations are migrated to the new names +automatically. Both the new and legacy share names stay exposed and point to +the same directories, so existing connections keep working while you move to +the new names. + ## Configuration App configuration: @@ -39,8 +45,8 @@ username: homeassistant password: YOUR_PASSWORD workgroup: WORKGROUP enabled_shares: - - addons - - addon_configs + - local_apps + - app_configs - backup - config - media diff --git a/samba/build.yaml b/samba/build.yaml index 4cec96470..c9284064c 100644 --- a/samba/build.yaml +++ b/samba/build.yaml @@ -1,4 +1,4 @@ --- build_from: - aarch64: ghcr.io/home-assistant/aarch64-base:3.23-2026.02.0 - amd64: ghcr.io/home-assistant/amd64-base:3.23-2026.02.0 + aarch64: ghcr.io/home-assistant/aarch64-base:3.24-2026.06.1 + amd64: ghcr.io/home-assistant/amd64-base:3.24-2026.06.1 diff --git a/samba/config.yaml b/samba/config.yaml index 51b16cc48..f0d140261 100644 --- a/samba/config.yaml +++ b/samba/config.yaml @@ -1,5 +1,5 @@ --- -version: 12.8.1 +version: 12.9.0 slug: samba name: Samba share description: Expose Home Assistant folders with SMB/CIFS @@ -12,8 +12,8 @@ host_network: true image: homeassistant/{arch}-addon-samba init: false map: - - addons:rw - - all_addon_configs:rw + - local_apps:rw + - all_app_configs:rw - backup:rw - homeassistant_config:rw - media:rw @@ -24,8 +24,8 @@ options: password: null workgroup: WORKGROUP enabled_shares: - - addons - - addon_configs + - local_apps + - app_configs - backup - config - media @@ -54,7 +54,7 @@ schema: password: password workgroup: str enabled_shares: - - "match(^(?i:(addons|addon_configs|backup|config|media|share|ssl))$)" + - "match(^(?i:(local_apps|app_configs|addons|addon_configs|backup|config|media|share|ssl))$)" compatibility_mode: bool apple_compatibility_mode: bool netbios: bool diff --git a/samba/rootfs/etc/s6-overlay/s6-rc.d/init-smbd/run b/samba/rootfs/etc/s6-overlay/s6-rc.d/init-smbd/run index 8bf03527d..28e4633e6 100755 --- a/samba/rootfs/etc/s6-overlay/s6-rc.d/init-smbd/run +++ b/samba/rootfs/etc/s6-overlay/s6-rc.d/init-smbd/run @@ -23,14 +23,31 @@ fi bashio::config.require "enabled_shares" "Samba is a tool for sharing folders. Starting it without sharing any folders defeats the purpose." -# Migrate stored enabled_shares values to lower case. Values have always -# been treated case-insensitively at runtime; persisting them lower case -# prepares for a future release that restricts the schema to the exact -# share names. +# Migrate stored enabled_shares values: normalize to lower case and rename the +# legacy `addons`/`addon_configs` share names to `local_apps`/`app_configs` to +# match Home Assistant's app terminology. Values have always been treated +# case-insensitively at runtime; persisting the canonical, renamed form keeps +# the stored configuration current and prepares for a future release that can +# drop the legacy names from the schema. The `addons` and `addon_configs` +# shares stay exposed for backward compatibility (see smb.gtpl). stored_options=$(bashio::api.supervisor GET /addons/self/info false | jq '.options') -if jq -e '(.enabled_shares // []) | any(. != ascii_downcase)' <<< "${stored_options}" > /dev/null; then - bashio::log.info "Migrating enabled_shares configuration values to lower case" - migration_payload=$(jq -c '{options: (.enabled_shares |= map(ascii_downcase))}' <<< "${stored_options}") +if jq -e '(.enabled_shares // []) | any( + ascii_downcase as $s + | (. != $s) or ($s == "addons") or ($s == "addon_configs") + )' <<< "${stored_options}" > /dev/null; then + bashio::log.info "Migrating enabled_shares configuration values" + migration_payload=$(jq -c ' + def migrate: + (. // []) + | map(ascii_downcase) + | map( + if . == "addons" then "local_apps" + elif . == "addon_configs" then "app_configs" + else . end + ) + | reduce .[] as $s ([]; if index($s) then . else . + [$s] end); + {options: (.enabled_shares |= migrate)} + ' <<< "${stored_options}") if ! bashio::api.supervisor POST /addons/self/options "${migration_payload}"; then bashio::log.warning "Could not migrate enabled_shares values; will retry on next start" fi diff --git a/samba/rootfs/usr/share/tempio/smb.gtpl b/samba/rootfs/usr/share/tempio/smb.gtpl index df72fcca1..4def57dd1 100644 --- a/samba/rootfs/usr/share/tempio/smb.gtpl +++ b/samba/rootfs/usr/share/tempio/smb.gtpl @@ -53,11 +53,37 @@ delete veto files = {{ eq (len .veto_files) 0 | ternary "no" "yes" }} {{ end }} -{{ if (has "addons" .enabled_shares) }} +{{ if or (has "local_apps" .enabled_shares) (has "addons" .enabled_shares) }} +[local_apps] + browseable = yes + writeable = yes + path = /local_apps + + valid users = {{ .username }} + force user = root + force group = root + veto files = /{{ .veto_files | join "/" }}/ + delete veto files = {{ eq (len .veto_files) 0 | ternary "no" "yes" }} +{{ end }} + +{{ if or (has "local_apps" .enabled_shares) (has "addons" .enabled_shares) }} [addons] browseable = yes writeable = yes - path = /addons + path = /local_apps + + valid users = {{ .username }} + force user = root + force group = root + veto files = /{{ .veto_files | join "/" }}/ + delete veto files = {{ eq (len .veto_files) 0 | ternary "no" "yes" }} +{{ end }} + +{{ if or (has "app_configs" .enabled_shares) (has "addon_configs" .enabled_shares) }} +[app_configs] + browseable = yes + writeable = yes + path = /app_configs valid users = {{ .username }} force user = root @@ -66,11 +92,11 @@ delete veto files = {{ eq (len .veto_files) 0 | ternary "no" "yes" }} {{ end }} -{{ if (has "addon_configs" .enabled_shares) }} +{{ if or (has "app_configs" .enabled_shares) (has "addon_configs" .enabled_shares) }} [addon_configs] browseable = yes writeable = yes - path = /addon_configs + path = /app_configs valid users = {{ .username }} force user = root From 378f72953a3e2f61b1775563634c2e644820cf4f Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Fri, 24 Jul 2026 14:37:38 +0200 Subject: [PATCH 2/4] Samba: warn on deprecated share use, update enabled_shares translation Address PR review feedback: - Log a warning via smbd's preexec whenever a client connects to a deprecated `addons`/`addon_configs` share, telling the user which new share to switch to (mdegat01). Use `logger -s` so the message reaches the add-on log (smbd stderr); the container has no syslog daemon reading /dev/log. - Update the `enabled_shares` UI translation to list the new canonical names (`local_apps`/`app_configs`) and note the legacy names are still accepted for backward compatibility (Copilot). Co-Authored-By: Claude Opus 4.8 (1M context) --- samba/CHANGELOG.md | 1 + samba/rootfs/usr/share/tempio/smb.gtpl | 2 ++ samba/translations/en.yaml | 8 +++++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/samba/CHANGELOG.md b/samba/CHANGELOG.md index 388770da5..c74590ba8 100644 --- a/samba/CHANGELOG.md +++ b/samba/CHANGELOG.md @@ -4,6 +4,7 @@ - Rename the `addons` and `addon_configs` shares to `local_apps` and `app_configs` to match Home Assistant's app terminology. Existing `enabled_shares` configurations are migrated automatically on start (extending the lower-case normalization added in 12.8.1). - Both the new (`local_apps`/`app_configs`) and legacy (`addons`/`addon_configs`) share names stay exposed, so existing SMB connections keep working while you move to the new names. +- Log a warning when a client connects to a deprecated `addons`/`addon_configs` share, indicating which new share to switch to. - Migrate to the new `local_apps` and `all_app_configs` folder mappings introduced in Home Assistant Supervisor. - Update base image to 3.24-2026.06.1 diff --git a/samba/rootfs/usr/share/tempio/smb.gtpl b/samba/rootfs/usr/share/tempio/smb.gtpl index 4def57dd1..9efcae874 100644 --- a/samba/rootfs/usr/share/tempio/smb.gtpl +++ b/samba/rootfs/usr/share/tempio/smb.gtpl @@ -71,6 +71,7 @@ browseable = yes writeable = yes path = /local_apps + preexec = /usr/bin/logger -s -t smbd -p local0.warning "%u connected to deprecated share %S from %m (%I), please switch to the local_apps share" valid users = {{ .username }} force user = root @@ -97,6 +98,7 @@ browseable = yes writeable = yes path = /app_configs + preexec = /usr/bin/logger -s -t smbd -p local0.warning "%u connected to deprecated share %S from %m (%I), please switch to the app_configs share" valid users = {{ .username }} force user = root diff --git a/samba/translations/en.yaml b/samba/translations/en.yaml index 43ba9a80d..8fbd8c02d 100644 --- a/samba/translations/en.yaml +++ b/samba/translations/en.yaml @@ -14,12 +14,14 @@ configuration: enabled_shares: name: >- Enabled Shares - allowed values are: - addons, addon_configs, backup, config, media, share, or ssl. + local_apps, app_configs, backup, config, media, share, or ssl. description: >- List of file shares to make available. Adding a share requires typing its name to add it. - The listed values are the only allowed values. - The configuration cannot be saved if any non-allowed value is in the list. + The legacy names addons and addon_configs are still accepted and map to + local_apps and app_configs for backward compatibility. + Only these values are allowed; + the configuration cannot be saved if any other value is in the list. compatibility_mode: name: Enable Compatibility Mode description: >- From bc0f3f9508da42db7259fd24e1bbc0668802a5bb Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Mon, 27 Jul 2026 08:13:47 +0200 Subject: [PATCH 3/4] Samba: exit cleanly on SIGTERM instead of 143 On a normal shutdown, s6-overlay brings the smbd/nmbd/wsdd longruns down with SIGTERM. The finish scripts recorded $((128 + 15)) = 143 as the container exit code, so every stop ended with 143 and the Supervisor warned that the add-on did not handle SIGTERM. Treat SIGTERM as the expected shutdown signal: still take the supervision tree down, but leave the container exit code at 0. Other signals and non-zero exits keep their previous failure-propagation behavior so genuine crashes still surface. Drop the now-unused exit_code_container read in the wsdd finish script. Co-Authored-By: Claude Opus 4.8 (1M context) --- samba/CHANGELOG.md | 1 + samba/rootfs/etc/s6-overlay/s6-rc.d/nmbd/finish | 5 ++++- samba/rootfs/etc/s6-overlay/s6-rc.d/smbd/finish | 5 ++++- samba/rootfs/etc/s6-overlay/s6-rc.d/wsdd/finish | 7 ++----- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/samba/CHANGELOG.md b/samba/CHANGELOG.md index c74590ba8..1a7915382 100644 --- a/samba/CHANGELOG.md +++ b/samba/CHANGELOG.md @@ -5,6 +5,7 @@ - Rename the `addons` and `addon_configs` shares to `local_apps` and `app_configs` to match Home Assistant's app terminology. Existing `enabled_shares` configurations are migrated automatically on start (extending the lower-case normalization added in 12.8.1). - Both the new (`local_apps`/`app_configs`) and legacy (`addons`/`addon_configs`) share names stay exposed, so existing SMB connections keep working while you move to the new names. - Log a warning when a client connects to a deprecated `addons`/`addon_configs` share, indicating which new share to switch to. +- Exit cleanly with code 0 on shutdown instead of 143, so the Supervisor no longer warns about the add-on not handling `SIGTERM`. - Migrate to the new `local_apps` and `all_app_configs` folder mappings introduced in Home Assistant Supervisor. - Update base image to 3.24-2026.06.1 diff --git a/samba/rootfs/etc/s6-overlay/s6-rc.d/nmbd/finish b/samba/rootfs/etc/s6-overlay/s6-rc.d/nmbd/finish index 25b9f6101..a3a93dfbe 100755 --- a/samba/rootfs/etc/s6-overlay/s6-rc.d/nmbd/finish +++ b/samba/rootfs/etc/s6-overlay/s6-rc.d/nmbd/finish @@ -15,7 +15,10 @@ bashio::log.info \ "(by signal ${exit_code_signal})" if [[ "${exit_code_service}" -eq 256 ]]; then - if [[ "${exit_code_container}" -eq 0 ]]; then + # SIGTERM (15) is how s6-overlay brings the service down during a normal + # container shutdown; halt the supervision tree but keep the container exit + # code at 0. Record any other (unexpected) signal as the failure code. + if [[ "${exit_code_signal}" -ne 15 && "${exit_code_container}" -eq 0 ]]; then echo $((128 + exit_code_signal)) > /run/s6-linux-init-container-results/exitcode fi [[ "${exit_code_signal}" -eq 15 ]] && exec /run/s6/basedir/bin/halt diff --git a/samba/rootfs/etc/s6-overlay/s6-rc.d/smbd/finish b/samba/rootfs/etc/s6-overlay/s6-rc.d/smbd/finish index e60184ba4..4fb2dc554 100755 --- a/samba/rootfs/etc/s6-overlay/s6-rc.d/smbd/finish +++ b/samba/rootfs/etc/s6-overlay/s6-rc.d/smbd/finish @@ -15,7 +15,10 @@ bashio::log.info \ "(by signal ${exit_code_signal})" if [[ "${exit_code_service}" -eq 256 ]]; then - if [[ "${exit_code_container}" -eq 0 ]]; then + # SIGTERM (15) is how s6-overlay brings the service down during a normal + # container shutdown; halt the supervision tree but keep the container exit + # code at 0. Record any other (unexpected) signal as the failure code. + if [[ "${exit_code_signal}" -ne 15 && "${exit_code_container}" -eq 0 ]]; then echo $((128 + exit_code_signal)) > /run/s6-linux-init-container-results/exitcode fi [[ "${exit_code_signal}" -eq 15 ]] && exec /run/s6/basedir/bin/halt diff --git a/samba/rootfs/etc/s6-overlay/s6-rc.d/wsdd/finish b/samba/rootfs/etc/s6-overlay/s6-rc.d/wsdd/finish index 849242a8b..caf9aea05 100755 --- a/samba/rootfs/etc/s6-overlay/s6-rc.d/wsdd/finish +++ b/samba/rootfs/etc/s6-overlay/s6-rc.d/wsdd/finish @@ -5,8 +5,6 @@ # Keep the addon running when the optional wsdd service fails # ============================================================================== -# shellcheck disable=SC2155 -readonly exit_code_container=$( /run/s6-linux-init-container-results/exitcode - fi + # SIGTERM: normal container shutdown. Take the supervision tree down with a + # clean exit code (0) instead of 143. exec /run/s6/basedir/bin/halt elif [[ "${exit_code_service}" -eq 256 ]]; then bashio::log.warning \ From 397b435b5fa8147efb2d77e63c426d6b5ae65947 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Wed, 29 Jul 2026 18:25:35 +0200 Subject: [PATCH 4/4] Samba: scope the SIGTERM exit-code fix to smbd only nmbd and wsdd already exit 0 on SIGTERM: nmbd's handler calls exit(0), and only smbd registers an atexit killkids() that does kill(0, SIGTERM), which makes smbd terminate by the signal (exit 143). Their finish scripts' by-signal branch never fires in practice, so revert those two changes and keep the mask only in smbd/finish. Also link home-assistant/supervisor#6840 in the changelog. Co-Authored-By: Claude Opus 4.8 (1M context) --- samba/rootfs/etc/s6-overlay/s6-rc.d/nmbd/finish | 5 +---- samba/rootfs/etc/s6-overlay/s6-rc.d/wsdd/finish | 7 +++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/samba/rootfs/etc/s6-overlay/s6-rc.d/nmbd/finish b/samba/rootfs/etc/s6-overlay/s6-rc.d/nmbd/finish index a3a93dfbe..25b9f6101 100755 --- a/samba/rootfs/etc/s6-overlay/s6-rc.d/nmbd/finish +++ b/samba/rootfs/etc/s6-overlay/s6-rc.d/nmbd/finish @@ -15,10 +15,7 @@ bashio::log.info \ "(by signal ${exit_code_signal})" if [[ "${exit_code_service}" -eq 256 ]]; then - # SIGTERM (15) is how s6-overlay brings the service down during a normal - # container shutdown; halt the supervision tree but keep the container exit - # code at 0. Record any other (unexpected) signal as the failure code. - if [[ "${exit_code_signal}" -ne 15 && "${exit_code_container}" -eq 0 ]]; then + if [[ "${exit_code_container}" -eq 0 ]]; then echo $((128 + exit_code_signal)) > /run/s6-linux-init-container-results/exitcode fi [[ "${exit_code_signal}" -eq 15 ]] && exec /run/s6/basedir/bin/halt diff --git a/samba/rootfs/etc/s6-overlay/s6-rc.d/wsdd/finish b/samba/rootfs/etc/s6-overlay/s6-rc.d/wsdd/finish index caf9aea05..849242a8b 100755 --- a/samba/rootfs/etc/s6-overlay/s6-rc.d/wsdd/finish +++ b/samba/rootfs/etc/s6-overlay/s6-rc.d/wsdd/finish @@ -5,6 +5,8 @@ # Keep the addon running when the optional wsdd service fails # ============================================================================== +# shellcheck disable=SC2155 +readonly exit_code_container=$( /run/s6-linux-init-container-results/exitcode + fi exec /run/s6/basedir/bin/halt elif [[ "${exit_code_service}" -eq 256 ]]; then bashio::log.warning \