Add noexec /tmp detection — fall back to /usr/local/src for staging
Lint Scripts / powershell-lint (push) Failing after 13m25s
Lint Scripts / shellcheck (push) Failing after 17m44s

Scripts auto-detect noexec /tmp by attempting to execute a test script.
If /tmp is noexec, staging directory falls back to /usr/local/src.
Supports mixed fleets with both noexec and standard /tmp mounts.

Updated: deploy-exporter (1.1), install-node-exporter (1.2),
install-prometheus-stack (3.2), update-prometheus-stack (1.02),
install-snort (1.02), install-ntfy-server (1.1), install-bot-monitor (1.2)
This commit is contained in:
2026-05-26 16:16:33 +02:00
parent 166e07085a
commit d0d51be49a
7 changed files with 127 additions and 42 deletions
+15 -2
View File
@@ -9,7 +9,7 @@ set -euo pipefail
#### Author: Phil Connor ####
#### Contact: contact@mylinux.work ####
#### License: MIT ####
#### Version: 1.1 ####
#### Version: 1.2 ####
#### ####
#### Usage: ./install-node-exporter.sh [OPTIONS] ####
#############################################################
@@ -208,7 +208,20 @@ create_service_user() {
download_and_install() {
local version="$1"
TMPDIR=$(mktemp -d /tmp/node-exporter-install-XXXXXX)
# Detect noexec /tmp — fall back to /usr/local/src
local stage_dir="/tmp"
local _exec_test
_exec_test=$(mktemp /tmp/.exec_test.XXXXXX 2>/dev/null)
if [[ -n "$_exec_test" ]]; then
printf '#!/bin/sh\nexit 0\n' > "$_exec_test"
chmod +x "$_exec_test"
"$_exec_test" 2>/dev/null || stage_dir="/usr/local/src"
rm -f "$_exec_test"
else
stage_dir="/usr/local/src"
fi
TMPDIR=$(mktemp -d "${stage_dir}/node-exporter-install-XXXXXX")
local tarball="node_exporter-${version}.linux-${ARCH}.tar.gz"
local url="https://github.com/prometheus/node_exporter/releases/download/v${version}/${tarball}"