Skip to content

Commit

Permalink
feat: add install script in Windows powershell (#611)
Browse files Browse the repository at this point in the history
* feat: update CLI version to 0.1.47

* feat: windows install script

---------

Co-authored-by: aby913 <[email protected]>
  • Loading branch information
dkeven and aby913 authored Nov 8, 2024
1 parent 96fd252 commit 7c34180
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ jobs:
cp .dist/install-wizard/install.sh build/installer
cp build/installer/install.sh build/installer/publicInstaller.sh
cp build/installer/install.sh build/installer/publicInstaller.latest
cp .dist/install-wizard/install.ps1 build/installer
cp build/installer/install.ps1 build/installer/publicInstaller.latest.ps1
- name: Release public files
uses: softprops/action-gh-release@v1
Expand All @@ -112,6 +114,8 @@ jobs:
build/installer/publicInstaller.sh
build/installer/publicInstaller.latest
build/installer/install.sh
build/installer/publicInstaller.latest.ps1
build/installer/install.ps1
build/installer/publicAddnode.sh
build/installer/version.hint
build/installer/publicRestoreInstaller.sh
Expand Down
51 changes: 51 additions & 0 deletions build/installer/install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
$currentPath = Get-Location
$architecture = $env:PROCESSOR_ARCHITECTURE
$version = "#__VERSION__"

function Test-IsAdmin {
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
$currentUser.IsInRole("Administrators")
}

if (-Not (Test-IsAdmin)) {
Write-Host "Not running as Administrator"
exit 1
}

$process = Get-Process -Name olares-cli -ErrorAction SilentlyContinue
if ($process) {
Write-Host "olares-cli.exe is running, exit."
exit 1
}

$arch = "amd64"
if ($architecture -like "ARM") {
$arch = "arm64"
}

$CLI_VERSION = "0.1.47"
$CLI_FILE = "olares-cli-v{0}_windows_{1}.tar.gz" -f $CLI_VERSION, $arch
$CLI_URL = "https://dc3p1870nn3cj.cloudfront.net/{0}" -f $CLI_FILE
$CLI_PATH = "{0}\{1}" -f $currentPath, $CLI_FILE
if (-Not (Test-Path $CLI_FILE)) {
curl -Uri $CLI_URL -OutFile $CLI_PATH
}

if (-Not (Test-Path $CLI_PATH)) {
Write-Host "Download olares-cli.exe failed."
exit 1
}

tar -xf $CLI_PATH
$cliPath = "{0}\olares-cli.exe" -f $currentPath
if ( -Not (Test-Path $cliPath)) {
Write-Host "olares-cli.exe not found."
exit 1
}

wsl --unregister Ubuntu *> $null

Start-Sleep -Seconds 3
$arguments = @("terminus", "install", "--version", $version)
Write-Host ("Preparing to start the installation of Olares {0}. Depending on your network conditions, this process may take several minutes." -f $version)
Start-Process -FilePath $cliPath -ArgumentList $arguments -Wait
2 changes: 1 addition & 1 deletion build/installer/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ if [ ! -d $BASE_DIR ]; then
mkdir -p $BASE_DIR
fi

CLI_VERSION="0.1.46"
CLI_VERSION="0.1.47"
CLI_FILE="olares-cli-v${CLI_VERSION}_linux_${ARCH}.tar.gz"
if [[ x"$os_type" == x"Darwin" ]]; then
CLI_FILE="olares-cli-v${CLI_VERSION}_darwin_${ARCH}.tar.gz"
Expand Down
1 change: 1 addition & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ fi
if [ ! -z $VERSION ]; then
sh -c "$SED 's/#__VERSION__/${VERSION}/' wizard/config/settings/templates/terminus_cr.yaml"
sh -c "$SED 's/#__VERSION__/${VERSION}/' install.sh"
sh -c "$SED 's/#__VERSION__/${VERSION}/' install.ps1"
VERSION="v${VERSION}"
else
VERSION="debug"
Expand Down

0 comments on commit 7c34180

Please sign in to comment.