From 4e9ac3ef379bf6be27676f6c5355a9bd8fd5fa36 Mon Sep 17 00:00:00 2001 From: Kroese Date: Wed, 7 Feb 2024 23:48:38 +0100 Subject: [PATCH] feat: Add shared network folder (#157) --- Dockerfile | 3 +++ src/entry.sh | 1 + src/install.sh | 7 +++++- src/power.sh | 7 ++++-- src/samba.sh | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 src/samba.sh diff --git a/Dockerfile b/Dockerfile index c5378dd..543151a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,10 @@ RUN apt-get update \ && apt-get --no-install-recommends -y install \ curl \ 7zip \ + wsdd \ + samba \ wimtools \ + dos2unix \ cabextract \ genisoimage \ libxml2-utils \ diff --git a/src/entry.sh b/src/entry.sh index 412ee75..a9d3111 100644 --- a/src/entry.sh +++ b/src/entry.sh @@ -12,6 +12,7 @@ cd /run . disk.sh # Initialize disks . display.sh # Initialize graphics . network.sh # Initialize network +. samba.sh # Configure samba . boot.sh # Configure boot . proc.sh # Initialize processor . power.sh # Configure shutdown diff --git a/src/install.sh b/src/install.sh index c87c284..37f6aac 100644 --- a/src/install.sh +++ b/src/install.sh @@ -835,11 +835,16 @@ prepareXP() { echo "ProductKey=$key" echo "" echo "[Identification]" - echo "JoinWorkgroup" + echo "JoinWorkgroup = WORKGROUP" echo "" echo "[Networking]" echo "InstallDefaultComponents=Yes" echo "" + echo "[URL]" + echo "Home_Page = http://www.google.com" + echo "Search_Page = http://www.google.com/ie_rsearch.html" + echo "AutoConfig = 0" + echo "" echo "[RegionalSettings]" echo "Language=00000409" echo "" diff --git a/src/power.sh b/src/power.sh index 4280441..cce28f2 100644 --- a/src/power.sh +++ b/src/power.sh @@ -29,8 +29,8 @@ ready() { if [ -f "$STORAGE/windows.old" ]; then local last - local bios="Booting from Hard Disk" - last=$(grep "^B.*" "$QEMU_PTY" | tail -1) + local bios="Booting from Hard" + last=$(grep "^Booting.*" "$QEMU_PTY" | tail -1) if [[ "${last,,}" == "${bios,,}"* ]]; then return 0 fi @@ -74,6 +74,9 @@ finish() { pid="/var/run/tpm.pid" [ -f "$pid" ] && pKill "$(<"$pid")" + fKill "wsdd" + fKill "smbd" + closeNetwork sleep 0.5 diff --git a/src/samba.sh b/src/samba.sh new file mode 100644 index 0000000..03d1e8b --- /dev/null +++ b/src/samba.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash +set -Eeuo pipefail + +[[ "$DHCP" == [Yy1]* ]] && return 0 + +SHARE="$STORAGE/shared" + +mkdir -p "$SHARE" +chmod -R 777 "$SHARE" + +SAMBA="/etc/samba/smb.conf" + +{ echo "[global]" + echo " server string = Dockur" + echo " netbios name = dockur" + echo " workgroup = WORKGROUP" + echo " interfaces = dockerbridge" + echo " bind interfaces only = yes" + echo " security = user" + echo " guest account = nobody" + echo " map to guest = Bad User" + echo " server min protocol = SMB2" + echo "" + echo " # disable printing services" + echo " load printers = no" + echo " printing = bsd" + echo " printcap name = /dev/null" + echo " disable spoolss = yes" + echo "" + echo "[Data]" + echo " path = $SHARE" + echo " comment = Shared" + echo " writable = yes" + echo " guest ok = yes" + echo " guest only = yes" + echo " force user = root" + echo " force group = root" +} > "$SAMBA" + +{ echo "--------------------------------------------------------" + echo " $APP for Docker v$( "$SHARE/readme.txt" + +smbd -D +wsdd -i dockerbridge -p -n "host.local" & + +return 0