Time machine optional

This commit is contained in:
Struchkov Mark
2026-01-07 16:45:26 +03:00
parent d00bd6d6b3
commit 65b593d457
2 changed files with 24 additions and 8 deletions

View File

@@ -46,7 +46,7 @@ RUN file="/etc/samba/smb.conf" && \
getwd cache = yes
min receivefile size = 16384
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=131072 SO_SNDBUF=131072
vfs objects = catia fruit recycle streams_xattr
vfs objects = catia recycle
# Recycle bin
recycle:keeptree = yes
@@ -62,12 +62,6 @@ RUN file="/etc/samba/smb.conf" && \
server max protocol = SMB3
server min protocol = SMB2_10
# Time Machine
fruit:delete_empty_adfiles = yes
fruit:time machine = yes
fruit:veto_appledouble = no
fruit:wipe_intentionally_left_blank_rfork = yes
EOF
# Cleanup

View File

@@ -208,6 +208,25 @@ workgroup() { local workgroup="$1"
sed -i 's|^\( *workgroup = \).*|\1'"$workgroup"'|' "$SMB_CONF"
}
### timemachine: enable Time Machine support for macOS
# Arguments:
# none)
# Return: result
timemachine() {
# Add fruit and streams_xattr to vfs objects
sed -i 's/\(vfs objects = catia\)/\1 fruit streams_xattr/' "$SMB_CONF"
# Add Time Machine configuration
sed -i '/\[global\]/a \
fruit:aapl = yes\
fruit:metadata = stream\
fruit:model = TimeCapsule6,116\
fruit:delete_empty_adfiles = yes\
fruit:time machine = yes\
fruit:veto_appledouble = no\
fruit:wipe_intentionally_left_blank_rfork = yes' "$SMB_CONF"
}
### widelinks: allow access wide symbolic links
# Arguments:
# none)
@@ -238,6 +257,7 @@ Options (fields in '[]' are optional, '<>' are required):
-p Set ownership and permissions on the shares
-r Disable recycle bin for shares
-S Disable SMB2 minimum version
-t Enable Time Machine support for macOS
-s \"<name;/path>[;browse;readonly;guest;users;admins;writelist;comment]\"
Configure a share
required arg: \"<name>;</path>\"
@@ -275,7 +295,7 @@ The 'command' (if provided and valid) will be run instead of samba
[[ "${USERID:-""}" =~ ^[0-9]+$ ]] && usermod -u $USERID -o smbuser
[[ "${GROUPID:-""}" =~ ^[0-9]+$ ]] && groupmod -g $GROUPID -o smb
while getopts ":hc:G:g:i:nprs:Su:Ww:I:" opt; do
while getopts ":hc:G:g:i:nprs:Stu:Ww:I:" opt; do
case "$opt" in
h) usage ;;
c) charmap "$OPTARG" ;;
@@ -287,6 +307,7 @@ while getopts ":hc:G:g:i:nprs:Su:Ww:I:" opt; do
r) recycle ;;
s) parse_args "$OPTARG"; share "${PARSED_ARGS[@]}" ;;
S) smb ;;
t) timemachine ;;
u) parse_args "$OPTARG"; user "${PARSED_ARGS[@]}" ;;
w) workgroup "$OPTARG" ;;
W) widelinks ;;
@@ -310,6 +331,7 @@ while read i; do
parse_args "$i"; share "${PARSED_ARGS[@]}"
done < <(env | awk '/^SHARE[0-9=_]/ {sub (/^[^=]*=/, "", $0); print}')
[[ "${SMB:-""}" ]] && smb
[[ "${TIMEMACHINE:-""}" ]] && timemachine
while read i; do
parse_args "$i"; user "${PARSED_ARGS[@]}"
done < <(env | awk '/^USER[0-9=_]/ {sub (/^[^=]*=/, "", $0); print}')