Repository Public
1#!/bin/bash2# =============================================================================3# SP BOUCHER | INFRASTRUCTURE & AUTOMATION4# ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project : MacLustr Vision8# File : scripts/setup.sh9# Module : scripts10# Repository : https://git.spboucher.ai/maclustr-vision11# Project Website : https://camera.spboucher.ai12# Created : 2026-11-3013# Last Modified : 2026-11-3014#15# Author : Simon-Pierre Boucher16# Position : Professor of Finance17# Institution : Université du Québec en Outaouais (UQO)18# Organization : SP Boucher19# Website : https://spboucher.ai20# Git : https://git.spboucher.ai21#22# Preferred Contact: admin@spboucher.ai23# Technical Contact: dev@spboucher.ai24# Security/Admin : admin@spboucher.ai25#26# Copyright (c) 202627# Simon-Pierre Boucher28# All rights reserved where applicable. This file is governed by the29# applicable project license, copyright notices and relevant law.30# Existing third-party rights and notices remain unaffected.31#32# License : None specified (no license file in this repository)33#34# Do not embed credentials, private keys, access tokens,35# certificates or confidential personal information.36#37# =============================================================================38# END OF SP BOUCHER SOURCE HEADER39# =============================================================================4041# Mise en place idempotente sur le nœud : outils, passerelle vidéo épinglée, dépendances, build, dossiers, migrations.42source "$(dirname "$0")/common.sh"4344command -v node >/dev/null || { echo "ERREUR : node absent"; exit 1; }45node -e 'process.exit(Number(process.versions.node.split(".")[0]) >= 24 ? 0 : 1)' || { echo "ERREUR : Node >= 24 requis"; exit 1; }46if ! command -v ffmpeg >/dev/null; then echo "installation de ffmpeg…"; brew install ffmpeg >/dev/null; fi4748mkdir -p "$BIN_DIR" "$CONF_DIR"; chmod 700 "$CONF_DIR"49if [ "$("$BIN_DIR/go2rtc" -version 2>/dev/null | awk '{print $3}')" != "$GO2RTC_VERSION" ]; then50 echo "installation de go2rtc $GO2RTC_VERSION…"51 tmp="$(mktemp -d)"52 curl -fsSL -o "$tmp/g.tgz" "https://github.com/AlexxIT/go2rtc/releases/download/v$GO2RTC_VERSION/go2rtc_darwin_arm64.tar.gz"53 echo "$GO2RTC_SHA256 $tmp/g.tgz" | shasum -a 256 -c - >/dev/null || { echo "ERREUR : empreinte go2rtc inattendue"; rm -rf "$tmp"; exit 1; }54 tar -xzf "$tmp/g.tgz" -C "$tmp" && mv "$tmp/go2rtc_darwin_arm64" "$BIN_DIR/go2rtc" && chmod 755 "$BIN_DIR/go2rtc"55 xattr -c "$BIN_DIR/go2rtc" 2>/dev/null || true56 rm -rf "$tmp"57fi5859test -f "$CONF_DIR/cameras.json" || { echo "ERREUR : $CONF_DIR/cameras.json absent (voir config/cameras.example.json)"; exit 1; }60chmod 600 "$CONF_DIR/cameras.json"6162pnpm install --frozen-lockfile 2>&1 | tail -163node_modules/.bin/vite build --config web/vite.config.ts >/dev/null64test -f dist/web/index.html || { echo "ERREUR : build de l'interface manquant"; exit 1; }65node server/src/cli/setup.ts66echo " setup ok"67