Fix agent install/uninstall sudo placement, add dependency install hints

curl ... | API_URL=... bash runs as the invoking user, not root, so
"sudo" has to go right after the pipe (elevating bash) rather than
before curl — the old commands in the app UI, README, and scripts'
own usage comments put it in a spot that still failed the root check.
Also have install.sh/report-tasks.sh suggest the right package-manager
command (apt/dnf/yum/apk/pacman/zypper) when curl or jq is missing
instead of just failing, and bring the README up to date with both.
This commit is contained in:
bobban committed 2026-09-02 23:12:12 +02:00
1 parent 0615866311
commit 329dcab936
5 files changed
+71 -18

No files matched your search

+19 -1
View File
@@ -23,9 +23,27 @@ if [[ -z "$API_URL" || -z "$API_TOKEN" ]]; then
exit 1
fi
suggest_package_install() {
local pkg="$1"
if command -v apt-get >/dev/null 2>&1; then
echo " sudo apt-get update && sudo apt-get install -y $pkg"
elif command -v dnf >/dev/null 2>&1; then
echo " sudo dnf install -y $pkg"
elif command -v yum >/dev/null 2>&1; then
echo " sudo yum install -y $pkg"
elif command -v apk >/dev/null 2>&1; then
echo " sudo apk add $pkg"
elif command -v pacman >/dev/null 2>&1; then
echo " sudo pacman -S $pkg"
elif command -v zypper >/dev/null 2>&1; then
echo " sudo zypper install -y $pkg"
fi
}
for bin in curl jq; do
if ! command -v "$bin" >/dev/null 2>&1; then
echo "Required dependency '$bin' is not installed." >&2
echo "Required dependency '$bin' is not installed. Try:" >&2
suggest_package_install "$bin" >&2
exit 1
fi
done