feat(setup): make pwsh opt-in on the Linux host (Phase C8)
Invert step 6 default: pwsh is no longer installed. Add --with-pwsh to opt in; keep --skip-pwsh as a deprecated no-op alias. Update usage/help. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+18
-9
@@ -11,8 +11,10 @@
|
||||
# portando i contenuti alla root della partizione (nessun dato perso)
|
||||
# 3. Crea il layout directory e permessi
|
||||
# 4. Installa Python 3.11+ e crea venv produzione in /opt/ci/venv
|
||||
# 5. (Opzionale) Installa PowerShell Core
|
||||
# 6. (Opzionale) Clona il repo e installa il package nel venv
|
||||
# 5. (Opzionale) Clona il repo e installa il package nel venv
|
||||
# 6. (Opt-in, --with-pwsh) Installa PowerShell Core
|
||||
# L'host Linux NON ha più bisogno di pwsh per il normale funzionamento
|
||||
# (orchestratore Python). Installalo solo se ti serve per script legacy.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
@@ -24,7 +26,7 @@ OPT_CI="/opt/ci"
|
||||
REPO_URL="https://gitea.emulab.it/Simone/local-ci-cd-system.git"
|
||||
|
||||
SKIP_PYTHON=false
|
||||
SKIP_PWSH=false
|
||||
WITH_PWSH=false
|
||||
SKIP_CLONE=false
|
||||
|
||||
# ── Colori ───────────────────────────────────────────────────────────────────
|
||||
@@ -45,12 +47,16 @@ Opzionali:
|
||||
-r <path> CI root (default: /var/lib/ci)
|
||||
-u <utente> Utente di servizio (default: ci-runner)
|
||||
--skip-python Salta installazione Python/venv
|
||||
--skip-pwsh Salta installazione PowerShell Core
|
||||
--skip-clone Salta clone repo + pip install
|
||||
--with-pwsh Installa PowerShell Core (opt-in; NON installato di default).
|
||||
L'host Linux non ha più bisogno di pwsh per il normale
|
||||
funzionamento — usa questo flag solo per script legacy.
|
||||
--skip-pwsh DEPRECATO: no-op. pwsh non è più installato di default.
|
||||
|
||||
Esempi:
|
||||
sudo bash setup-host-linux.sh -d /dev/sdf1
|
||||
sudo bash setup-host-linux.sh -d /dev/sdf1 --skip-pwsh --skip-clone
|
||||
sudo bash setup-host-linux.sh -d /dev/sdf1 --with-pwsh
|
||||
sudo bash setup-host-linux.sh -d /dev/sdf1 --skip-clone
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
@@ -63,7 +69,10 @@ while [[ $# -gt 0 ]]; do
|
||||
-r) CI_ROOT="$2"; shift 2 ;;
|
||||
-u) CI_USER="$2"; shift 2 ;;
|
||||
--skip-python) SKIP_PYTHON=true; shift ;;
|
||||
--skip-pwsh) SKIP_PWSH=true; shift ;;
|
||||
--with-pwsh) WITH_PWSH=true; shift ;;
|
||||
--skip-pwsh)
|
||||
echo "WARN: --skip-pwsh è deprecato e non ha più effetto: pwsh non è installato di default (usa --with-pwsh per installarlo)." >&2
|
||||
shift ;;
|
||||
--skip-clone) SKIP_CLONE=true; shift ;;
|
||||
-h|--help) usage ;;
|
||||
*) die "Parametro sconosciuto: $1"; ;;
|
||||
@@ -230,8 +239,8 @@ else
|
||||
info "[5/6] Clone repo — SKIPPED"
|
||||
fi
|
||||
|
||||
# ── Step 6: PowerShell Core ───────────────────────────────────────────────────
|
||||
if [[ "$SKIP_PWSH" == false ]]; then
|
||||
# ── Step 6: PowerShell Core (opt-in via --with-pwsh) ──────────────────────────
|
||||
if [[ "$WITH_PWSH" == true ]]; then
|
||||
info "[6/6] PowerShell Core"
|
||||
if command -v pwsh &>/dev/null; then
|
||||
warn "pwsh già installato: $(pwsh --version) — skip"
|
||||
@@ -254,7 +263,7 @@ if [[ "$SKIP_PWSH" == false ]]; then
|
||||
echo " Installato: $(pwsh --version)"
|
||||
fi
|
||||
else
|
||||
info "[6/6] PowerShell Core — SKIPPED"
|
||||
info "[6/6] PowerShell Core — SKIPPED (opt-in con --with-pwsh)"
|
||||
fi
|
||||
|
||||
# ── Riepilogo ─────────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user