mirror of
https://github.com/pepaskopec-blip/Graduately.git
synced 2026-10-27 15:14:35 +00:00
Each installer carries no application of its own and resolves /releases/latest/download/ at the moment it runs, so the file never goes stale and the same download keeps working across future releases. macOS installs into /Applications, falling back to the user's own folder when that is not writable, and clears the quarantine flag the unsigned build would otherwise trip over. Windows extracts over any existing install rather than replacing the folder, so the progress files kept inside it survive, and adds a Start menu entry. Linux drops the AppImage in ~/Applications with a desktop entry and its icon. Publish the macOS one zipped, because a release asset loses its executable bit and a .command needs one to be double-clicked. The .cmd also had to be excluded from the *.cmd ignore rule, which comes from the kernel section of the template and targets build artifacts. Co-authored-by: Cursor <cursoragent@cursor.com>
80 lines
2.3 KiB
Batchfile
80 lines
2.3 KiB
Batchfile
@echo off
|
|
rem maturita.c installer for Windows.
|
|
rem
|
|
rem Carries no application of its own: it downloads whatever the newest release
|
|
rem is at the moment you run it, so this file never goes stale. GitHub resolves
|
|
rem the /releases/latest/download/ path to the current tag on every request.
|
|
rem
|
|
rem Double-click the file to run it. The app updates itself from then on.
|
|
|
|
setlocal
|
|
set "REPO=pepaskopec-blip/maturita.c"
|
|
set "ASSET=maturita-windows-x64.zip"
|
|
set "URL=https://github.com/%REPO%/releases/latest/download/%ASSET%"
|
|
set "DEST=%LOCALAPPDATA%\Programs\Maturita"
|
|
|
|
echo Installing maturita.C
|
|
echo ---------------------
|
|
|
|
rem curl and tar both ship with Windows 10 1803 and later.
|
|
where curl >nul 2>&1 || goto :no_tools
|
|
where tar >nul 2>&1 || goto :no_tools
|
|
|
|
set "TMP_DIR=%TEMP%\maturita-installer"
|
|
rmdir /s /q "%TMP_DIR%" 2>nul
|
|
mkdir "%TMP_DIR%" || goto :fail_tmp
|
|
|
|
echo Downloading the latest release...
|
|
curl -fL --progress-bar -o "%TMP_DIR%\%ASSET%" "%URL%" || goto :fail_download
|
|
|
|
echo Installing to %DEST%
|
|
if not exist "%DEST%" mkdir "%DEST%" || goto :fail_dest
|
|
|
|
rem Extracted over any existing install rather than replacing the folder, so
|
|
rem the progress files kept inside it survive an upgrade.
|
|
tar -xf "%TMP_DIR%\%ASSET%" -C "%DEST%" || goto :fail_extract
|
|
|
|
rem Start menu entry, so the app can be found without digging for the folder.
|
|
set "LNK=%APPDATA%\Microsoft\Windows\Start Menu\Programs\maturita.C.lnk"
|
|
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
|
|
"$s=(New-Object -ComObject WScript.Shell).CreateShortcut('%LNK%');" ^
|
|
"$s.TargetPath='%DEST%\maturita.exe';$s.WorkingDirectory='%DEST%';$s.Save()" >nul 2>&1
|
|
|
|
rmdir /s /q "%TMP_DIR%" 2>nul
|
|
|
|
echo.
|
|
echo Done. Starting the app...
|
|
start "" "%DEST%\maturita.exe"
|
|
exit /b 0
|
|
|
|
:no_tools
|
|
echo.
|
|
echo Error: this installer needs curl and tar, which come with Windows 10
|
|
echo version 1803 and later. Please update Windows, or download the zip
|
|
echo manually from https://github.com/%REPO%/releases/latest
|
|
pause
|
|
exit /b 1
|
|
|
|
:fail_tmp
|
|
echo.
|
|
echo Error: could not create a temporary folder in %TEMP%.
|
|
pause
|
|
exit /b 1
|
|
|
|
:fail_download
|
|
echo.
|
|
echo Error: the download failed. Check your internet connection.
|
|
pause
|
|
exit /b 1
|
|
|
|
:fail_dest
|
|
echo.
|
|
echo Error: could not create %DEST%.
|
|
pause
|
|
exit /b 1
|
|
|
|
:fail_extract
|
|
echo.
|
|
echo Error: the archive could not be unpacked.
|
|
pause
|
|
exit /b 1
|