Files
computer-playbook/scripts/meta/env/runtime.sh
T
kevinveenbirkenbachandClaude Sonnet 4.6 8825394e36 refactor: centralize WSL2 detection in scripts/meta/env/runtime.sh
Add IS_WSL2 export to runtime.sh and replace all inline
grep-based WSL2 guards in administration scripts with a
source + variable check for consistency.

Affected scripts:
- scripts/administration/systemd/enable/wsl2.sh
- scripts/administration/tls/trust/wsl2.sh
- scripts/administration/network/dns/setup/wsl.sh

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 20:36:59 +01:00

32 lines
620 B
Bash
Executable File

#!/usr/bin/env bash
# shellcheck shell=bash
#
# Resolve runtime context flags (local, act, github).
set -euo pipefail
if [[ "${INFINITO_ENV_RUNTIME_LOADED:-}" == "1" ]]; then
return 0
fi
export INFINITO_ENV_RUNTIME_LOADED="1"
: "${RUNNING_ON_ACT:=false}"
: "${RUNNING_ON_GITHUB:=false}"
if [[ "${GITHUB_ACTIONS:-}" == "true" ]]; then
RUNNING_ON_GITHUB="true"
if [[ "${ACT:-}" == "true" ]]; then
RUNNING_ON_ACT="true"
RUNNING_ON_GITHUB="false"
fi
fi
export RUNNING_ON_ACT RUNNING_ON_GITHUB
if grep -qiE "microsoft|wsl" /proc/version 2>/dev/null; then
IS_WSL2="true"
else
IS_WSL2="false"
fi
export IS_WSL2