aboutsummaryrefslogtreecommitdiff
path: root/nitro@/common
diff options
context:
space:
mode:
authorChloƩ Vulquin <code@toast.bunkerlabs.net>2026-01-19 20:18:38 +0100
committerChloƩ Vulquin <code@toast.bunkerlabs.net>2026-01-19 20:18:38 +0100
commit647fa59ecbc8b51309ef20288de5eb73a042f869 (patch)
tree71bcdb01237d7b67df91588bf84572050b161155 /nitro@/common
initial importnitro
Diffstat (limited to 'nitro@/common')
-rw-r--r--nitro@/common16
1 files changed, 16 insertions, 0 deletions
diff --git a/nitro@/common b/nitro@/common
new file mode 100644
index 0000000..bd0e300
--- /dev/null
+++ b/nitro@/common
@@ -0,0 +1,16 @@
+#!/bin/sh
+# before sourcing, set USER="$1"
+
+[ -r ./conf ] && . ./conf
+# this lets you create configs per-user
+[ -r ./conf."$USER" ] && . ./conf."$USER"
+
+UID=$(id -u "$USER")
+GID=$(id -g "$USER")
+
+: ${HOME:=$(getent passwd "$USER" | cut -d: -f6)} \
+ ${CONFDIR:="$HOME"/.config/nitro} \
+ ${CHPSTUSER:=:$UID:$(id -G "$USER" | tr ' ' ':')} \
+ ${SOCKDIR:=${SOCKET_PREFIX:-/run/user}/$UID}
+
+export USER HOME NITRO_SOCK="$SOCKDIR"/nitro/nitro.sock