Unverified Commit 004f4df7 authored by Kroese's avatar Kroese Committed by GitHub
Browse files

feat: Set Samba socket (#1457)

parent c04851bb
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -16,17 +16,18 @@ rm -f /var/run/samba/smbd.pid
[[ "$NETWORK" == [Nn]* ]] && return 0

if [[ "$DHCP" == [Yy1]* ]]; then
  socket="$IP"
  hostname="$IP"
  interfaces="$VM_NET_DEV"
else
  hostname="host.lan"
  case "${NETWORK,,}" in
    "user"* | "passt" | "slirp" )
      interfaces="lo" ;;
      # if ! ip link set "$interfaces" multicast on >/dev/null; then
      #  warn "Failed to enable multicast on loopback interface!"
      # fi ;;
    *) interfaces="$VM_NET_BRIDGE" ;;
    "passt" | "slirp" )
      interfaces="lo"
      socket="127.0.0.1" ;;
    *)
      socket="$VM_NET_IP"
      interfaces="$VM_NET_BRIDGE" ;;
  esac
  if [ -n "${SAMBA_INTERFACE:-}" ]; then
    interfaces+=",$SAMBA_INTERFACE"
@@ -100,6 +101,7 @@ addShare() {
        echo "    follow symlinks = yes"
        echo "    wide links = yes"
        echo "    unix extensions = no"
        echo "    socket address = $socket"
        echo ""
        echo "    # disable printing services"
        echo "    load printers = no"
@@ -160,6 +162,11 @@ if [[ "$SAMBA_DEBUG" == [Yy1]* ]]; then
  tail -fn +0 /var/log/samba/log.smbd &
fi

case "${NETWORK,,}" in
  "passt" | "slirp" )
    return 0 ;;
esac

if [[ "${BOOT_MODE:-}" == "windows_legacy" ]]; then

  # Enable NetBIOS on Windows 7 and lower