#!/usr/bin/env bash set -Eeuo pipefail umask 077 version='0.19.0' archive="neuribrain-watch-${version}.tar.gz" release_url="https://github.com/patmail/neuribrain-watch/releases/download/v${version}" expected_sha256='d2272a1f8f36ba45ada2c926ea17276ddf6c24d185031e464cbdc865bde8490e' if ((EUID != 0)); then printf 'Cette installation doit être lancée avec sudo.\n' >&2 exit 2 fi for command in curl tar sha256sum; do command -v "$command" >/dev/null || { printf 'Commande requise absente: %s\n' "$command" >&2; exit 2; } done temporary_directory="$(mktemp -d /tmp/neuribrain-watch-install.XXXXXX)" trap 'rm -rf -- "$temporary_directory"' EXIT printf '\nTéléchargement de Neuribrain WATCH %s depuis GitHub…\n' "$version" curl --fail --show-error --location --proto '=https' --tlsv1.2 \ --output "$temporary_directory/$archive" "$release_url/$archive" printf '%s %s\n' "$expected_sha256" "$temporary_directory/$archive" \ | sha256sum --check --status printf 'Archive officielle vérifiée. Lancement du précontrôle…\n' tar -xzf "$temporary_directory/$archive" -C "$temporary_directory" bash "$temporary_directory/deploy/install/install.sh" \ --yes --web-server auto --port 3205 --dashboard-port 8443