test
This commit is contained in:
10
samba/rootfs/etc/s6-overlay/s6-rc.d/wsdd/finish
Normal file
10
samba/rootfs/etc/s6-overlay/s6-rc.d/wsdd/finish
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Take down the S6 supervision tree based on service exit code
|
||||
# ==============================================================================
|
||||
if [[ "${1}" -ne 0 ]] && [[ "${1}" -ne 256 ]]; then
|
||||
bashio::log.warning "wsdd crashed, halting add-on"
|
||||
exec /run/s6/basedir/bin/halt
|
||||
fi
|
||||
|
||||
bashio::log.info "wsdd stopped"
|
46
samba/rootfs/etc/s6-overlay/s6-rc.d/wsdd/run
Normal file
46
samba/rootfs/etc/s6-overlay/s6-rc.d/wsdd/run
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
# ==============================================================================
|
||||
# Start wsdd service
|
||||
# ==============================================================================
|
||||
declare SMB_GROUP
|
||||
declare SMB_HOST
|
||||
|
||||
SMB_GROUP=$(grep -i '^\s*workgroup\s*=' /etc/samba/smb.conf | cut -f2 -d= | tr -d '[:blank:]')
|
||||
SMB_HOST=$(grep -i '^\s*netbios name\s*=' /etc/samba/smb.conf | cut -f2 -d= | tr -d '[:blank:]')
|
||||
|
||||
if bashio::config.true 'bind_all_interfaces'; then
|
||||
interfaces+=" "
|
||||
elif bashio::config.has_value 'interfaces'; then
|
||||
bashio::log.info "Interfaces from config: $(bashio::config 'interfaces')"
|
||||
for interface in $(bashio::config 'interfaces'); do
|
||||
if [ -d "/sys/class/net/${interface}" ]; then
|
||||
interfaces+=("-i ${interface}")
|
||||
else
|
||||
bashio::log.warning "Interface ${interface} not found, skipping."
|
||||
fi
|
||||
done
|
||||
else
|
||||
# Get supported interfaces
|
||||
for interface in $(bashio::network.interfaces); do
|
||||
interfaces+=("-i ${interface}")
|
||||
done
|
||||
fi
|
||||
|
||||
#if [ ${#interfaces[@]} -eq 0 ]; then
|
||||
# bashio::exit.nok 'No supported interfaces found to bind on.'
|
||||
#fi
|
||||
#bashio::log.info "Interfaces: $(printf '%s ' "${interfaces[@]}")"
|
||||
|
||||
if bashio::config.true 'wsdd2'; then
|
||||
bashio::log.info "Starting the WSDD2 daemon $(printf '%s ' "${interfaces[@]}") for ${SMB_GROUP}/${SMB_HOST}..."
|
||||
setcap CAP_NET_RAW+ep /usr/sbin/wsdd2
|
||||
# shellcheck disable=SC2046
|
||||
exec /usr/sbin/wsdd2 -t -u -w $(printf '%s ' "${interfaces[@]}") -H "${SMB_HOST}" -b vendor:homeassistant,model:sambanas
|
||||
elif bashio::config.true 'wsdd'; then
|
||||
bashio::log.info "Starting the WSDD daemon $(printf '%s ' "${interfaces[@]}") for ${SMB_GROUP}/${SMB_HOST}..."
|
||||
# shellcheck disable=SC2046
|
||||
exec wsdd -v $(printf '%s ' "${interfaces[@]}") -n "${SMB_HOST}" -w "${SMB_GROUP}"
|
||||
else
|
||||
exec sleep infinity
|
||||
fi
|
1
samba/rootfs/etc/s6-overlay/s6-rc.d/wsdd/type
Normal file
1
samba/rootfs/etc/s6-overlay/s6-rc.d/wsdd/type
Normal file
@@ -0,0 +1 @@
|
||||
longrun
|
Reference in New Issue
Block a user