mirror of
https://github.com/dockur/windows.git
synced 2025-10-28 19:55:49 +00:00
feat: Enable Samba in DHCP mode
This commit is contained in:
parent
7e4a6ff458
commit
b5fc2cbb4f
1 changed files with 12 additions and 11 deletions
23
src/samba.sh
23
src/samba.sh
|
|
@ -3,22 +3,23 @@ set -Eeuo pipefail
|
||||||
|
|
||||||
: "${SAMBA:="Y"}"
|
: "${SAMBA:="Y"}"
|
||||||
|
|
||||||
[[ "$DHCP" == [Yy1]* ]] && return 0
|
|
||||||
[[ "$SAMBA" != [Yy1]* ]] && return 0
|
[[ "$SAMBA" != [Yy1]* ]] && return 0
|
||||||
[[ "$NETWORK" != [Yy1]* ]] && return 0
|
[[ "$NETWORK" != [Yy1]* ]] && return 0
|
||||||
|
|
||||||
SHARE="$STORAGE/shared"
|
local hostname="host.lan"
|
||||||
|
local interface="dockerbridge"
|
||||||
|
[[ "$DHCP" == [Yy1]* ]] && interface="$VM_NET_DEV"
|
||||||
|
|
||||||
mkdir -p "$SHARE"
|
local share="$STORAGE/shared"
|
||||||
chmod -R 777 "$SHARE"
|
|
||||||
|
|
||||||
SAMBA="/etc/samba/smb.conf"
|
mkdir -p "$share"
|
||||||
|
[ -z "$(ls -A "$share")" ] && chmod -R 777 "$share"
|
||||||
|
|
||||||
{ echo "[global]"
|
{ echo "[global]"
|
||||||
echo " server string = Dockur"
|
echo " server string = Dockur"
|
||||||
echo " netbios name = dockur"
|
echo " netbios name = $hostname"
|
||||||
echo " workgroup = WORKGROUP"
|
echo " workgroup = WORKGROUP"
|
||||||
echo " interfaces = dockerbridge"
|
echo " interfaces = $interface"
|
||||||
echo " bind interfaces only = yes"
|
echo " bind interfaces only = yes"
|
||||||
echo " security = user"
|
echo " security = user"
|
||||||
echo " guest account = nobody"
|
echo " guest account = nobody"
|
||||||
|
|
@ -32,14 +33,14 @@ SAMBA="/etc/samba/smb.conf"
|
||||||
echo " disable spoolss = yes"
|
echo " disable spoolss = yes"
|
||||||
echo ""
|
echo ""
|
||||||
echo "[Data]"
|
echo "[Data]"
|
||||||
echo " path = $SHARE"
|
echo " path = $share"
|
||||||
echo " comment = Shared"
|
echo " comment = Shared"
|
||||||
echo " writable = yes"
|
echo " writable = yes"
|
||||||
echo " guest ok = yes"
|
echo " guest ok = yes"
|
||||||
echo " guest only = yes"
|
echo " guest only = yes"
|
||||||
echo " force user = root"
|
echo " force user = root"
|
||||||
echo " force group = root"
|
echo " force group = root"
|
||||||
} > "$SAMBA"
|
} > "/etc/samba/smb.conf"
|
||||||
|
|
||||||
{ echo "--------------------------------------------------------"
|
{ echo "--------------------------------------------------------"
|
||||||
echo " $APP for Docker v$(</run/version)..."
|
echo " $APP for Docker v$(</run/version)..."
|
||||||
|
|
@ -59,7 +60,7 @@ SAMBA="/etc/samba/smb.conf"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Replace the example path /home/user/example with the desired storage folder."
|
echo "Replace the example path /home/user/example with the desired storage folder."
|
||||||
echo ""
|
echo ""
|
||||||
} | unix2dos > "$SHARE/readme.txt"
|
} | unix2dos > "$share/readme.txt"
|
||||||
|
|
||||||
! smbd && smbd --debug-stdout
|
! smbd && smbd --debug-stdout
|
||||||
|
|
||||||
|
|
@ -77,7 +78,7 @@ if [[ "$isXP" == [Yy1]* ]]; then
|
||||||
! nmbd && nmbd --debug-stdout
|
! nmbd && nmbd --debug-stdout
|
||||||
else
|
else
|
||||||
# Enable Web Service Discovery
|
# Enable Web Service Discovery
|
||||||
wsdd -i dockerbridge -p -n "host.lan" &
|
wsdd -i "$interface" -p -n "$hostname" &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue