Add install.ps1

This commit is contained in:
2026-01-01 03:05:44 +01:00
parent acdb737e4a
commit 946a80ff63
3 changed files with 97 additions and 16 deletions

View File

@@ -1,6 +1,13 @@
# How to install on macOS ## How to install on macOS
Open the Terminal, and run :
```bash ```bash
/bin/bash -c "$(curl -fsSL https://gitea.alixz.ovh/alixz/uwu2x/raw/branch/main/install.sh)" /bin/bash -c "$(curl -fsSL https://gitea.alixz.ovh/alixz/uwu2x/raw/branch/main/install.sh)"
``` ```
## How to install on Windows
Open the Powershell, and run :
```bash
irm https://gitea.alixz.ovh/alixz/uwu2x/raw/branch/main/install.ps1 | iex
```

73
install.ps1 Normal file
View File

@@ -0,0 +1,73 @@
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$EXT_NAME = "uwu2x-pro"
$EXT_VERSION = "8.7"
$ZIP_URL = "https://cloud.alixz.ovh/f/uwu2x-$EXT_VERSION-win.zip"
$TMP_DIR = New-Item -ItemType Directory -Path ([System.IO.Path]::GetTempPath()) -Name ([guid]::NewGuid())
$ZIP_PATH = Join-Path $TMP_DIR "uwu2x-$EXT_VERSION-win.zip"
$USER_EXT_DIR = "$env:APPDATA\Adobe\CEP\extensions"
$SYSTEM_EXT_DIR = "C:\Program Files (x86)\Common Files\Adobe\CEP\extensions"
$principal = New-Object Security.Principal.WindowsPrincipal(
[Security.Principal.WindowsIdentity]::GetCurrent()
)
if (-not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Host "Administrator permission is required to install this extension."
try {
Start-Process powershell `
-Verb runAs `
-ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`""
} catch {
Write-Host "Permission denied. Installation cancelled."
}
exit
}
if (Get-Process -Name "AfterFX" -ErrorAction SilentlyContinue) {
Write-Host "After Effects is currently running."
Write-Host "Please close it and run the installer again."
exit 1
}
Write-Host "Enabling Adobe CEP debug mode..."
foreach ($v in 14,13,12,11,10,9,8) {
$p = "HKCU:\Software\Adobe\CSXS.$v"
if (-not (Test-Path $p)) { New-Item -Path $p -Force | Out-Null }
New-ItemProperty -Path $p -Name PlayerDebugMode -Value 1 -PropertyType DWord -Force | Out-Null
}
Write-Host "Downloading extension..."
Invoke-WebRequest -Uri $ZIP_URL -OutFile $ZIP_PATH -UseBasicParsing
Write-Host "Extracting files..."
Expand-Archive -Path $ZIP_PATH -DestinationPath $TMP_DIR -Force
$SRC = Join-Path (Join-Path $TMP_DIR "uwu2x-$EXT_VERSION-win") $EXT_NAME
if (Test-Path $USER_EXT_DIR) {
$TARGET_DIR = $USER_EXT_DIR
} else {
if (-not (Test-Path $SYSTEM_EXT_DIR)) { New-Item -ItemType Directory -Path $SYSTEM_EXT_DIR -Force | Out-Null }
$TARGET_DIR = $SYSTEM_EXT_DIR
}
if (Test-Path "$USER_EXT_DIR\$EXT_NAME") {
Write-Host "Removing existing user installation."
Remove-Item -Recurse -Force "$USER_EXT_DIR\$EXT_NAME"
}
if (Test-Path "$SYSTEM_EXT_DIR\$EXT_NAME") {
Write-Host "Removing existing system installation"
Remove-Item -Recurse -Force "$SYSTEM_EXT_DIR\$EXT_NAME"
}
Write-Host "Installing extension..."
New-Item -ItemType Directory -Path $TARGET_DIR -Force | Out-Null
Copy-Item -Recurse -Force $SRC $TARGET_DIR
Remove-Item -Recurse -Force $TMP_DIR
Write-Host "Installation completed successfully."
Write-Host "You can now launch After Effects."

View File

@@ -6,6 +6,7 @@ EXT_NAME="uwu2x-pro"
EXT_VERSION="8.7" EXT_VERSION="8.7"
ZIP_URL="https://cloud.alixz.ovh/f/uwu2x-${EXT_VERSION}-mac.zip" ZIP_URL="https://cloud.alixz.ovh/f/uwu2x-${EXT_VERSION}-mac.zip"
TMP_DIR="$(mktemp -d)" TMP_DIR="$(mktemp -d)"
ZIP_PATH="$TMP_DIR/uwu2x-${EXT_VERSION}-mac.zip"
USER_EXT_DIR="$HOME/Library/Application Support/Adobe/CEP/extensions" USER_EXT_DIR="$HOME/Library/Application Support/Adobe/CEP/extensions"
SYSTEM_EXT_DIR="/Library/Application Support/Adobe/CEP/extensions" SYSTEM_EXT_DIR="/Library/Application Support/Adobe/CEP/extensions"
@@ -27,10 +28,10 @@ for v in 14 13 12 11 10 9 8; do
done done
echo "Downloading extension..." echo "Downloading extension..."
curl -fL -# "$ZIP_URL" -o "$TMP_DIR/uwu2x-${EXT_VERSION}-mac.zip" curl -fL -# "$ZIP_URL" -o "$ZIP_PATH"
echo "Extracting files..." echo "Extracting files..."
unzip -q "$TMP_DIR/uwu2x-${EXT_VERSION}-mac.zip" -d "$TMP_DIR" unzip -q "$ZIP_PATH" -d "$TMP_DIR"
cd "$TMP_DIR/uwu2x-${EXT_VERSION}-mac" cd "$TMP_DIR/uwu2x-${EXT_VERSION}-mac"
echo "Removing quarantine attributes..." echo "Removing quarantine attributes..."