Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions samba/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Comment thread
kingpanther13 marked this conversation as resolved.

## 12.8.1

- Normalize stored `enabled_shares` values to lower case at startup. Values
Expand Down
4 changes: 2 additions & 2 deletions samba/config.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
16 changes: 0 additions & 16 deletions samba/rootfs/etc/s6-overlay/s6-rc.d/init-smbd/run
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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 \
Expand Down
10 changes: 2 additions & 8 deletions samba/translations/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: >-
Expand Down
Loading