fix: Samba for user-mode networking (#288)
This commit is contained in:
parent
76bc9799ea
commit
afba96b912
2 changed files with 23 additions and 3 deletions
|
@ -628,6 +628,8 @@ updateXML() {
|
||||||
local language="$2"
|
local language="$2"
|
||||||
local culture region user admin pass keyboard
|
local culture region user admin pass keyboard
|
||||||
|
|
||||||
|
sed -i "s/ 20.20.20.1 / ${VM_NET_IP%.*}.1 /g" "$asset"
|
||||||
|
|
||||||
[ -z "$HEIGHT" ] && HEIGHT="720"
|
[ -z "$HEIGHT" ] && HEIGHT="720"
|
||||||
[ -z "$WIDTH" ] && WIDTH="1280"
|
[ -z "$WIDTH" ] && WIDTH="1280"
|
||||||
|
|
||||||
|
|
20
src/samba.sh
20
src/samba.sh
|
@ -14,6 +14,10 @@ if [[ "$DHCP" == [Yy1]* ]]; then
|
||||||
interface="$VM_NET_DEV"
|
interface="$VM_NET_DEV"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "${NETWORK,,}" == "user"* ]]; then
|
||||||
|
interface="127.0.0.1"
|
||||||
|
fi
|
||||||
|
|
||||||
addShare() {
|
addShare() {
|
||||||
local dir="$1"
|
local dir="$1"
|
||||||
local name="$2"
|
local name="$2"
|
||||||
|
@ -107,10 +111,24 @@ done
|
||||||
if ! smbd; then
|
if ! smbd; then
|
||||||
error "Samba daemon failed to start!"
|
error "Samba daemon failed to start!"
|
||||||
smbd -i --debug-stdout || true
|
smbd -i --debug-stdout || true
|
||||||
|
else
|
||||||
|
if [[ "${NETWORK,,}" == "user"* ]]; then
|
||||||
|
NET_OPTS="${NET_OPTS/,hostfwd/,guestfwd=tcp:${VM_NET_IP%.*}.1:445-tcp:127.0.0.1:445,hostfwd}"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Enable Web Service Discovery
|
[[ "${NETWORK,,}" == "user"* ]] && return 0
|
||||||
|
|
||||||
|
if [[ "${BOOT_MODE:-}" == "windows_legacy" ]]; then
|
||||||
|
# Enable NetBIOS on Windows 7 and lower
|
||||||
|
if ! nmbd; then
|
||||||
|
error "NetBIOS daemon failed to start!"
|
||||||
|
nmbd -i --debug-stdout || true
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Enable Web Service Discovery on Vista and up
|
||||||
wsdd -i "$interface" -p -n "$hostname" &
|
wsdd -i "$interface" -p -n "$hostname" &
|
||||||
echo "$!" > /var/run/wsdd.pid
|
echo "$!" > /var/run/wsdd.pid
|
||||||
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
Loading…
Reference in a new issue