Przeglądaj źródła

Suppression du forçage total de la config sunshine.conf

penta 4 tygodni temu
rodzic
commit
7aa057213e
1 zmienionych plików z 22 dodań i 6 usunięć
  1. 22 6
      sunshine-entrypoint.sh

+ 22 - 6
sunshine-entrypoint.sh

@@ -105,13 +105,29 @@ xdpyinfo -display "${DISPLAY}" \
     | grep -E 'dimensions:|resolution:' \
     || true
 
-mkdir -p "${HOME}/.config/sunshine"
+SUNSHINE_CONFIG_DIR="${HOME}/.config/sunshine"
+SUNSHINE_CONFIG="${SUNSHINE_CONFIG_DIR}/sunshine.conf"
+
+mkdir -p "${SUNSHINE_CONFIG_DIR}"
+touch "${SUNSHINE_CONFIG}"
+
+set_sunshine_option() {
+    local key="$1"
+    local value="$2"
+
+    if grep -qE "^[[:space:]]*${key}[[:space:]]*=" "${SUNSHINE_CONFIG}"; then
+        sed -i -E \
+            "s|^[[:space:]]*${key}[[:space:]]*=.*|${key} = ${value}|" \
+            "${SUNSHINE_CONFIG}"
+    else
+        printf '%s = %s\n' "${key}" "${value}" >> "${SUNSHINE_CONFIG}"
+    fi
+}
 
-cat > "${HOME}/.config/sunshine/sunshine.conf" <<'EOF'
-system_tray = disabled
-capture = nvfbc
-encoder = nvenc
-EOF
+# Option forcée dans la config de Sunshine
+set_sunshine_option "system_tray" "disabled"
+set_sunshine_option "capture" "nvfbc"
+set_sunshine_option "encoder" "nvenc"
 
 echo "Sunshine configuration:"
 cat "${HOME}/.config/sunshine/sunshine.conf"