diff --git a/samba/CHANGELOG.md b/samba/CHANGELOG.md index 670d2148..55b90164 100644 --- a/samba/CHANGELOG.md +++ b/samba/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 13.0.0 + +- BREAKING: `enabled_shares` values must now be lower case. The schema + restricts values to the exact share names and the configuration UI offers + them as a multi-select. Configs saved on 12.8.1 or later were migrated + automatically; older configs with non-lower-case values fail validation + with a clear error and must be re-selected. + ## 12.8.1 - Normalize stored `enabled_shares` values to lower case at startup. Values diff --git a/samba/config.yaml b/samba/config.yaml index 51b16cc4..c2ae32a3 100644 --- a/samba/config.yaml +++ b/samba/config.yaml @@ -1,5 +1,5 @@ --- -version: 12.8.1 +version: 13.0.0 slug: samba name: Samba share description: Expose Home Assistant folders with SMB/CIFS @@ -54,7 +54,7 @@ schema: password: password workgroup: str enabled_shares: - - "match(^(?i:(addons|addon_configs|backup|config|media|share|ssl))$)" + - "list(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 8bf03527..d9d0b4ab 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 @@ -8,8 +8,6 @@ declare password declare username declare config_username declare samba_username -declare stored_options -declare migration_payload declare -a interfaces=() export HOSTNAME @@ -23,19 +21,6 @@ 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. -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 ! 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 -fi - # Read hostname from API or setting default "hassio" HOSTNAME=$(bashio::info.hostname) if bashio::var.is_empty "${HOSTNAME}"; then @@ -64,7 +49,6 @@ fi jq --arg username "${samba_username}" \ ".interfaces = $(jq -c -n '$ARGS.positional' --args -- "${interfaces[@]}") | - .enabled_shares.[] |= ascii_downcase | .username = \$username" /data/options.json \ | tempio \ -template /usr/share/tempio/smb.gtpl \ diff --git a/samba/translations/en.yaml b/samba/translations/en.yaml index 43ba9a80..6561132c 100644 --- a/samba/translations/en.yaml +++ b/samba/translations/en.yaml @@ -12,14 +12,8 @@ configuration: name: Workgroup description: Change WORKGROUP to reflect your network needs. enabled_shares: - name: >- - Enabled Shares - allowed values are: - addons, addon_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. + name: Enabled Shares + description: List of file shares to make available. compatibility_mode: name: Enable Compatibility Mode description: >-