8.4 Config File Download Repack R18: Lmc
if [[ "$SERVER_CHECKSUM" != "$LOCAL_CHECKSUM" ]]; then echo "⚠️ Checksum mismatch!" echo " Server: $SERVER_CHECKSUM" echo " Local : $LOCAL_CHECKSUM" rm -f "$FILE_NAME" exit 1 fi
# Ensure destination folder exists if (-not (Test-Path -Path $DestDir)) New-Item -ItemType Directory -Path $DestDir -Force $OutFile = Join-Path $DestDir $FileName
#--- Variables --------------------------------------------------------- LMC_HOST="lmc.example.com" API_KEY="$LMC_API_KEY" # export LMC_API_KEY=xxxxx beforehand DEST_DIR="/opt/lmc/config" FILE_NAME="lmc_config_r18.yaml" URL="https://$LMC_HOST/api/v1/config/download?rev=18" lmc 8.4 config file download r18
#--- Create destination folder (if needed) ------------------------------- mkdir -p "$DEST_DIR" cd "$DEST_DIR" || echo "❌ Cannot cd to $DEST_DIR"; exit 1;
# Download file $response = Invoke-WebRequest -Uri $Url -Headers $Headers -OutFile $OutFile -ErrorAction Stop if [[ "$SERVER_CHECKSUM"
echo "✅ Config file downloaded and verified: $DEST_DIR/$FILE_NAME" # ------------------------------------------------- # LMC 8.4 – R18 config file download (PowerShell) # -------------------------------------------------
#--- Verify checksum (SHA‑256) ------------------------------------------- # Server sends checksum in header X-Config-Checksum SERVER_CHECKSUM=$(curl -sI -H "Authorization: Bearer $API_KEY" "$URL" \ | grep -i '^X-Config-Checksum:' | awk 'print $2' | tr -d '\r') if [[ "$SERVER_CHECKSUM" != "$LOCAL_CHECKSUM" ]]
#--- Perform download ---------------------------------------------------- HTTP_RESPONSE=$(curl -sS -w "%http_code" -H "Authorization: Bearer $API_KEY" \ -H "Accept: application/x-yaml" \ -o "$FILE_NAME" "$URL")