Files
felhom-controller/controller/infra-images/samba/entrypoint.sh
T
admin f42f3e0e08 feat(samba): felhom-samba infra image (R-7 slice 1, Part 0)
Own pinned alpine image (3.21@sha256:48b0309c) + smbd/nmbd/wsdd/tini. Dumb by
design: smb.conf bind-mounted read-only, no baked name/password, passdb on a
volume. Three-daemon stack per the R-6 spike verdict (nmbd required alongside
wsdd, else Explorer double-click 0x80070035). build-samba-image.sh helper.
2026-07-18 11:11:43 +02:00

34 lines
1.5 KiB
Bash

#!/bin/sh
# felhom-samba entrypoint (R-7 slice 1). A dumb supervisor: smb.conf is bind-mounted
# READ-ONLY by the controller, so nothing here templates config or bakes a secret. It
# only ensures the household unix user exists (uid:gid 1000) and launches the three
# discovery daemons. Verdict source: SPIKE-lan-discovery-2026-07-18 (S4/S4b).
set -e
FELHOM_UID="${FELHOM_UID:-1000}"
FELHOM_GID="${FELHOM_GID:-1000}"
SERVER_NAME="${FELHOM_SERVER_NAME:-FELHOM}"
IFACE="${FELHOM_IFACE:-eth0}"
# Household group/user at uid:gid 1000 — files written over SMB then match the app +
# backup ownership convention (smb.conf sets `force user = felhom` per share).
if ! getent group "$FELHOM_GID" >/dev/null 2>&1; then
addgroup -g "$FELHOM_GID" felhom 2>/dev/null || true
fi
GRP_NAME="$(getent group "$FELHOM_GID" 2>/dev/null | cut -d: -f1)"
[ -z "$GRP_NAME" ] && GRP_NAME=felhom
if ! getent passwd "$FELHOM_UID" >/dev/null 2>&1; then
adduser -D -H -u "$FELHOM_UID" -G "$GRP_NAME" -s /sbin/nologin felhom 2>/dev/null || true
fi
mkdir -p /var/lib/samba/private /run/samba
echo "[felhom-samba] launching nmbd + wsdd + smbd (server=${SERVER_NAME} iface=${IFACE} uid=${FELHOM_UID})"
# nmbd: NetBIOS flat-name resolution so \\<NAME> resolves and mounts (the S4b fix).
nmbd --daemon --no-process-group
# wsdd: WS-Discovery so the box appears in Windows Explorer's Network view.
wsdd -i "$IFACE" -4 -H 4 -s -n "$SERVER_NAME" -w WORKGROUP &
# smbd in the foreground = the container's main process.
exec smbd --foreground --no-process-group