mirror of
https://github.com/dockur/windows.git
synced 2025-10-14 07:46:11 +01:00
feat: Make Samba interface configurable (#1452)
This commit is contained in:
parent
29a9e2d68c
commit
b3f1cb913a
23
src/samba.sh
23
src/samba.sh
@ -2,8 +2,8 @@
|
|||||||
set -Eeuo pipefail
|
set -Eeuo pipefail
|
||||||
|
|
||||||
: "${SAMBA:="Y"}" # Enable Samba
|
: "${SAMBA:="Y"}" # Enable Samba
|
||||||
|
: "${SAMBA_LEVEL:="1"}" # Logging level
|
||||||
: "${SAMBA_DEBUG:="N"}" # Disable debug
|
: "${SAMBA_DEBUG:="N"}" # Disable debug
|
||||||
: "${SAMBA_LEVEL:="1"}" # Debug log level
|
|
||||||
|
|
||||||
tmp="/tmp/smb"
|
tmp="/tmp/smb"
|
||||||
rm -rf "$tmp"
|
rm -rf "$tmp"
|
||||||
@ -13,15 +13,22 @@ rm -rf /var/run/wsdd.pid
|
|||||||
[[ "$NETWORK" == [Nn]* ]] && return 0
|
[[ "$NETWORK" == [Nn]* ]] && return 0
|
||||||
|
|
||||||
hostname="host.lan"
|
hostname="host.lan"
|
||||||
interface="dockerbridge"
|
interfaces="dockerbridge"
|
||||||
|
|
||||||
|
if [ -n "${SAMBA_INTERFACE:-}" ]; then
|
||||||
|
interfaces+=",$SAMBA_INTERFACE"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$DHCP" == [Yy1]* ]]; then
|
if [[ "$DHCP" == [Yy1]* ]]; then
|
||||||
hostname="$IP"
|
hostname="$IP"
|
||||||
interface="$VM_NET_DEV"
|
interfaces="$VM_NET_DEV"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${NETWORK,,}" == "user"* ]]; then
|
if [[ "${NETWORK,,}" == "user"* ]]; then
|
||||||
interface="127.0.0.1"
|
interfaces="lo"
|
||||||
|
if ! ip link set "$interfaces" multicast on >/dev/null; then
|
||||||
|
warn "Failed to enable multicast on loopback interface!"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
html "Initializing shared folder..."
|
html "Initializing shared folder..."
|
||||||
@ -82,7 +89,7 @@ addShare() {
|
|||||||
echo " server string = Dockur"
|
echo " server string = Dockur"
|
||||||
echo " netbios name = $hostname"
|
echo " netbios name = $hostname"
|
||||||
echo " workgroup = WORKGROUP"
|
echo " workgroup = WORKGROUP"
|
||||||
echo " interfaces = $interface"
|
echo " interfaces = $interfaces"
|
||||||
echo " bind interfaces only = yes"
|
echo " bind interfaces only = yes"
|
||||||
echo " security = user"
|
echo " security = user"
|
||||||
echo " guest account = nobody"
|
echo " guest account = nobody"
|
||||||
@ -170,13 +177,13 @@ if [[ "${BOOT_MODE:-}" == "windows_legacy" ]]; then
|
|||||||
else
|
else
|
||||||
|
|
||||||
# Enable Web Service Discovery on Vista and up
|
# Enable Web Service Discovery on Vista and up
|
||||||
[[ "$DEBUG" == [Yy1]* ]] && echo "Starting Web Service Discovery daemon..."
|
[[ "$DEBUG" == [Yy1]* ]] && echo "Starting wsddn daemon..."
|
||||||
|
|
||||||
rm -f /var/log/wsddn.log
|
rm -f /var/log/wsddn.log
|
||||||
|
|
||||||
if ! wsddn -i "$interface" -H "$hostname" --unixd --log-file=/var/log/wsddn.log --pid-file=/var/run/wsdd.pid; then
|
if ! wsddn -i "${interfaces%%,*}" -H "$hostname" --unixd --log-file=/var/log/wsddn.log --pid-file=/var/run/wsdd.pid; then
|
||||||
SAMBA_DEBUG="Y"
|
SAMBA_DEBUG="Y"
|
||||||
error "Failed to start WSDDN daemon!"
|
error "Failed to start wsddn daemon!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$SAMBA_DEBUG" == [Yy1]* ]]; then
|
if [[ "$SAMBA_DEBUG" == [Yy1]* ]]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user