From 26441e51307e65ffd1a9ad9c25aa65f9e7498242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Numbus?= Date: Thu, 28 May 2026 09:38:11 +0200 Subject: [PATCH] Misc changes --- script/deploy.sh | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/script/deploy.sh b/script/deploy.sh index 4c0a092..aeb5ae8 100755 --- a/script/deploy.sh +++ b/script/deploy.sh @@ -99,28 +99,19 @@ hardware_detection() { ssh_to_host "nix-shell -p jq pciutils usbutils smartmontools iproute2 --run 'bash -s'" << SSHEND >> "${STDOUT}" 2>> "${STDERR}" set -euo pipefail -if [[ ${DEBUG} -eq 1 ]]; then - mkdir -${MKDIR_FLAGS} "${REMOTE_STDOUT%std.log}" - mkdir -${MKDIR_FLAGS} "${REMOTE_STDERR%err.log}" -fi - -# --- Initialize Global JSON Output --- HW_REPORT=\$(jq -n '{}') -# --- Helper: Add JSON array to the main report --- append_to_report() { - local key="\$1" - local json_array="\$2" - HW_REPORT=\$(echo "\$HW_REPORT" | jq --argjson arr "\$json_array" --arg k "\$key" '.[\$k] = \$arr') + local key="\${1}" + local json_array="\${2}" + HW_REPORT=\$(echo "\${HW_REPORT}" | jq --argjson arr "\${json_array}" --arg k "\${key}" '.[\${k}] = \${arr}') } -# --- 1. Detect Graphics --- detect_graphics() { local gpus="[]" - # Process each GPU found by lspci while read -r line; do - [[ -z "\$line" ]] && continue + [[ -z "\${line}" ]] && continue local brand="unknown" local renderer="none" local product="unknown" @@ -128,11 +119,11 @@ detect_graphics() { local pci_addr="none" # Extract PCI address - pci_addr="\$(echo "\$line" | cut -d' ' -f1)" + pci_addr="\$(echo "\${line}" | cut -d' ' -f1)" # Brand for b in Intel AMD NVIDIA; do - if echo "\$line" | grep -iq "\$b"; then + if echo "\${line}" | grep -iq "\${b}"; then brand="\${b}" break fi @@ -140,10 +131,9 @@ detect_graphics() { # Renderer if [[ -d "/dev/dri/by-path" ]]; then - local render_node - render_node=\$(ls /dev/dri/by-path | grep "\$pci_addr" | grep "render" | head -n1 || true) - if [[ -n "\$render_node" ]]; then - renderer=\$(basename "\$(readlink -f "/dev/dri/by-path/\$render_node")") + local render_node=\$(ls /dev/dri/by-path | grep "\${pci_addr}" | grep "render" | head -n1 || true) + if [[ -n "\${render_node}" ]]; then + renderer=\$(basename "\$(readlink -f "/dev/dri/by-path/\${render_node}")") fi fi