feat: Add share reference

This commit is contained in:
Kroese 2025-10-03 06:16:54 +02:00 committed by GitHub
parent ee69662994
commit 99db4c8e5d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -27,8 +27,9 @@ html "Initializing shared folder..."
addShare() { addShare() {
local dir="$1" local dir="$1"
local name="$2" local ref="$2"
local comment="$3" local name="$3"
local comment="$4"
mkdir -p "$dir" || return 1 mkdir -p "$dir" || return 1
ls -A "$dir" >/dev/null 2>&1 || return 1 ls -A "$dir" >/dev/null 2>&1 || return 1
@ -47,11 +48,11 @@ addShare() {
echo "To select a folder on the host for this purpose, include the following bind mount in your compose file:" echo "To select a folder on the host for this purpose, include the following bind mount in your compose file:"
echo "" echo ""
echo " volumes:" echo " volumes:"
echo " - \"./example:/${name,,}\"" echo " - \"./example:${ref}\""
echo "" echo ""
echo "Or in your run command:" echo "Or in your run command:"
echo "" echo ""
echo " -v \"\${PWD:-.}/example:/${name,,}\"" echo " -v \"\${PWD:-.}/example:${ref}\""
echo "" echo ""
echo "Replace the example path ./example with your desired shared folder, which then will become visible here." echo "Replace the example path ./example with your desired shared folder, which then will become visible here."
echo "" echo ""
@ -94,28 +95,28 @@ addShare() {
echo " disable spoolss = yes" echo " disable spoolss = yes"
} > "/etc/samba/smb.conf" } > "/etc/samba/smb.conf"
share="/shared" share="/data"
[ ! -d "$share" ] && [ -d "$STORAGE/shared" ] && share="$STORAGE/shared"
[ ! -d "$share" ] && [ -d "/data" ] && share="/data"
[ ! -d "$share" ] && [ -d "$STORAGE/data" ] && share="$STORAGE/data" [ ! -d "$share" ] && [ -d "$STORAGE/data" ] && share="$STORAGE/data"
[ ! -d "$share" ] && [ -d "/shared" ] && share="/shared"
[ ! -d "$share" ] && [ -d "$STORAGE/shared" ] && share="$STORAGE/shared"
if ! addShare "$share" "Data" "Shared"; then if ! addShare "$share" "/shared" "Data" "Shared"; then
error "Failed to add shared folder '$share'. Please check its permissions." && return 0 error "Failed to add shared folder '$share'. Please check its permissions." && return 0
fi fi
if [ -d "/shared2" ]; then if [ -d "/shared2" ]; then
addShare "/shared2" "Data2" "Shared" || error "Failed to add shared folder '/shared2'. Please check its permissions." addShare "/shared2" "/shared2" "Data2" "Shared" || error "Failed to add shared folder '/shared2'. Please check its permissions."
else else
if [ -d "/data2" ]; then if [ -d "/data2" ]; then
addShare "/data2" "Data2" "Shared" || error "Failed to add shared folder '/data2'. Please check its permissions." addShare "/data2" "/shared2" "Data2" "Shared" || error "Failed to add shared folder '/data2'. Please check its permissions."
fi fi
fi fi
if [ -d "/shared3" ]; then if [ -d "/shared3" ]; then
addShare "/shared3" "Data3" "Shared" || error "Failed to add shared folder '/shared3'. Please check its permissions." addShare "/shared3" "/shared3" "Data3" "Shared" || error "Failed to add shared folder '/shared3'. Please check its permissions."
else else
if [ -d "/data3" ]; then if [ -d "/data3" ]; then
addShare "/data3" "Data3" "Shared" || error "Failed to add shared folder '/data3'. Please check its permissions." addShare "/data3" "/shared3" "Data3" "Shared" || error "Failed to add shared folder '/data3'. Please check its permissions."
fi fi
fi fi