try reverting env var

This commit is contained in:
Lucas Armand
2025-12-12 12:16:33 -08:00
parent 375633cb18
commit 6a57ff8e0a
+7 -27
View File
@@ -75,34 +75,14 @@ if [ -e "$MODEL_LOG" ]; then
fi fi
fi fi
ENV_SENTINEL="VAST_ENV_INITIALIZED=1" # Populate /etc/environment with quoted values
if ! grep -q "VAST" /etc/environment; then
if ! grep -qxF "$ENV_SENTINEL" /etc/environment 2>/dev/null; then if ! env -0 | grep -zEv "^(HOME=|SHLVL=)|CONDA" | while IFS= read -r -d '' line; do
{ name=${line%%=*}
echo "$ENV_SENTINEL" value=${line#*=}
# Serialize current environment
env -0 | while IFS= read -r -d '' kv; do
name=${kv%%=*}
value=${kv#*=}
# Skip volatile or shell-internal variables
case "$name" in
HOME|SHLVL|PWD|OLDPWD|_ ) continue ;;
esac
# Escape backslashes, quotes, and newlines
value=${value//\\/\\\\}
value=${value//\"/\\\"}
value=${value//$'\n'/\\n}
printf '%s="%s"\n' "$name" "$value" printf '%s="%s"\n' "$name" "$value"
done done > /etc/environment; then
} > /etc/environment.tmp echo "WARNING: Failed to populate /etc/environment, continuing anyway"
if ! mv /etc/environment.tmp /etc/environment; then
echo "WARNING: Failed to update /etc/environment, continuing anyway"
rm -f /etc/environment.tmp
fi fi
fi fi