-
Notifications
You must be signed in to change notification settings - Fork 0
Fix/installer #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/installer #21
Changes from all commits
025f8b8
47138e3
e4128bb
0e7669d
da3e330
e6f3b6f
cbf1e3d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,63 @@ | ||
| @echo off | ||
| setlocal | ||
| powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0install.ps1" %* | ||
| exit /b %errorlevel% | ||
| :: | ||
| :: pichu installer bootstrap for Windows (CMD). | ||
| :: Delegates to install.ps1, either from a local copy or downloaded from GitHub. | ||
| :: | ||
| :: Configure via environment variables before running this script: | ||
| :: PICHU_ALIAS, PICHU_NO_MODIFY_PATH, PICHU_INSTALL_DIR, PICHU_VERSION | ||
| :: Or invoke install.ps1 directly from PowerShell to pass parameters. | ||
| :: | ||
| setlocal EnableExtensions DisableDelayedExpansion | ||
|
|
||
| :: ── UTF-8 code page ───────────────────────────────────────────────────────── | ||
| chcp 65001 > nul | ||
|
|
||
| :: ── Prefer a local copy of install.ps1 ────────────────────────────────────── | ||
| set "LOCAL_SCRIPT=%~dp0install.ps1" | ||
| if exist "%LOCAL_SCRIPT%" ( | ||
| powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass ^ | ||
| -File "%LOCAL_SCRIPT%" | ||
| exit /b %errorlevel% | ||
|
Comment on lines
+17
to
+20
|
||
| ) | ||
|
|
||
| :: ── Download to a temporary file ────────────────────────────────────────────── | ||
| for /f "usebackq delims=" %%T in ( | ||
| `powershell.exe -NoProfile -NonInteractive -Command "[System.IO.Path]::GetTempFileName()"` | ||
| ) do set "TEMP_BASE=%%T" | ||
|
|
||
| if not defined TEMP_BASE ( | ||
| echo error: Failed to allocate a temporary file. >&2 | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| del /f /q "%TEMP_BASE%" >nul 2>&1 | ||
| set "REMOTE_SCRIPT=%TEMP_BASE%.ps1" | ||
|
|
||
| :: ── Download ───────────────────────────────────────────────────────────────── | ||
| curl.exe --proto "=https" --tlsv1.2 -fsSL --max-filesize 1048576 ^ | ||
| "https://raw.githubusercontent.com/yeabwang/pichu/main/install.ps1" ^ | ||
| -o "%REMOTE_SCRIPT%" | ||
|
|
||
| if errorlevel 1 ( | ||
| echo error: Failed to download install.ps1. >&2 | ||
| del /f /q "%REMOTE_SCRIPT%" > nul 2>&1 | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| :: ── Verify downloaded file is non-empty ──────────────────────────────────────── | ||
| for %%A in ("%REMOTE_SCRIPT%") do if %%~zA EQU 0 ( | ||
| echo error: Downloaded install.ps1 is empty. >&2 | ||
| del /f /q "%REMOTE_SCRIPT%" > nul 2>&1 | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| :: ── Execute ─────────────────────────────────────────────────────────────────── | ||
| powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass ^ | ||
| -File "%REMOTE_SCRIPT%" | ||
|
Comment on lines
+55
to
+56
|
||
|
|
||
| set "PS_EXIT=%errorlevel%" | ||
|
|
||
| :: ── Cleanup ─────────────────────────────────────────────────────────────────── | ||
| del /f /q "%REMOTE_SCRIPT%" > nul 2>&1 | ||
|
|
||
| exit /b %PS_EXIT% | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changelog entry is grammatically incorrect and inconsistent with the style of the rest of the file. Consider: "Fixed one-line installer security issues." (capitalization + hyphenation, and no trailing period if following the existing bullet style).