summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWeicao-CatilGrass <1992414357@qq.com>2025-12-10 10:49:52 +0800
committerWeicao-CatilGrass <1992414357@qq.com>2025-12-10 10:49:52 +0800
commit1567bab16b1eeb8ddaf5a8cc09c71bdb0bedbda3 (patch)
treec5cc7c708207f3dae1b921c9d576d299a55be1b4
parent5fd3992ff8eea62967288c639985bfe60b9a171b (diff)
Add Windows installer and export scripts
- Add Inno Setup configuration for Windows installer - Add PowerShell scripts for installation and uninstallation - Create Windows-specific export script - Update existing export script to suppress build output - Include application icon for installer
-rw-r--r--docs/images/Yizi.icobin0 -> 270622 bytes
-rw-r--r--export.ps113
-rwxr-xr-xexport.sh4
-rw-r--r--setup/windows/inst.ps18
-rw-r--r--setup/windows/setup_jv_cli.iss42
-rw-r--r--setup/windows/uninst.ps139
6 files changed, 105 insertions, 1 deletions
diff --git a/docs/images/Yizi.ico b/docs/images/Yizi.ico
new file mode 100644
index 0000000..24a2d00
--- /dev/null
+++ b/docs/images/Yizi.ico
Binary files differ
diff --git a/export.ps1 b/export.ps1
new file mode 100644
index 0000000..d24c37e
--- /dev/null
+++ b/export.ps1
@@ -0,0 +1,13 @@
+# Require : Cargo (Rust), ISCC (Inno Setup)
+
+# Build
+cargo build --workspace --release
+if ($LASTEXITCODE -ne 0) {
+ # Build failed
+} else {
+ # Build succeeded
+ # Export
+ if (cargo run --manifest-path crates/build_helper/Cargo.toml --bin exporter) {
+ ISCC /Q .\setup\windows\setup_jv_cli.iss
+ }
+}
diff --git a/export.sh b/export.sh
index 5428107..52215ba 100755
--- a/export.sh
+++ b/export.sh
@@ -1,7 +1,9 @@
#!/bin/bash
+# Require : Cargo (Rust)
+
# Build
-if cargo build --workspace --release; then
+if cargo build --workspace --release >/dev/null 2>&1; then
# Export
cargo run --manifest-path crates/build_helper/Cargo.toml --bin exporter
fi
diff --git a/setup/windows/inst.ps1 b/setup/windows/inst.ps1
new file mode 100644
index 0000000..2e15dc3
--- /dev/null
+++ b/setup/windows/inst.ps1
@@ -0,0 +1,8 @@
+. ".\uninst.ps1"
+
+$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
+
+$parentDir = Split-Path -Parent $scriptDir
+Add-Content -Path $PROFILE -Value "`n# JustEnoughVCS - Begin #"
+Add-Content -Path $PROFILE -Value ". `"$parentDir\jv_cli.ps1`""
+Add-Content -Path $PROFILE -Value "# JustEnoughVCS - End #"
diff --git a/setup/windows/setup_jv_cli.iss b/setup/windows/setup_jv_cli.iss
new file mode 100644
index 0000000..24b2a32
--- /dev/null
+++ b/setup/windows/setup_jv_cli.iss
@@ -0,0 +1,42 @@
+#define MyAppName "JustEnoughVCS"
+#define MyAppVersion "0.1.0"
+#define MyAppPublisher "JustEnoughVCS Team"
+#define MyAppURL "https://jvcs.cc/"
+
+[Setup]
+AppId={{8265DF21-F290-487E-9403-C2730EC31A03}
+AppName={#MyAppName}
+AppVersion={#MyAppVersion}
+AppPublisher={#MyAppPublisher}
+AppPublisherURL={#MyAppURL}
+AppSupportURL={#MyAppURL}
+AppUpdatesURL={#MyAppURL}
+DefaultDirName={autopf}\{#MyAppName}
+DefaultGroupName={#MyAppName}
+AllowNoIcons=yes
+LicenseFile=..\..\LICENSE
+PrivilegesRequired=lowest
+OutputDir=..\..\export\setup
+OutputBaseFilename=JustEnoughVCS For Windows
+SetupIconFile=..\..\docs\images\Yizi.ico
+SolidCompression=yes
+WizardStyle=modern dynamic
+
+[Languages]
+Name: "english"; MessagesFile: "compiler:Default.isl"
+
+[Files]
+Source: "..\..\export\*"; Excludes: "setup"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
+Source: "inst.ps1"; DestDir: "{app}\scripts\"; Flags: ignoreversion
+Source: "uninst.ps1"; DestDir: "{app}\scripts\"; Flags: ignoreversion
+
+[Run]
+Filename: "powershell.exe"; Parameters: "-ExecutionPolicy Bypass -File ""{app}\scripts\inst.ps1"""; Flags: runhidden; Description: "Running post-installation script..."; StatusMsg: "Running post-installation script..."; AfterInstall: RunPostInstall
+
+[UninstallRun]
+Filename: "powershell.exe"; Parameters: "-ExecutionPolicy Bypass -File ""{app}\scripts\uninst.ps1"""; Flags: runhidden; RunOnceId: "UninstallScript"
+
+[Code]
+procedure RunPostInstall;
+begin
+end;
diff --git a/setup/windows/uninst.ps1 b/setup/windows/uninst.ps1
new file mode 100644
index 0000000..d5c898d
--- /dev/null
+++ b/setup/windows/uninst.ps1
@@ -0,0 +1,39 @@
+$profileContent = Get-Content $PROFILE -ErrorAction SilentlyContinue
+if ($profileContent) {
+ $startMarker = "# JustEnoughVCS - Begin #"
+ $endMarker = "# JustEnoughVCS - End #"
+ $newContent = @()
+ $insideBlock = $false
+ $foundStart = $false
+
+ foreach ($line in $profileContent) {
+ if ($line.Trim() -eq $startMarker) {
+ $insideBlock = $true
+ $foundStart = $true
+ continue
+ }
+ if ($line.Trim() -eq $endMarker) {
+ $insideBlock = $false
+ continue
+ }
+ if (-not $insideBlock) {
+ $newContent += $line
+ }
+ }
+
+ if ($foundStart -and $insideBlock) {
+ $newContent = @()
+ $insideBlock = $false
+ foreach ($line in $profileContent) {
+ if ($line.Trim() -eq $startMarker) {
+ $insideBlock = $true
+ continue
+ }
+ if (-not $insideBlock) {
+ $newContent += $line
+ }
+ }
+ }
+
+ $newContent | Set-Content $PROFILE
+}