diff --git a/assets/win10x64-enterprise-eval.xml b/assets/win10x64-enterprise-eval.xml index 05a0437..7ea00ef 100644 --- a/assets/win10x64-enterprise-eval.xml +++ b/assets/win10x64-enterprise-eval.xml @@ -420,6 +420,11 @@ 22 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 23 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win10x64-enterprise.xml b/assets/win10x64-enterprise.xml index 742a6d9..733d1ec 100644 --- a/assets/win10x64-enterprise.xml +++ b/assets/win10x64-enterprise.xml @@ -423,6 +423,11 @@ 22 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 23 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win10x64-iot.xml b/assets/win10x64-iot.xml index 05ffaf5..01534bb 100644 --- a/assets/win10x64-iot.xml +++ b/assets/win10x64-iot.xml @@ -429,6 +429,11 @@ 22 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 23 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win10x64-ltsc.xml b/assets/win10x64-ltsc.xml index 8700e26..e0e6c98 100644 --- a/assets/win10x64-ltsc.xml +++ b/assets/win10x64-ltsc.xml @@ -426,6 +426,11 @@ 22 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 23 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win10x64.xml b/assets/win10x64.xml index d863512..08e8c79 100644 --- a/assets/win10x64.xml +++ b/assets/win10x64.xml @@ -423,6 +423,11 @@ 22 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 23 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win11x64-enterprise-eval.xml b/assets/win11x64-enterprise-eval.xml index ea321ad..ae3384a 100644 --- a/assets/win11x64-enterprise-eval.xml +++ b/assets/win11x64-enterprise-eval.xml @@ -458,6 +458,11 @@ 25 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 26 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win11x64-enterprise.xml b/assets/win11x64-enterprise.xml index e76caad..a9a192b 100644 --- a/assets/win11x64-enterprise.xml +++ b/assets/win11x64-enterprise.xml @@ -461,6 +461,11 @@ 25 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 26 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win11x64-iot.xml b/assets/win11x64-iot.xml index ae4282d..5a1b8ae 100644 --- a/assets/win11x64-iot.xml +++ b/assets/win11x64-iot.xml @@ -461,6 +461,11 @@ 25 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 26 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win11x64-ltsc.xml b/assets/win11x64-ltsc.xml index bc27ec0..8e4a969 100644 --- a/assets/win11x64-ltsc.xml +++ b/assets/win11x64-ltsc.xml @@ -461,6 +461,11 @@ 25 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 26 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win11x64.xml b/assets/win11x64.xml index 53e73bb..76e7a79 100644 --- a/assets/win11x64.xml +++ b/assets/win11x64.xml @@ -461,6 +461,11 @@ 25 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 26 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win2008r2-eval.xml b/assets/win2008r2-eval.xml index 84467bd..f946b41 100644 --- a/assets/win2008r2-eval.xml +++ b/assets/win2008r2-eval.xml @@ -290,6 +290,11 @@ 20 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 21 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win2008r2.xml b/assets/win2008r2.xml index 9ab119f..df194be 100644 --- a/assets/win2008r2.xml +++ b/assets/win2008r2.xml @@ -293,6 +293,11 @@ 20 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 21 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win2012r2-eval.xml b/assets/win2012r2-eval.xml index 84bf8be..f2f85ab 100644 --- a/assets/win2012r2-eval.xml +++ b/assets/win2012r2-eval.xml @@ -308,6 +308,11 @@ 17 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 18 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win2012r2.xml b/assets/win2012r2.xml index 5eef789..a6560aa 100644 --- a/assets/win2012r2.xml +++ b/assets/win2012r2.xml @@ -311,6 +311,11 @@ 17 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 18 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win2016-eval.xml b/assets/win2016-eval.xml index 45c1d82..ddaf919 100644 --- a/assets/win2016-eval.xml +++ b/assets/win2016-eval.xml @@ -328,6 +328,11 @@ 21 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 22 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists @@ -335,3 +340,4 @@ + diff --git a/assets/win2016.xml b/assets/win2016.xml index 019cd1c..398763c 100644 --- a/assets/win2016.xml +++ b/assets/win2016.xml @@ -331,6 +331,11 @@ 21 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 22 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists @@ -338,3 +343,4 @@ + diff --git a/assets/win2019-eval.xml b/assets/win2019-eval.xml index e6db2d9..c518e92 100644 --- a/assets/win2019-eval.xml +++ b/assets/win2019-eval.xml @@ -332,6 +332,11 @@ 21 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 22 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists @@ -339,3 +344,4 @@ + diff --git a/assets/win2019-hv.xml b/assets/win2019-hv.xml index bb87975..68c10cf 100644 --- a/assets/win2019-hv.xml +++ b/assets/win2019-hv.xml @@ -337,6 +337,11 @@ 21 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 22 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists @@ -344,3 +349,4 @@ + diff --git a/assets/win2019.xml b/assets/win2019.xml index 5051f9f..0e7faea 100644 --- a/assets/win2019.xml +++ b/assets/win2019.xml @@ -335,6 +335,11 @@ 21 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 22 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win2022-eval.xml b/assets/win2022-eval.xml index a4ed208..e29daef 100644 --- a/assets/win2022-eval.xml +++ b/assets/win2022-eval.xml @@ -332,6 +332,11 @@ 21 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 22 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists @@ -339,3 +344,4 @@ + diff --git a/assets/win2022.xml b/assets/win2022.xml index 71c07c9..cb54e5f 100644 --- a/assets/win2022.xml +++ b/assets/win2022.xml @@ -335,6 +335,11 @@ 21 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 22 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists @@ -342,3 +347,4 @@ + diff --git a/assets/win2025-eval.xml b/assets/win2025-eval.xml index ff7f7fa..083812e 100644 --- a/assets/win2025-eval.xml +++ b/assets/win2025-eval.xml @@ -347,6 +347,11 @@ 23 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 24 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists @@ -354,3 +359,4 @@ + diff --git a/assets/win2025.xml b/assets/win2025.xml index c67965f..bbee67f 100644 --- a/assets/win2025.xml +++ b/assets/win2025.xml @@ -350,6 +350,11 @@ 23 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 24 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win7x64-enterprise-eval.xml b/assets/win7x64-enterprise-eval.xml index 85b69e4..69ef032 100644 --- a/assets/win7x64-enterprise-eval.xml +++ b/assets/win7x64-enterprise-eval.xml @@ -274,6 +274,11 @@ 18 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 19 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win7x64-enterprise.xml b/assets/win7x64-enterprise.xml index 84c873e..ef5873d 100644 --- a/assets/win7x64-enterprise.xml +++ b/assets/win7x64-enterprise.xml @@ -278,6 +278,11 @@ 18 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 19 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win7x64-ultimate.xml b/assets/win7x64-ultimate.xml index f17fb0e..679811f 100644 --- a/assets/win7x64-ultimate.xml +++ b/assets/win7x64-ultimate.xml @@ -278,6 +278,11 @@ 18 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 19 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win7x64.xml b/assets/win7x64.xml index be1f3a8..db6a87f 100644 --- a/assets/win7x64.xml +++ b/assets/win7x64.xml @@ -278,6 +278,11 @@ 18 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 19 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win7x86-enterprise.xml b/assets/win7x86-enterprise.xml index e96e5a7..e7660ec 100644 --- a/assets/win7x86-enterprise.xml +++ b/assets/win7x86-enterprise.xml @@ -278,6 +278,11 @@ 18 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 19 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win7x86-ultimate.xml b/assets/win7x86-ultimate.xml index ce81d12..f9486b5 100644 --- a/assets/win7x86-ultimate.xml +++ b/assets/win7x86-ultimate.xml @@ -278,6 +278,11 @@ 18 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 19 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win7x86.xml b/assets/win7x86.xml index 314c2ee..890d18d 100644 --- a/assets/win7x86.xml +++ b/assets/win7x86.xml @@ -278,6 +278,11 @@ 18 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 19 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win81x64-enterprise-eval.xml b/assets/win81x64-enterprise-eval.xml index f3a61e9..498e332 100644 --- a/assets/win81x64-enterprise-eval.xml +++ b/assets/win81x64-enterprise-eval.xml @@ -293,6 +293,11 @@ 17 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 18 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists @@ -300,3 +305,4 @@ + diff --git a/assets/win81x64-enterprise.xml b/assets/win81x64-enterprise.xml index bf927cc..cebab90 100644 --- a/assets/win81x64-enterprise.xml +++ b/assets/win81x64-enterprise.xml @@ -296,6 +296,11 @@ 17 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 18 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/win81x64.xml b/assets/win81x64.xml index 290e923..eb764dd 100644 --- a/assets/win81x64.xml +++ b/assets/win81x64.xml @@ -303,6 +303,11 @@ 17 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 18 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/winvistax64-enterprise.xml b/assets/winvistax64-enterprise.xml index 1e3709c..67e02fc 100644 --- a/assets/winvistax64-enterprise.xml +++ b/assets/winvistax64-enterprise.xml @@ -252,6 +252,11 @@ 23 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 24 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/winvistax64-ultimate.xml b/assets/winvistax64-ultimate.xml index cb1d1c1..cdd73eb 100644 --- a/assets/winvistax64-ultimate.xml +++ b/assets/winvistax64-ultimate.xml @@ -252,6 +252,11 @@ 23 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 24 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists @@ -259,3 +264,4 @@ + diff --git a/assets/winvistax64.xml b/assets/winvistax64.xml index 729e568..f2dc848 100644 --- a/assets/winvistax64.xml +++ b/assets/winvistax64.xml @@ -252,6 +252,11 @@ 23 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 24 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists @@ -259,3 +264,4 @@ + diff --git a/assets/winvistax86-enterprise.xml b/assets/winvistax86-enterprise.xml index 66efdf3..2e8b3b3 100644 --- a/assets/winvistax86-enterprise.xml +++ b/assets/winvistax86-enterprise.xml @@ -252,6 +252,11 @@ 23 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 24 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists @@ -259,3 +264,4 @@ + diff --git a/assets/winvistax86-ultimate.xml b/assets/winvistax86-ultimate.xml index 5231d50..0cb6857 100644 --- a/assets/winvistax86-ultimate.xml +++ b/assets/winvistax86-ultimate.xml @@ -252,6 +252,11 @@ 23 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 24 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists diff --git a/assets/winvistax86.xml b/assets/winvistax86.xml index ef0ed47..c3a2302 100644 --- a/assets/winvistax86.xml +++ b/assets/winvistax86.xml @@ -252,6 +252,11 @@ 23 + cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data + Create desktop shortcut to shared folder + + + 24 cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat" Execute custom script from the OEM folder if exists @@ -259,3 +264,4 @@ + diff --git a/readme.md b/readme.md index ede4afa..50a66b4 100644 --- a/readme.md +++ b/readme.md @@ -143,19 +143,16 @@ kubectl apply -f https://raw.githubusercontent.com/dockur/windows/refs/heads/mas ### How do I share files with the host? - Open 'File Explorer' and click on the 'Network' section, you will see a computer called `host.lan`. + After installation there will be a folder called `Shared` on your desktop, which can be used to exchange files with the host machine. - Double-click it and it will show a folder called `Data`, which can be bound to any folder on your host via the compose file: + To select a folder on the host for this purpose, include the following bind mount in your compose file: ```yaml volumes: - - ./example:/data + - ./example:/shared ``` - The example folder `./example` will be available as ` \\host.lan\Data`. - -> [!TIP] -> You can map this path to a drive letter in Windows, for easier access. + Replace the example path `./example` with your desired shared folder, which then will become visible as `Shared`. ### How do I change the amount of CPU or RAM? diff --git a/src/define.sh b/src/define.sh index f14e330..6edc4bd 100644 --- a/src/define.sh +++ b/src/define.sh @@ -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" diff --git a/src/samba.sh b/src/samba.sh index ca54266..af68071 100644 --- a/src/samba.sh +++ b/src/samba.sh @@ -1,7 +1,11 @@ #!/usr/bin/env bash set -Eeuo pipefail -: "${SAMBA:="Y"}" +: "${SAMBA:="Y"}" # Enable Samba +: "${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 @@ -18,7 +22,7 @@ if [[ "${NETWORK,,}" == "user"* ]]; then interface="127.0.0.1" fi -html "Starting file sharing services..." +html "Initializing shared folder..." [[ "$DEBUG" == [Yy1]* ]] && echo "Starting Samba daemon..." addShare() { @@ -38,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" @@ -114,27 +118,54 @@ 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 ! smbd; then - error "Samba daemon failed to start!" - smbd -i --debug-stdout || true +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 + tail -fn +0 /var/log/samba/log.smbd & fi if [[ "${BOOT_MODE:-}" == "windows_legacy" ]]; then + # Enable NetBIOS on Windows 7 and lower [[ "$DEBUG" == [Yy1]* ]] && echo "Starting NetBIOS daemon..." - if ! nmbd; then - error "NetBIOS daemon failed to start!" - nmbd -i --debug-stdout || true + + 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 + tail -fn +0 /var/log/samba/log.nmbd & + fi + else + # Enable Web Service Discovery on Vista and up [[ "$DEBUG" == [Yy1]* ]] && echo "Starting Web Service Discovery daemon..." - wsddn -i "$interface" -H "$hostname" --pid-file=/var/run/wsdd.pid >/dev/null & + + 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 return 0