feat: Only create readme.txt when folder is empty (#552)

This commit is contained in:
Luis Muñiz 2024-05-31 07:24:46 +02:00 committed by GitHub
parent 09c07d0634
commit 900b520f23
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,7 +21,32 @@ 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 "--------------------------------------------------------"
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 its location, include the following bind mount in your compose file:"
echo ""
echo " volumes:"
echo " - \"/home/user/example:/shared\""
echo ""
echo "Or in your run command:"
echo ""
echo " -v \"/home/user/example:/shared\""
echo ""
echo "Replace the example path /home/user/example with the desired shared folder."
echo ""
} | unix2dos > "$share/readme.txt"
fi
{ echo "[global]" { echo "[global]"
echo " server string = Dockur" echo " server string = Dockur"
@ -50,26 +75,6 @@ mkdir -p "$share"
echo " force group = root" echo " force group = root"
} > "/etc/samba/smb.conf" } > "/etc/samba/smb.conf"
{ 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 its location, include the following bind mount in your compose file:"
echo ""
echo " volumes:"
echo " - \"/home/user/example:/shared\""
echo ""
echo "Or in your run command:"
echo ""
echo " -v \"/home/user/example:/shared\""
echo ""
echo "Replace the example path /home/user/example with the desired shared folder."
echo ""
} | unix2dos > "$share/readme.txt"
! smbd && smbd --debug-stdout ! smbd && smbd --debug-stdout
legacy="" legacy=""