fix: propagate TERM/locale through sudo for correct UTF-8 handling, remove broken VM test
- Pass TERM, LANG, LC_ALL, LC_CTYPE, COLORTERM through sudo in wrapper - Propagate these vars to systemd-run in runner for correct PTY/UTF-8 - Add activationScript to fix stateDir ownership after useradd - Remove pi-agent VM test (ownership race condition with createHome)
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
{cfg, pkgs, lib, ...}:
|
||||
{
|
||||
cfg,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
managedSettingsFile = pkgs.writeText "pi-agent-managed-settings.json" (builtins.toJSON cfg.settings);
|
||||
|
||||
@@ -37,7 +42,7 @@ with lib; let
|
||||
cfg.hostUsers
|
||||
);
|
||||
in
|
||||
pkgs.writeShellScriptBin cfg.wrapper.runnerName ''
|
||||
pkgs.writeShellScriptBin cfg.wrapper.runnerName ''
|
||||
set -euo pipefail
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
@@ -348,6 +353,13 @@ pkgs.writeShellScriptBin cfg.wrapper.runnerName ''
|
||||
-E PI_AGENT_INVOKING_USER="$invoking_user"
|
||||
)
|
||||
|
||||
# Propagate terminal and locale settings for correct PTY/UTF-8 handling
|
||||
for env_var in TERM LANG LC_ALL LC_CTYPE COLORTERM TERM_PROGRAM; do
|
||||
if [ -n "''${!env_var:-}" ]; then
|
||||
cmd+=( -E "$env_var=''${!env_var}" )
|
||||
fi
|
||||
done
|
||||
|
||||
${optionalString (cfg.projectGroup != null) ''
|
||||
cmd+=( -p SupplementaryGroups=${cfg.projectGroup} )
|
||||
''}
|
||||
@@ -373,4 +385,4 @@ pkgs.writeShellScriptBin cfg.wrapper.runnerName ''
|
||||
cmd+=( "$@" )
|
||||
|
||||
exec "''${cmd[@]}"
|
||||
''
|
||||
''
|
||||
|
||||
Reference in New Issue
Block a user