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
/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,50 +6,51 @@ EXT_NAME="uwu2x-pro"
EXT_VERSION="8.7"
ZIP_URL="https://cloud.alixz.ovh/f/uwu2x-${EXT_VERSION}-mac.zip"
TMP_DIR="$(mktemp -d)"
ZIP_PATH="$TMP_DIR/uwu2x-${EXT_VERSION}-mac.zip"
USER_EXT_DIR="$HOME/Library/Application Support/Adobe/CEP/extensions"
SYSTEM_EXT_DIR="/Library/Application Support/Adobe/CEP/extensions"
echo "Administrator permission is required to install this extension."
if ! sudo -v; then
echo "Permission denied. Installation cancelled."
exit 1
echo "Permission denied. Installation cancelled."
exit 1
fi
if pgrep -x "After Effects" >/dev/null; then
echo "After Effects is currently running."
echo "Please close it and run the installer again."
exit 1
echo "After Effects is currently running."
echo "Please close it and run the installer again."
exit 1
fi
echo "Enabling Adobe CEP debug mode..."
for v in 14 13 12 11 10 9 8; do
defaults write "com.adobe.CSXS.$v" PlayerDebugMode 1 || true
defaults write "com.adobe.CSXS.$v" PlayerDebugMode 1 || true
done
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..."
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"
echo "Removing quarantine attributes..."
sudo xattr -cr "$EXT_NAME"
if [ -d "$USER_EXT_DIR" ]; then
TARGET_DIR="$USER_EXT_DIR"
TARGET_DIR="$USER_EXT_DIR"
else
TARGET_DIR="$SYSTEM_EXT_DIR"
TARGET_DIR="$SYSTEM_EXT_DIR"
fi
if [ -d "$USER_EXT_DIR/$EXT_NAME" ]; then
echo "Removing existing user installation."
sudo rm -rf "$USER_EXT_DIR/$EXT_NAME"
echo "Removing existing user installation."
sudo rm -rf "$USER_EXT_DIR/$EXT_NAME"
fi
if [ -d "$SYSTEM_EXT_DIR/$EXT_NAME" ]; then
echo "Removing existing system installation"
sudo rm -rf "$SYSTEM_EXT_DIR/$EXT_NAME"
echo "Removing existing system installation"
sudo rm -rf "$SYSTEM_EXT_DIR/$EXT_NAME"
fi
echo "Installing extension..."