-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
11b5adc
commit 3ffde40
Showing
2 changed files
with
93 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,53 @@ | ||
# Variables | ||
$installDir = "$HOME\.skidfuscator" | ||
$wrapperDir = "$HOME\AppData\Local\Microsoft\WindowsApps" | ||
$wrapperPath = "$wrapperDir\skidfuscator.bat" | ||
$repo = "skidfuscatordev/skidfuscator-java-obfuscator" | ||
$jarName = "skidfuscator.jar" | ||
|
||
# Check for Java | ||
if (-not (Get-Command java -ErrorAction SilentlyContinue)) { | ||
Write-Host "Java is required but not installed. Install Java and try again." -ForegroundColor Red | ||
Exit 1 | ||
} | ||
|
||
# Fetch the latest release URL | ||
Write-Host "Fetching the latest Skidfuscator release..." | ||
$releaseData = Invoke-RestMethod -Uri "https://api.github.com/repos/$repo/releases/latest" | ||
$releaseUrl = $releaseData.assets | Where-Object { $_.name -eq $jarName } | Select-Object -ExpandProperty browser_download_url | ||
|
||
if (-not $releaseUrl) { | ||
Write-Host "Failed to find the latest release. Ensure the repository and asset names are correct." -ForegroundColor Red | ||
Exit 1 | ||
} | ||
|
||
# Create install directory | ||
Write-Host "Installing Skidfuscator to $installDir..." | ||
if (-not (Test-Path -Path $installDir)) { | ||
New-Item -ItemType Directory -Path $installDir | Out-Null | ||
} | ||
Invoke-WebRequest -Uri $releaseUrl -OutFile "$installDir\$jarName" | ||
|
||
# Create wrapper script | ||
Write-Host "Creating wrapper script at $wrapperPath..." | ||
if (-not (Test-Path -Path $wrapperDir)) { | ||
New-Item -ItemType Directory -Path $wrapperDir | Out-Null | ||
} | ||
$wrapperContent = @" | ||
@echo off | ||
java -jar $installDir\$jarName %* | ||
"@ | ||
Set-Content -Path $wrapperPath -Value $wrapperContent -Encoding ASCII | ||
|
||
# Add wrapper directory to PATH | ||
Write-Host "Ensuring $wrapperDir is in the system PATH..." | ||
$envPath = [System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::User) | ||
if (-not $envPath -like "*$wrapperDir*") { | ||
Write-Host "Adding $wrapperDir to PATH..." | ||
[System.Environment]::SetEnvironmentVariable("Path", "$envPath;$wrapperDir", [System.EnvironmentVariableTarget]::User) | ||
} else { | ||
Write-Host "$wrapperDir is already in PATH." | ||
} | ||
|
||
Write-Host "Installation complete. Restart your terminal or run 'refreshenv' to update your PATH." | ||
Write-Host "Run 'skidfuscator --help' to get started." -ForegroundColor Green |
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,40 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
# Constants | ||
INSTALL_DIR="${HOME}/.skidfuscator" | ||
WRAPPER_PATH="/usr/local/bin/skidfuscator" | ||
REPO="skidfuscatordev/skidfuscator-java-obfuscator" | ||
JAR_NAME="skidfuscator.jar" | ||
|
||
# Check for Java | ||
if ! command -v java &> /dev/null; then | ||
echo "Java is required but not installed. Install it and try again." | ||
exit 1 | ||
fi | ||
|
||
# Fetch the latest release URL | ||
echo "Fetching the latest Skidfuscator release..." | ||
RELEASE_URL=$(curl -s "https://api.github.com/repos/${REPO}/releases/latest" | jq -r ".assets[] | select(.name == \"${JAR_NAME}\") | .browser_download_url") | ||
|
||
if [[ -z "$RELEASE_URL" ]]; then | ||
echo "Failed to find the latest release. Ensure the repository and asset names are correct." | ||
exit 1 | ||
fi | ||
|
||
# Create install directory | ||
echo "Installing Skidfuscator to ${INSTALL_DIR}..." | ||
mkdir -p "${INSTALL_DIR}" | ||
curl -L "${RELEASE_URL}" -o "${INSTALL_DIR}/${JAR_NAME}" | ||
|
||
# Create wrapper script | ||
echo "Creating wrapper script at ${WRAPPER_PATH}..." | ||
sudo bash -c "cat << 'EOF' > ${WRAPPER_PATH} | ||
#!/usr/bin/env bash | ||
java -jar ${INSTALL_DIR}/${JAR_NAME} "\$@" | ||
EOF" | ||
|
||
sudo chmod +x "${WRAPPER_PATH}" | ||
|
||
echo "Installation complete. Run 'skidfuscator --help' to get started." |