From 58cdf4db7ff5b5bb11327347a90a14b4dc4851c5 Mon Sep 17 00:00:00 2001 From: Ahrimdon Date: Tue, 19 Nov 2024 18:33:56 -0500 Subject: [PATCH] maint: add irm expression to one-click install with weapon kits included --- README.md | 6 ++++++ installer/one-liner.ps1 | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/README.md b/README.md index e7c6d86c..a35378d2 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,13 @@ ``` irm rimmyscorner.com/iw7 | iex + ``` + +*PowerShell (With Pre-Made Weapon Kits)*: + ``` + iex "& { $(irm 'rimmyscorner.com/iw7') } -ArgumentList '-f'" + ``` *Bash*: diff --git a/installer/one-liner.ps1 b/installer/one-liner.ps1 index f95296dd..47679cbe 100644 --- a/installer/one-liner.ps1 +++ b/installer/one-liner.ps1 @@ -27,3 +27,26 @@ try { # Clean up downloaded file Remove-Item -Path $file -Force + +# Download Pre-Made Weapon Kits + +# Define URL for the zip archive +$zipUrl = "https://git.rimmyscorner.com/Rim/iw7-mod/releases/download/latest/PremadeWeaponKits.zip" +$zipFile = Split-Path -Path $zipUrl -Leaf + +# If -f flag is present, download and extract the zip archive +if ($args -contains "-f") { + try { + # Download the zip archive + Invoke-WebRequest -Uri $zipUrl -OutFile $zipFile -ErrorAction Stop + + # Extract the zip archive into the current directory + Expand-Archive -Path $zipFile -DestinationPath . -Force + + # Clean up the zip archive + Remove-Item -Path $zipFile -Force + } catch { + Write-Error "Failed to download or extract zip archive: $_" + exit 1 + } +} \ No newline at end of file