mirror of
https://github.com/aljazceru/addons.git
synced 2025-12-17 05:04:21 +01:00
Enable Samba on all supported interfaces (#2353)
* Restore interface configuration * run on all supported interfaces * add loopback to the interface list * fix ShellCheck errors
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## 9.6.0
|
||||
|
||||
- Run on all supported interfaces
|
||||
|
||||
## 9.5.1
|
||||
|
||||
- Add `hassio_api` to add-on configuration
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
version: 9.5.1
|
||||
version: 9.6.0
|
||||
slug: samba
|
||||
name: Samba share
|
||||
description: Expose Home Assistant folders with SMB/CIFS
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# ==============================================================================
|
||||
declare password
|
||||
declare username
|
||||
declare interface
|
||||
declare -a interfaces
|
||||
export HOSTNAME
|
||||
|
||||
# Check Login data
|
||||
@@ -18,14 +18,17 @@ if bashio::var.is_empty "${HOSTNAME}"; then
|
||||
bashio::log.warning "Can't read hostname, using default."
|
||||
HOSTNAME="hassio"
|
||||
fi
|
||||
bashio::log.info "Hostname: ${HOSTNAME}"
|
||||
|
||||
# Get default interface
|
||||
interface=$(bashio::network.name)
|
||||
|
||||
bashio::log.info "Using hostname=${HOSTNAME} interface=${interface}"
|
||||
# Get supported interfaces
|
||||
for interface in $(bashio::network.interfaces); do
|
||||
interfaces+=("${interface}")
|
||||
done
|
||||
interfaces+=("lo")
|
||||
bashio::log.info "Interfaces: $(printf '%s ' "${interfaces[@]}")"
|
||||
|
||||
# Generate Samba configuration.
|
||||
jq ".interface = \"${interface}\"" /data/options.json \
|
||||
jq ".interfaces = $(jq -c -n '$ARGS.positional' --args -- "${interfaces[@]}")" /data/options.json \
|
||||
| tempio \
|
||||
-template /usr/share/tempio/smb.gtpl \
|
||||
-out /etc/samba/smb.conf
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
log level = 2
|
||||
|
||||
bind interfaces only = yes
|
||||
interfaces = {{ .interface }}
|
||||
interfaces = {{ .interfaces | join " " }}
|
||||
hosts allow = {{ .allow_hosts | join " " }}
|
||||
|
||||
{{ if .compatibility_mode }}
|
||||
|
||||
Reference in New Issue
Block a user