Unverified Commit 900b520f authored by Luis Muñiz's avatar Luis Muñiz Committed by GitHub
Browse files

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

parent 09c07d06
Loading
Loading
Loading
Loading
+26 −21
Original line number Diff line number Diff line
@@ -21,7 +21,32 @@ if [ ! -d "$share" ] && [ -d "$STORAGE/shared" ]; then
fi

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 "    server string = Dockur"
@@ -50,26 +75,6 @@ mkdir -p "$share"
        echo "    force group = root"
} > "/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

legacy=""