1
0
miroir de https://github.com/dockur/windows.git synchronisé 2026-06-12 13:19:34 +08:00

feat: Improved Samba logging (#1448)

Cette révision appartient à :
Kroese
2025-10-03 02:50:59 +02:00
révisé par GitHub
Parent 4871a1e61b
révision f29208af3f
2 fichiers modifiés avec 38 ajouts et 24 suppressions
+9 -2
Voir le fichier
@@ -1777,11 +1777,18 @@ prepareInstall() {
echo " Set oFile = Nothing"
echo "End With"
echo ""
} | unix2dos > "$dir/\$OEM\$/admin.vbs"
echo "Set oLink = WshShell.CreateShortcut(WshShell.ExpandEnvironmentStrings(\"%userprofile%\\Desktop\\Shared.lnk\"))"
echo "With oLink"
echo " .TargetPath = \"\\\\host.lan\\Data\""
echo " .Save"
echo "End With"
echo "Set oLink = Nothing"
echo ""
} | unix2dos > "$dir/\$OEM\$/install.vbs"
{ echo "[COMMANDS]"
echo "\"REGEDIT /s install.reg\""
echo "\"Wscript admin.vbs\""
echo "\"Wscript install.vbs\""
echo ""
} | unix2dos > "$dir/\$OEM\$/cmdlines.txt"
+29 -22
Voir le fichier
@@ -5,6 +5,8 @@ set -Eeuo pipefail
: "${SAMBA_DEBUG:="N"}" # Disable debug
: "${SAMBA_LEVEL:="1"}" # Debug log level
rm -rf /var/run/wsdd.pid
[[ "$SAMBA" == [Nn]* ]] && return 0
[[ "$NETWORK" == [Nn]* ]] && return 0
@@ -40,18 +42,18 @@ addShare() {
echo " For support visit $SUPPORT"
echo "--------------------------------------------------------"
echo ""
echo "Using this folder you can share files with the host machine."
echo "Using this folder you can exchange files with the host machine."
echo ""
echo "To change its location, include the following bind mount in your compose file:"
echo "To select the folder you want to share, include the following bind mount in your compose file:"
echo ""
echo " volumes:"
echo " - \"/home/example:/${name,,}\""
echo " - \"./example:/${name,,}\""
echo ""
echo "Or in your run command:"
echo ""
echo " -v \"/home/example:/${name,,}\""
echo " -v \"\${PWD:-.}/example:/${name,,}\""
echo ""
echo "Replace the example path /home/example with the desired shared folder."
echo "Replace the example path ./example with your desired shared folder."
echo ""
} | unix2dos > "$dir/readme.txt"
@@ -116,20 +118,20 @@ for dir in "${dirs[@]}"; do
addShare "$dir" "$dir_name" "Shared $dir_name" || error "Failed to create shared folder for $dir!"
done
# Try to fix Samba permissions
# Try to repair Samba permissions
[ -d /run/samba/msg.lock ] && chmod -R 0755 /run/samba/msg.lock 2>/dev/null || :
[ -d /var/log/samba/cores ] && chmod -R 0700 /var/log/samba/cores 2>/dev/null || :
[ -d /var/cache/samba/msg.lock ] && chmod -R 0755 /var/cache/samba/msg.lock 2>/dev/null || :
if [[ "$SAMBA_DEBUG" != [Yy1]* ]]; then
if ! smbd; then
SAMBA_DEBUG="Y"
error "Samba daemon failed to start!"
fi
rm -f /var/log/samba/log.smbd
if ! smbd -l /var/log/samba; then
SAMBA_DEBUG="Y"
error "Failed to start Samba daemon!"
fi
if [[ "$SAMBA_DEBUG" == [Yy1]* ]]; then
smbd -i -d "$SAMBA_LEVEL" --debug-stdout &
tail -fn +0 /var/log/samba/log.smbd &
fi
if [[ "${BOOT_MODE:-}" == "windows_legacy" ]]; then
@@ -137,15 +139,15 @@ if [[ "${BOOT_MODE:-}" == "windows_legacy" ]]; then
# Enable NetBIOS on Windows 7 and lower
[[ "$DEBUG" == [Yy1]* ]] && echo "Starting NetBIOS daemon..."
if [[ "$SAMBA_DEBUG" != [Yy1]* ]]; then
if ! nmbd; then
SAMBA_DEBUG="Y"
error "NetBIOS daemon failed to start!"
fi
rm -f /var/log/samba/log.nmbd
if ! nmbd -l /var/log/samba; then
SAMBA_DEBUG="Y"
error "Failed to start NetBIOS daemon!"
fi
if [[ "$SAMBA_DEBUG" == [Yy1]* ]]; then
nmbd -i -d "$SAMBA_LEVEL" --debug-stdout &
tail -fn +0 /var/log/samba/log.nmbd &
fi
else
@@ -153,10 +155,15 @@ else
# Enable Web Service Discovery on Vista and up
[[ "$DEBUG" == [Yy1]* ]] && echo "Starting Web Service Discovery daemon..."
if [[ "$SAMBA_DEBUG" != [Yy1]* ]]; then
wsddn -i "$interface" -H "$hostname" --unixd --pid-file=/var/run/wsdd.pid
else
wsddn -i "$interface" -H "$hostname" --pid-file=/var/run/wsdd.pid &
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
SAMBA_DEBUG="Y"
error "Failed to start WSDDN daemon!"
fi
if [[ "$SAMBA_DEBUG" == [Yy1]* ]]; then
tail -fn +0 /var/log/wsddn.log &
fi
fi