#!/usr/bin/env -S pwsh -NoLogo -NoProfile -NonInteractive

# Copyright 2023-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

$ErrorActionPreference = "Stop"
Set-StrictMode -Version Latest

$admin = "${PSScriptRoot}"
$source = "${admin}/../"

Set-Location $source

& "${admin}/uninstall_tool.ps1" $args

if ($LASTEXITCODE -ne 0) {
    throw "uninstall_tool.ps1 failed"
}

& "${admin}/install_tool.ps1" $args

if ($LASTEXITCODE -ne 0) {
    throw "install_tool.ps1 failed"
}
