Skip to content

Commit

Permalink
Update samba.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese authored Jan 8, 2025
1 parent c3f5af3 commit 3b75b19
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/samba.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,14 @@ share="/data"

addShare "$share" "Data" "Shared" || error "Failed to create shared folder!"

IFS=',' read -r -a dirs <<< "${SHARED_DIRS:-}"
# Traverse the directory and create shares
index_dir=1
[ -d "/data2" ] && addShare "/data2" "Data2" "Shared"
[ -d "/data3" ] && addShare "/data3" "Data3" "Shared"

IFS=',' read -r -a dirs <<< "${SHARES:-}"
for dir in "${dirs[@]}"; do
if [ -d "$dir" ]; then
dir_name=$(basename "$dir")
addShare "$dir" "${dir_name}_${index_dir}" "Shared $dir_name" || error "Failed to create shared folder for $dir!"
((index_dir++))
fi
[ ! -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
Expand Down

0 comments on commit 3b75b19

Please sign in to comment.