UniGetUI installer, minor other changes to WinGet and NC
This commit is contained in:
66
Install-UniGetUI.ps1
Normal file
66
Install-UniGetUI.ps1
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
# Script to install UniGetUI
|
||||||
|
# Technolog Networks - 2025-10-18
|
||||||
|
# iRaven
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Installs UniGetUI
|
||||||
|
#>
|
||||||
|
|
||||||
|
Start-Transcript -Path "$env:systemdrive\irnh\Install-UniGetUI.log" -Append
|
||||||
|
$PkgInfo = Get-Package -Name "UniGetUI*"
|
||||||
|
$LatestVerResp = (irm https://api.github.com/repos/marticliment/UniGetUI/releases/latest)
|
||||||
|
$LatestVer = $LatestVerResp.tag_name
|
||||||
|
$LatestVerURL = $LatestVerResp.assets.browser_download_url -like "*.exe"
|
||||||
|
$InstallerFile = "$env:systemdrive\irnh\UniGetUI-$LatestVer.exe"
|
||||||
|
|
||||||
|
|
||||||
|
Function IsLatestVer {
|
||||||
|
if (($LatestVer) -gt ($PkgInfo.Version)){
|
||||||
|
return $false
|
||||||
|
} else {
|
||||||
|
return $true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Function DownloadLatestVer {
|
||||||
|
try {
|
||||||
|
if (!(Test-Path $InstallerFile)) {
|
||||||
|
cmd.exe /c "curl -L -o $InstallerFile $LatestVerURL"
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
write-host -ForegroundColor red "Couldn't download the latest installer at URL $LatestVerURL !"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Function InstallLatestVer {
|
||||||
|
try {
|
||||||
|
Write-Host -ForegroundColor Yellow "Installing UniGetUI $LatestVer"
|
||||||
|
$Installer = Start-Process $InstallerFile -Wait -PassThru -ArgumentList "/silent /allusers"
|
||||||
|
write-host "returned exit code" $Installer.ExitCode
|
||||||
|
if (0 -in $Installer.ExitCode) {
|
||||||
|
Write-Host -ForegroundColor Green "Successfully installed!"
|
||||||
|
rm $InstallerFile
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
write-host "it no worky"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!($PkgInfo)) { # Not installed
|
||||||
|
Write-Host -ForegroundColor Yellow "UniGetUI not installed - installing latest version $LatestVer"
|
||||||
|
DownloadLatestVer
|
||||||
|
InstallLatestVer
|
||||||
|
} else {
|
||||||
|
Write-Host -ForegroundColor Yellow "UniGetUI installed with" $PkgInfo.Version
|
||||||
|
if (IsLatestVer) {
|
||||||
|
Write-Host -ForegroundColor Green "The currently installed version is the latest version"
|
||||||
|
} else {
|
||||||
|
Write-Host -ForegroundColor Yellow "The currently installed version is NOT the latest version - installing $LatestVer"
|
||||||
|
DownloadLatestVer
|
||||||
|
InstallLatestVer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Exiting"
|
||||||
|
Stop-Transcript
|
@@ -8,6 +8,10 @@ Updates Nextcloud Client
|
|||||||
Set if in use with MDT for logging
|
Set if in use with MDT for logging
|
||||||
#>
|
#>
|
||||||
|
|
||||||
|
param(
|
||||||
|
[switch] $MDT
|
||||||
|
)
|
||||||
|
|
||||||
Start-Transcript -Path "c:\irnh\Install-WinGet.log" -Append
|
Start-Transcript -Path "c:\irnh\Install-WinGet.log" -Append
|
||||||
|
|
||||||
$PSModulePathAU = $env:PSModulePath.split(';')[1] # All Users PSModule path
|
$PSModulePathAU = $env:PSModulePath.split(';')[1] # All Users PSModule path
|
||||||
|
@@ -9,13 +9,19 @@ Updates Nextcloud Client
|
|||||||
Boolean to install the client if not installed
|
Boolean to install the client if not installed
|
||||||
#>
|
#>
|
||||||
|
|
||||||
|
param(
|
||||||
|
[switch] $Install
|
||||||
|
)
|
||||||
|
|
||||||
Start-Transcript -Path "$env:systemdrive\irnh\Nextcloud-Updater.log" -Append
|
Start-Transcript -Path "$env:systemdrive\irnh\Nextcloud-Updater.log" -Append
|
||||||
$PkgInfo = Get-Package -Name "Nextcloud*"
|
$PkgInfo = Get-Package -Name "Nextcloud*"
|
||||||
$LatestVer = (irm https://api.github.com/repos/nextcloud-releases/desktop/releases/latest).tag_name
|
$LatestVerResp = (irm https://api.github.com/repos/nextcloud-releases/desktop/releases/latest)
|
||||||
$LatestVerURL = (irm https://api.github.com/repos/nextcloud-releases/desktop/releases/latest).assets.browser_download_url -like "*.msi"
|
$LatestVer = $LatestVerResp.tag_name
|
||||||
|
$LatestVerURL = $LatestVerResp.assets.browser_download_url -like "*.msi"
|
||||||
|
$InstallerFile = "$env:systemdrive\irnh\Nextcloud-$LatestVer.msi"
|
||||||
|
|
||||||
Function IsLatestVer {
|
Function IsLatestVer {
|
||||||
|
# What kind of fuckery is this. I hate it (compares [v]1.2.3 to 1.2.3[.20250123])
|
||||||
if (($LatestVer.Substring(1)) -gt ($PkgInfo.Version.Substring(0,6))){
|
if (($LatestVer.Substring(1)) -gt ($PkgInfo.Version.Substring(0,6))){
|
||||||
return $false
|
return $false
|
||||||
} else {
|
} else {
|
||||||
@@ -25,8 +31,8 @@ Function IsLatestVer {
|
|||||||
|
|
||||||
Function DownloadLatestVer {
|
Function DownloadLatestVer {
|
||||||
try {
|
try {
|
||||||
if (!(Test-Path "$env:systemdrive\irnh\Nextcloud-$LatestVer.msi")) {
|
if (!(Test-Path $InstallerFile)) {
|
||||||
cmd.exe /c "curl -L -o $env:systemdrive\irnh\Nextcloud-$LatestVer.msi $LatestVerURL"
|
cmd.exe /c "curl -L -o $InstallerFile $LatestVerURL"
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
write-host -ForegroundColor red "Couldn't download the latest installer at URL $LatestVerURL !"
|
write-host -ForegroundColor red "Couldn't download the latest installer at URL $LatestVerURL !"
|
||||||
@@ -36,11 +42,11 @@ Function DownloadLatestVer {
|
|||||||
Function InstallLatestVer {
|
Function InstallLatestVer {
|
||||||
try {
|
try {
|
||||||
Write-Host -ForegroundColor Yellow "Installing Nextcloud Client $LatestVer"
|
Write-Host -ForegroundColor Yellow "Installing Nextcloud Client $LatestVer"
|
||||||
$NCInstall = Start-Process msiexec -Wait -PassThru -ArgumentList "/passive /i $env:systemdrive\irnh\Nextcloud-$LatestVer.msi REBOOT=ReallySuppress"
|
$NCInstall = Start-Process msiexec -Wait -PassThru -ArgumentList "/passive /i $InstallerFile REBOOT=ReallySuppress"
|
||||||
write-host "returned exit code" $NCInstall.ExitCode
|
write-host "returned exit code" $NCInstall.ExitCode
|
||||||
if (0 -in $NCInstall.ExitCode) {
|
if (0 -in $NCInstall.ExitCode) {
|
||||||
Write-Host -ForegroundColor Green "Successfully installed!"
|
Write-Host -ForegroundColor Green "Successfully installed!"
|
||||||
del "$env:SystemDrive\irnh\Nextcloud-$LatestVer.msi"
|
rm $InstallerFile
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
write-host "it no worky"
|
write-host "it no worky"
|
||||||
|
Reference in New Issue
Block a user