-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add back updated powershell installer option
- Loading branch information
Showing
1 changed file
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
# Function to get the system architecture (32-bit, 64-bit, or ARM64) | ||
function Get-Architecture { | ||
$arch = (Get-WmiObject -Class Win32_OperatingSystem).OSArchitecture | ||
return $arch | ||
} | ||
|
||
# Function to download a file | ||
function Download-File { | ||
param ( | ||
[string]$url, | ||
[string]$destination | ||
) | ||
Invoke-WebRequest -Uri $url -OutFile $destination | ||
} | ||
|
||
# Function to extract an archive | ||
function Extract-Archive { | ||
param ( | ||
[string]$archivePath, | ||
[string]$extractTo | ||
) | ||
Expand-Archive -Path $archivePath -DestinationPath $extractTo -Force | ||
} | ||
|
||
# Function to add a line to reaper.ini | ||
function Add-LineToReaperIni { | ||
param ( | ||
[string]$folder | ||
) | ||
$iniPath = Join-Path $folder "reaper.ini" | ||
$line = "theme=splashscreen_theme.ini" | ||
Add-Content -Path $iniPath -Value $line | ||
} | ||
|
||
# Function to replace key in reaper-kb.ini | ||
function Replace-KeyInFile { | ||
param ( | ||
[string]$filePath | ||
) | ||
(Get-Content $filePath) -replace 'Ctrl\+`', 'Ctrl+1' | Set-Content $filePath | ||
} | ||
|
||
# Check the system architecture and set the appropriate REAPER download URL | ||
$pkgver = "25.0" # Example version | ||
$arch = Get-Architecture | ||
$currentYear = (Get-Date).Year % 100 | ||
$dateSuffix = [guid]::NewGuid().ToString().Substring(0, 8) # Unique date-based suffix | ||
$tempDir = [System.IO.Path]::GetTempPath() | ||
$tempFilePath = Join-Path $tempDir ("ReaClassical_" + $dateSuffix) | ||
|
||
# Create the temporary directory | ||
New-Item -ItemType Directory -Force -Path $tempFilePath | ||
|
||
# ReaClassical folder naming logic | ||
$rcver = $currentYear | ||
$rcfolder = "ReaClassical_$rcver" | ||
if (Test-Path $rcfolder) { | ||
$rcfolder = "ReaClassical_${rcver}_$dateSuffix" | ||
Write-Host "Folder ReaClassical_$rcver already exists. Adding unique identifier as suffix." | ||
} | ||
|
||
# Directory paths for 7zip and REAPER | ||
$sevenZipDir = Join-Path $tempFilePath "7zip" | ||
$reaperExePath = Join-Path $tempFilePath ("reaper" + $pkgver.Replace(".", "") + "_x64-install.exe") | ||
|
||
# Download and extract portable 7-zip | ||
Write-Host "Downloading and extracting portable 7-zip..." | ||
Download-File "https://github.com/chmaha/7-zip/raw/main/7zip.zip" (Join-Path $tempFilePath "7zip.zip") | ||
Extract-Archive (Join-Path $tempFilePath "7zip.zip") $sevenZipDir | ||
Remove-Item (Join-Path $tempFilePath "7zip.zip") | ||
|
||
# Construct the correct REAPER download URL based on system architecture | ||
if ($arch -eq "64-bit") { | ||
$reaperURL = "https://www.reaper.fm/files/$($pkgver.Split('.')[0]).x/reaper$($pkgver.Replace('.', ''))_x64-install.exe" | ||
} elseif ($arch -eq "ARM64") { | ||
$reaperURL = "https://www.reaper.fm/files/$($pkgver.Split('.')[0]).x/reaper$($pkgver.Replace('.', ''))_win11_arm64ec_beta-install.exe" | ||
} else { | ||
$reaperURL = "https://www.reaper.fm/files/$($pkgver.Split('.')[0]).x/reaper$($pkgver.Replace('.', ''))-install.exe" | ||
} | ||
|
||
Write-Host "Downloading REAPER $pkgver from reaper.fm..." | ||
Download-File $reaperURL $reaperExePath | ||
|
||
# Extract REAPER | ||
Write-Host "Extracting REAPER from .exe to $rcfolder folder..." | ||
& (Join-Path $sevenZipDir "7z.exe") x $reaperExePath "-o$rcfolder" | ||
|
||
# Download ReaClassical files from GitHub | ||
Write-Host "Downloading ReaClassical files from GitHub..." | ||
Download-File "https://github.com/chmaha/ReaClassical/raw/main/Resource%20Folder/Resource_Folder_Base.zip" (Join-Path $tempFilePath "Resource_Folder_Base.zip") | ||
Download-File "https://github.com/chmaha/ReaClassical/raw/main/Resource%20Folder/UserPlugins/UP_Windows-x64.zip" (Join-Path $tempFilePath "UP_Windows-x64.zip") | ||
|
||
# Extract ReaClassical files | ||
Write-Host "Extracting ReaClassical files to ReaClassical folder..." | ||
Extract-Archive (Join-Path $tempFilePath "Resource_Folder_Base.zip") $rcfolder | ||
Extract-Archive (Join-Path $tempFilePath "UP_Windows-x64.zip") (Join-Path $rcfolder "UserPlugins") | ||
|
||
# Add the line to reaper.ini under the [REAPER] section | ||
Write-Host "Adding theme and splash screen lines to reaper.ini under [REAPER] section" | ||
Add-LineToReaperIni $rcfolder | ||
|
||
# Fix Ctrl+backtick shortcut | ||
Write-Host "Fixing Ctrl+backtick reference in reaper-kb.ini" | ||
$filePath = Join-Path $rcfolder "reaper-kb.ini" | ||
Replace-KeyInFile $filePath | ||
|
||
# Remove temporary files | ||
Write-Host "Removing temporary files..." | ||
Remove-Item -Recurse -Force $tempFilePath | ||
|
||
Write-Host "Done!" | ||
|
||
# Wait for user input before exiting | ||
Read-Host "Press Enter to exit..." |