Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Container will be configured as samba sharing server and it just needs:
- password (The password may be different from the user's actual password from your host filesystem)

-s name:path:rw:user1[,user2[,userN]]
-p name:path:rw:user1[,user2[,userN]]

- add share, that is visible as 'name', exposing contents of 'path' directory for read+write (rw) or read-only (ro) access for specified logins user1, user2, .., userN

Expand All @@ -65,7 +66,7 @@ docker run -d -p 139:139 -p 445:445 \
-u "1002:1002:guest:guest:guest" \
-s "Backup directory:/share/backups:rw:alice,bob" \
-s "Alice (private):/share/data/alice:rw:alice" \
-s "Bob (private):/share/data/bob:rw:bob" \
-p "Bob (private):/share/data/bob:rw:bob" \
-s "Documents (readonly):/share/data/documents:ro:guest,alice,bob"
```

Expand Down
37 changes: 36 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ local master = no
dns proxy = no
EOT
fi
while getopts ":u:s:h" opt; do
while getopts ":u:s:p:h" opt; do
case $opt in
h)
cat <<EOH
Expand Down Expand Up @@ -116,6 +116,41 @@ EOH
fi
echo "DONE"
;;
p)
echo -n "Add share async"
IFS=: read sharename sharepath readwrite users <<<"$OPTARG"
echo -n "'$sharename' "
echo "[$sharename]" >>"$CONFIG_FILE"
echo "strict sync = no" >> "$CONFIG_FILE"
echo "sync always = no" >> "$CONFIG_FILE"
echo "aio read size = 1" >> "$CONFIG_FILE"
echo "aio write size = 1" >> "$CONFIG_FILE"
echo -n "path '$sharepath' "
echo "path = \"$sharepath\"" >>"$CONFIG_FILE"
echo -n "read"
if [[ "rw" = "$readwrite" ]] ; then
echo -n "+write "
echo "read only = no" >>"$CONFIG_FILE"
echo "writable = yes" >>"$CONFIG_FILE"
else
echo -n "-only "
echo "read only = yes" >>"$CONFIG_FILE"
echo "writable = no" >>"$CONFIG_FILE"
fi
if [[ -z "$users" ]] ; then
echo -n "for guests: "
echo "browseable = yes" >>"$CONFIG_FILE"
echo "guest ok = yes" >>"$CONFIG_FILE"
echo "public = yes" >>"$CONFIG_FILE"
else
echo -n "for users: "
users=$(echo "$users" |tr "," " ")
echo -n "$users "
echo "valid users = $users" >>"$CONFIG_FILE"
echo "write list = $users" >>"$CONFIG_FILE"
fi
echo "DONE"
;;
\?)
echo "Invalid option: -$OPTARG"
exit 1
Expand Down