initial commit

This commit is contained in:
Ludwig Lehnert
2026-02-03 16:39:37 +01:00
commit 70fe6076a4
30 changed files with 2128 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -euo pipefail
user="$1"
domain="${2:-}"
target="/data/private/${user}"
if [ ! -d "${target}" ]; then
mkdir -p "${target}"
chmod 0700 "${target}"
fi
if getent passwd "${user}" >/dev/null 2>&1; then
uid=$(getent passwd "${user}" | cut -d: -f3)
gid=$(getent passwd "${user}" | cut -d: -f4)
chown "${uid}:${gid}" "${target}"
exit 0
fi
if [ -n "${domain}" ] && getent passwd "${domain}\\${user}" >/dev/null 2>&1; then
uid=$(getent passwd "${domain}\\${user}" | cut -d: -f3)
gid=$(getent passwd "${domain}\\${user}" | cut -d: -f4)
chown "${uid}:${gid}" "${target}"
fi