Compare commits

..

6 commits

Author SHA1 Message Date
Kroese
a098158beb
fix: Remove variable 2025-10-06 18:34:43 +02:00
Kroese
7a0be8950c
feat: Set Samba socket
Added socket variable assignment and updated conditions for network handling.
2025-10-06 17:37:11 +02:00
Kroese
c04851bbd4
feat: Remove entry from hosts file (#1456) 2025-10-06 13:45:14 +02:00
Kroese
588242b175
fix: Use bridge name variable (#1455) 2025-10-06 13:44:05 +02:00
Kroese
3ab5c25152
feat: Use PID for Samba process (#1454) 2025-10-06 13:22:28 +02:00
Kroese
17db1ac34c
feat: Support more network types (#1453) 2025-10-05 18:58:17 +02:00
2 changed files with 33 additions and 16 deletions

View file

@ -103,11 +103,19 @@ finish() {
pid="/var/run/tpm.pid" pid="/var/run/tpm.pid"
[ -s "$pid" ] && pKill "$(<"$pid")" [ -s "$pid" ] && pKill "$(<"$pid")"
rm -f "$pid"
pid="/var/run/wsdd.pid" pid="/var/run/wsdd.pid"
[ -s "$pid" ] && pKill "$(<"$pid")" [ -s "$pid" ] && pKill "$(<"$pid")"
rm -f "$pid"
fKill "smbd" pid="/var/run/samba/nmbd.pid"
[ -s "$pid" ] && pKill "$(<"$pid")"
rm -f "$pid"
pid="/var/run/samba/smbd.pid"
[ -s "$pid" ] && pKill "$(<"$pid")"
rm -f "$pid"
closeNetwork closeNetwork

View file

@ -7,27 +7,30 @@ set -Eeuo pipefail
tmp="/tmp/smb" tmp="/tmp/smb"
rm -rf "$tmp" rm -rf "$tmp"
rm -rf /var/run/wsdd.pid
rm -f /var/run/wsdd.pid
rm -f /var/run/samba/nmbd.pid
rm -f /var/run/samba/smbd.pid
[[ "$SAMBA" == [Nn]* ]] && return 0 [[ "$SAMBA" == [Nn]* ]] && return 0
[[ "$NETWORK" == [Nn]* ]] && return 0 [[ "$NETWORK" == [Nn]* ]] && return 0
hostname="host.lan"
interfaces="dockerbridge"
if [ -n "${SAMBA_INTERFACE:-}" ]; then
interfaces+=",$SAMBA_INTERFACE"
fi
if [[ "$DHCP" == [Yy1]* ]]; then if [[ "$DHCP" == [Yy1]* ]]; then
socket="$IP"
hostname="$IP" hostname="$IP"
interfaces="$VM_NET_DEV" interfaces="$VM_NET_DEV"
fi else
hostname="host.lan"
if [[ "${NETWORK,,}" == "user"* ]]; then case "${NETWORK,,}" in
interfaces="lo" "passt" | "slirp" )
if ! ip link set "$interfaces" multicast on >/dev/null; then interfaces="lo"
warn "Failed to enable multicast on loopback interface!" socket="127.0.0.1" ;;
*)
socket="$VM_NET_IP"
interfaces="$VM_NET_BRIDGE" ;;
esac
if [ -n "${SAMBA_INTERFACE:-}" ]; then
interfaces+=",$SAMBA_INTERFACE"
fi fi
fi fi
@ -98,6 +101,7 @@ addShare() {
echo " follow symlinks = yes" echo " follow symlinks = yes"
echo " wide links = yes" echo " wide links = yes"
echo " unix extensions = no" echo " unix extensions = no"
echo " socket address = $socket"
echo "" echo ""
echo " # disable printing services" echo " # disable printing services"
echo " load printers = no" echo " load printers = no"
@ -158,6 +162,11 @@ if [[ "$SAMBA_DEBUG" == [Yy1]* ]]; then
tail -fn +0 /var/log/samba/log.smbd & tail -fn +0 /var/log/samba/log.smbd &
fi fi
case "${NETWORK,,}" in
"user"* | "passt" | "slirp" )
return 0 ;;
esac
if [[ "${BOOT_MODE:-}" == "windows_legacy" ]]; then if [[ "${BOOT_MODE:-}" == "windows_legacy" ]]; then
# Enable NetBIOS on Windows 7 and lower # Enable NetBIOS on Windows 7 and lower