feat: readme.txt created only on empty shared folder

This commit is contained in:
Luis Muñiz 2024-05-30 23:50:54 +02:00
parent 01bffba271
commit 2191b40509
3 changed files with 46 additions and 57 deletions

View file

@ -161,13 +161,6 @@ kubectl apply -f kubernetes.yml
The example folder `/home/user/example` will be available as ` \\host.lan\Data`. You can optionally map this path to a drive letter in Windows, for easier access. The example folder `/home/user/example` will be available as ` \\host.lan\Data`. You can optionally map this path to a drive letter in Windows, for easier access.
At boot, the file `readme.txt` will be created on the folder unless you disable it:
```yaml
environment:
README: "N"
```
* ### How do I install a custom image? * ### How do I install a custom image?
In order to download an unsupported ISO image that is not selectable from the list above, specify the URL of that ISO in the `VERSION` environment variable, for example: In order to download an unsupported ISO image that is not selectable from the list above, specify the URL of that ISO in the `VERSION` environment variable, for example:

View file

@ -11,7 +11,6 @@ set -Eeuo pipefail
: "${LANGUAGE:=""}" : "${LANGUAGE:=""}"
: "${USERNAME:=""}" : "${USERNAME:=""}"
: "${PASSWORD:=""}" : "${PASSWORD:=""}"
: "${README:=""}"
MIRRORS=5 MIRRORS=5
PLATFORM="x64" PLATFORM="x64"

View file

@ -1,7 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -Eeuo pipefail set -Eeuo pipefail
: "${README:="Y"}"
: "${SAMBA:="Y"}" : "${SAMBA:="Y"}"
[[ "$SAMBA" != [Yy1]* ]] && return 0 [[ "$SAMBA" != [Yy1]* ]] && return 0
@ -22,54 +21,52 @@ if [ ! -d "$share" ] && [ -d "$STORAGE/shared" ]; then
fi fi
mkdir -p "$share" mkdir -p "$share"
[ -z "$(ls -A "$share")" ] && chmod 777 "$share" if [ -z "$(ls -A "$share")" ] ;then
chmod 777 "$share"
{ echo "[global]" { echo "[global]"
echo " server string = Dockur" echo " server string = Dockur"
echo " netbios name = $hostname" echo " netbios name = $hostname"
echo " workgroup = WORKGROUP" echo " workgroup = WORKGROUP"
echo " interfaces = $interface" echo " interfaces = $interface"
echo " bind interfaces only = yes" echo " bind interfaces only = yes"
echo " security = user" echo " security = user"
echo " guest account = nobody" echo " guest account = nobody"
echo " map to guest = Bad User" echo " map to guest = Bad User"
echo " server min protocol = NT1" echo " server min protocol = NT1"
echo "" echo ""
echo " # disable printing services" echo " # disable printing services"
echo " load printers = no" echo " load printers = no"
echo " printing = bsd" echo " printing = bsd"
echo " printcap name = /dev/null" echo " printcap name = /dev/null"
echo " disable spoolss = yes" echo " disable spoolss = yes"
echo "" echo ""
echo "[Data]" echo "[Data]"
echo " path = $share" echo " path = $share"
echo " comment = Shared" echo " comment = Shared"
echo " writable = yes" echo " writable = yes"
echo " guest ok = yes" echo " guest ok = yes"
echo " guest only = yes" echo " guest only = yes"
echo " force user = root" echo " force user = root"
echo " force group = root" echo " force group = root"
} > "/etc/samba/smb.conf" } > "/etc/samba/smb.conf"
{ echo "--------------------------------------------------------"
if [[ "$README" == [Yy1]* ]] ;then echo " $APP for Docker v$(</run/version)..."
{ echo "--------------------------------------------------------" echo " For support visit $SUPPORT"
echo " $APP for Docker v$(</run/version)..." echo "--------------------------------------------------------"
echo " For support visit $SUPPORT" echo ""
echo "--------------------------------------------------------" echo "Using this folder you can share files with the host machine."
echo "" echo ""
echo "Using this folder you can share files with the host machine." echo "To change its location, include the following bind mount in your compose file:"
echo "" echo ""
echo "To change its location, include the following bind mount in your compose file:" echo " volumes:"
echo "" echo " - \"/home/user/example:/shared\""
echo " volumes:" echo ""
echo " - \"/home/user/example:/shared\"" echo "Or in your run command:"
echo "" echo ""
echo "Or in your run command:" echo " -v \"/home/user/example:/shared\""
echo "" echo ""
echo " -v \"/home/user/example:/shared\"" echo "Replace the example path /home/user/example with the desired shared folder."
echo "" echo ""
echo "Replace the example path /home/user/example with the desired shared folder."
echo ""
} | unix2dos > "$share/readme.txt" } | unix2dos > "$share/readme.txt"
fi fi