|
|
@@ -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
|