Skip to content

Commit

Permalink
feat: Support more shared directories (#987)
Browse files Browse the repository at this point in the history
* Support more shared directories

Control the sharing of more directories through environment variables instead of hard-coding more shared directories
  • Loading branch information
ncheng89 authored Jan 8, 2025
1 parent 28f6e9c commit d9c7983
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/samba.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ addShare "$share" "Data" "Shared" || error "Failed to create shared folder!"
[ -d "/data2" ] && addShare "/data2" "Data2" "Shared"
[ -d "/data3" ] && addShare "/data3" "Data3" "Shared"

IFS=',' read -r -a dirs <<< "${SHARES:-}"
for dir in "${dirs[@]}"; do
[ ! -d "$dir" ] && continue
dir_name=$(basename "$dir")
addShare "$dir" "$dir_name" "Shared $dir_name" || error "Failed to create shared folder for $dir!"
done

if ! smbd; then
error "Samba daemon failed to start!"
smbd -i --debug-stdout || true
Expand Down

0 comments on commit d9c7983

Please sign in to comment.