From 74b93125288c69c8612293e71c0af8d1ca3b826b Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Sat, 12 Nov 2022 21:01:21 +0100 Subject: [PATCH] Universal python --- .templates/00-global_var.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.templates/00-global_var.sh b/.templates/00-global_var.sh index 8f032234e..f361b23e2 100644 --- a/.templates/00-global_var.sh +++ b/.templates/00-global_var.sh @@ -27,6 +27,14 @@ for KEYS in "${arr[@]}"; do # Export the variable to run scripts if cat /etc/services.d/*/*run* &>/dev/null; then sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null; fi if cat /etc/cont-init.d/*run* &>/dev/null; then sed -i "1a export $line" /etc/cont-init.d/*run* 2>/dev/null; fi + + # export on python + if command -v "python3" &>/dev/null; then + [ ! -f /env.py ] && echo "import os" > /env.py + echo "os.environ['${line%%=*}'] = '${line#*=}'" >> /env.py + python3 /env.py + rm /env.py + fi done ################