feat: Add shared network folder (#12)
This commit is contained in:
parent
35d3152889
commit
a8ee8a03c5
4 changed files with 70 additions and 0 deletions
|
@ -9,7 +9,10 @@ RUN apt-get update \
|
||||||
&& apt-get --no-install-recommends -y install \
|
&& apt-get --no-install-recommends -y install \
|
||||||
curl \
|
curl \
|
||||||
7zip \
|
7zip \
|
||||||
|
wsdd \
|
||||||
|
samba \
|
||||||
wimtools \
|
wimtools \
|
||||||
|
dos2unix \
|
||||||
cabextract \
|
cabextract \
|
||||||
genisoimage \
|
genisoimage \
|
||||||
libxml2-utils \
|
libxml2-utils \
|
||||||
|
|
|
@ -12,6 +12,7 @@ cd /run
|
||||||
. disk.sh # Initialize disks
|
. disk.sh # Initialize disks
|
||||||
. display.sh # Initialize graphics
|
. display.sh # Initialize graphics
|
||||||
. network.sh # Initialize network
|
. network.sh # Initialize network
|
||||||
|
. samba.sh # Configure samba
|
||||||
. boot.sh # Configure boot
|
. boot.sh # Configure boot
|
||||||
. proc.sh # Initialize processor
|
. proc.sh # Initialize processor
|
||||||
. power.sh # Configure shutdown
|
. power.sh # Configure shutdown
|
||||||
|
|
|
@ -64,6 +64,9 @@ finish() {
|
||||||
pid="/var/run/tpm.pid"
|
pid="/var/run/tpm.pid"
|
||||||
[ -f "$pid" ] && pKill "$(<"$pid")"
|
[ -f "$pid" ] && pKill "$(<"$pid")"
|
||||||
|
|
||||||
|
fKill "wsdd"
|
||||||
|
fKill "smbd"
|
||||||
|
|
||||||
closeNetwork
|
closeNetwork
|
||||||
|
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
|
|
63
src/samba.sh
Normal file
63
src/samba.sh
Normal file
|
@ -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$(</run/version)..."
|
||||||
|
echo " For support visit $SUPPORT"
|
||||||
|
echo "--------------------------------------------------------"
|
||||||
|
echo ""
|
||||||
|
echo "Using this folder you can share files with the host machine."
|
||||||
|
echo ""
|
||||||
|
echo "To change the storage location, include the following bind mount in your compose file:"
|
||||||
|
echo ""
|
||||||
|
echo " volumes:"
|
||||||
|
echo " - \"/home/user/example:/storage/shared\""
|
||||||
|
echo ""
|
||||||
|
echo "Or in your run command:"
|
||||||
|
echo ""
|
||||||
|
echo " -v \"/home/user/example:/storage/shared\""
|
||||||
|
echo ""
|
||||||
|
echo "Replace the example path /home/user/example with the desired storage folder."
|
||||||
|
echo ""
|
||||||
|
} | unix2dos > "$SHARE/readme.txt"
|
||||||
|
|
||||||
|
smbd -D
|
||||||
|
wsdd -i dockerbridge -p -n "host.local" &
|
||||||
|
|
||||||
|
return 0
|
Loading…
Reference in a new issue