24
run.sh
24
run.sh
@@ -1,18 +1,36 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
# 🧹 Nettoyage écran (uniquement si on a un terminal)
|
||||||
|
if [[ -t 1 ]]; then
|
||||||
|
clear
|
||||||
|
fi
|
||||||
|
|
||||||
BASE="https://git.thomasmlg.fr/thomas/Docker/raw/branch/release"
|
BASE="https://git.thomasmlg.fr/thomas/Docker/raw/branch/release"
|
||||||
DIR="/opt/lxc-updater"
|
DIR="/opt/lxc-updater"
|
||||||
|
|
||||||
mkdir -p "$DIR"
|
mkdir -p "$DIR"
|
||||||
cd "$DIR"
|
cd "$DIR"
|
||||||
|
|
||||||
|
# 🧾 Tout logguer dans un fichier dès le début (run + update)
|
||||||
|
LOG="/var/log/lxc-updater-run.log"
|
||||||
|
mkdir -p /var/log
|
||||||
|
: > "$LOG"
|
||||||
|
|
||||||
|
# Redirige stdout/stderr vers le log, mais on garde l’affichage console via exec 3
|
||||||
|
exec 3>&1 1>>"$LOG" 2>&1
|
||||||
|
|
||||||
|
echo "🧰 Téléchargement des scripts..." >&3
|
||||||
curl -fsSL "$BASE/detect.sh" -o detect.sh
|
curl -fsSL "$BASE/detect.sh" -o detect.sh
|
||||||
curl -fsSL "$BASE/update.sh" -o update.sh
|
curl -fsSL "$BASE/update.sh" -o update.sh
|
||||||
|
|
||||||
chmod +x detect.sh update.sh
|
chmod +x detect.sh update.sh
|
||||||
|
|
||||||
METHOD="$(./detect.sh)"
|
METHOD="$(./detect.sh)"
|
||||||
echo "[run] method=$METHOD"
|
|
||||||
|
|
||||||
./update.sh "$METHOD"
|
# ✅ Affichage demandé
|
||||||
|
echo "🧭 Mode de mise à jour : $METHOD" >&3
|
||||||
|
|
||||||
|
# Lance update (ses sorties console restent à l’écran, et toutes les commandes vont au log interne)
|
||||||
|
./update.sh "$METHOD" >&3
|
||||||
|
|
||||||
|
echo "🧾 Log run : $LOG" >&3
|
||||||
Reference in New Issue
Block a user