dotfiles/services/sv/loadenv/run
Marty Oehme 36936142f6
services: Fix user profile path spelling
Fixes loading the user environment variables into user services again,
this time by fixing a missing `$` creating a false path to load from.
2025-05-04 19:55:02 +02:00

29 lines
931 B
Bash
Executable file

#!/bin/sh
# Loadenv service ensures turstile environment gets populated with all
# profile-loaded environment variables.
#
# To use this service with other turnstile user services, ensure it gets
# started before anything else is started by putting it into `turnstile-ready`
# service conf as a core service.
#
# Will also load the profile file from a custom XDG-compliant
# ~/.config/sh/profile directory before falling back to the home directory
# ~/.profile file.
# This location can be manually overriden by putting the following into the
# service conf file:
# XDG_PROFILE=/my/location/somewhere/profile
[ -r ./conf ] && . ./conf
if [ -e "$HOME/.config/sh/profile" ]; then
XDG_PROFILE="${XDG_PROFILE:-$HOME/.config/sh/profile}"
fi
ENV=${XDG_PROFILE:-$HOME/.profile} sh -i -c env | while IFS= read -r line; do
value=${line#*=}
name=${line%%=*}
echo "$value" > "$TURNSTILE_ENV_DIR/$name"
done
exec 2>&1
exec pause