Skip to content

Commit aefe628

Browse files
committed
STAR CLI Installers
1 parent b969fde commit aefe628

13 files changed

Lines changed: 402 additions & 0 deletions

File tree

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# STAR CLI – Platform-specific installers (Option 3)
2+
3+
This folder contains scripts to build **native installers** for Windows, macOS, and Linux. Run the scripts on (or for) each platform to produce installable packages.
4+
5+
| Platform | Location | What you get |
6+
|----------|----------|----------------|
7+
| **Windows** | `windows/` | **Inno Setup** EXE installer: adds `star.exe` to Program Files and optionally to system PATH. |
8+
| **macOS** | `macos/` | **.pkg** installer: installs `star` to `/usr/local/bin`. |
9+
| **Linux** | `linux/` | **.deb** and **.rpm** packages (via **fpm**): install `star` to `/usr/local/bin`. |
10+
11+
All scripts publish the STAR CLI (single-file, self-contained) for the target platform first, then build the installer. Output goes to `publish/installers/` (and for Windows, the Inno script also expects publish output under `publish/win-x64/`).
12+
13+
**DNA folder rule:** Wherever `star` (or `star.exe`) is installed, a **DNA** folder must sit next to it with config/default JSON files. Only **JSON** files are included (no `.cs` or other source). This is enforced in `NextGenSoftware.OASIS.STAR.CLI.csproj` (Content: `DNA\**\*.json`); all installers copy the DNA folder from that publish output.
14+
15+
---
16+
17+
## Quick start
18+
19+
### Windows (run on Windows)
20+
21+
1. Install [Inno Setup 6](https://jrsoftware.org/isinfo.php) (optional; if missing, only the binary is published).
22+
2. Run:
23+
```bat
24+
installers\windows\build-installer.bat
25+
```
26+
Or from PowerShell: `.\installers\windows\build-installer.ps1`
27+
3. Installer: `publish\installers\star-cli-1.0.0-win-x64.exe`
28+
29+
### macOS (run on macOS)
30+
31+
1. In Terminal:
32+
```bash
33+
chmod +x installers/macos/build-installer.sh
34+
./installers/macos/build-installer.sh
35+
```
36+
2. Installer: `publish/installers/star-cli-1.0.0-osx-arm64.pkg` (or `osx-x64` on Intel). Double-click to install.
37+
38+
### Linux (run on Linux)
39+
40+
1. Install **fpm**: `gem install fpm`
41+
2. Run:
42+
```bash
43+
chmod +x installers/linux/build-installer.sh
44+
./installers/linux/build-installer.sh
45+
```
46+
3. Packages: `publish/installers/star-cli_1.0.0_amd64.deb` and `star-cli-1.0.0-1.x86_64.rpm`
47+
Install: `sudo dpkg -i star-cli_1.0.0_amd64.deb` or `sudo rpm -i star-cli-1.0.0-1.x86_64.rpm`
48+
49+
---
50+
51+
## Prerequisites
52+
53+
- **All:** .NET 8 SDK.
54+
- **Windows:** Inno Setup 6 (optional) for the EXE installer.
55+
- **macOS:** None beyond .NET 8 (uses built-in `pkgbuild`).
56+
- **Linux:** Ruby and **fpm** (`gem install fpm`) for .deb/.rpm; `rpm` for RPM builds.
57+
58+
See each platform’s subfolder for more detail (e.g. `windows/`, `macos/README.md`, `linux/README.md`).
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Linux installers
2+
3+
- **Build (on Linux):** `./build-installer.sh` — publishes linux-x64 and builds .deb + .rpm in `publish/installers/`.
4+
- **Build for ARM64:** `./build-installer.sh linux-arm64`.
5+
- **Prerequisites:** .NET 8 SDK, Ruby, and **fpm** (`gem install fpm`). For .rpm building, `rpm` must be installed.
6+
7+
**Install (after building):**
8+
- Debian/Ubuntu: `sudo dpkg -i publish/installers/star-cli_1.0.0_amd64.deb`
9+
- RHEL/Fedora: `sudo rpm -i publish/installers/star-cli-1.0.0-1.x86_64.rpm`
10+
11+
Without fpm, the script still publishes the binary; you can copy `publish/linux-x64/star` to `/usr/local/bin` manually.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/usr/bin/env bash
2+
# Build Linux .deb (and optionally .rpm) for STAR CLI.
3+
# Prerequisites: .NET 8 SDK; fpm (gem install fpm).
4+
# Usage: ./build-installer.sh [linux-x64|linux-arm64] (default: linux-x64)
5+
6+
set -e
7+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8+
PROJECT_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
9+
PUBLISH_DIR="$PROJECT_DIR/publish"
10+
INSTALLER_OUT="$PUBLISH_DIR/installers"
11+
VERSION="${VERSION:-1.0.0}"
12+
ARCH="${1:-linux-x64}"
13+
14+
mkdir -p "$INSTALLER_OUT"
15+
16+
if [ ! -d "$PUBLISH_DIR/$ARCH" ] || [ ! -f "$PUBLISH_DIR/$ARCH/star" ]; then
17+
echo "Publishing $ARCH..."
18+
dotnet publish "$PROJECT_DIR/NextGenSoftware.OASIS.STAR.CLI.csproj" \
19+
-c Release -r "$ARCH" \
20+
-p:PublishSingleFile=true -p:SelfContained=true \
21+
-o "$PUBLISH_DIR/$ARCH"
22+
fi
23+
24+
STAR_BIN="$PUBLISH_DIR/$ARCH/star"
25+
if [ ! -f "$STAR_BIN" ]; then
26+
echo "Error: $STAR_BIN not found." >&2
27+
exit 1
28+
fi
29+
30+
# Map RID to deb/rpm architecture names
31+
DEB_ARCH="$ARCH"
32+
case "$ARCH" in
33+
linux-x64) DEB_ARCH="amd64"; RPM_ARCH="x86_64" ;;
34+
linux-arm64) DEB_ARCH="arm64"; RPM_ARCH="aarch64" ;;
35+
*) RPM_ARCH="$ARCH" ;;
36+
esac
37+
38+
# Stage: star in /usr/local/bin; DNA folder (JSON only) next to it (same rule as Windows/macOS)
39+
PKG_ROOT="$INSTALLER_OUT/pkgroot"
40+
rm -rf "$PKG_ROOT"
41+
mkdir -p "$PKG_ROOT/usr/local/bin"
42+
cp "$STAR_BIN" "$PKG_ROOT/usr/local/bin/star"
43+
chmod 755 "$PKG_ROOT/usr/local/bin/star"
44+
if [ -d "$PUBLISH_DIR/$ARCH/DNA" ]; then
45+
cp -R "$PUBLISH_DIR/$ARCH/DNA" "$PKG_ROOT/usr/local/bin/"
46+
fi
47+
48+
# .deb and .rpm (requires fpm: gem install fpm)
49+
if command -v fpm >/dev/null 2>&1; then
50+
( cd "$PKG_ROOT" && fpm -s dir -t deb \
51+
-n star-cli \
52+
-v "$VERSION" \
53+
-a "$DEB_ARCH" \
54+
-p "$INSTALLER_OUT/star-cli_${VERSION}_${DEB_ARCH}.deb" \
55+
--description "OASIS STAR CLI - command-line development tools and low/no-code generator" \
56+
--url "https://github.com/NextGenSoftware/OASIS" \
57+
--vendor "NextGen Software" \
58+
usr )
59+
echo "Debian package: $INSTALLER_OUT/star-cli_${VERSION}_${DEB_ARCH}.deb"
60+
61+
( cd "$PKG_ROOT" && fpm -s dir -t rpm \
62+
-n star-cli \
63+
-v "$VERSION" \
64+
-a "$RPM_ARCH" \
65+
-p "$INSTALLER_OUT/star-cli-${VERSION}-1.${RPM_ARCH}.rpm" \
66+
--description "OASIS STAR CLI - command-line development tools and low/no-code generator" \
67+
--url "https://github.com/NextGenSoftware/OASIS" \
68+
--vendor "NextGen Software" \
69+
usr )
70+
echo "RPM package: $INSTALLER_OUT/star-cli-${VERSION}-1.${RPM_ARCH}.rpm"
71+
else
72+
echo "fpm not found. Install with: gem install fpm"
73+
echo "Staged files are in $PKG_ROOT (usr/local/bin/star). Package manually or install with: sudo cp $PKG_ROOT/usr/local/bin/star /usr/local/bin/"
74+
fi
75+
76+
rm -rf "$PKG_ROOT"
77+
echo "Done."
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# macOS installer
2+
3+
- **Build (on macOS):** `./build-installer.sh` — builds for current architecture (arm64 or x64).
4+
- **Build for a specific arch:** `./build-installer.sh osx-arm64` or `./build-installer.sh osx-x64`.
5+
- **Output:** `publish/installers/star-cli-1.0.0-osx-arm64.pkg` (or osx-x64). Double-click to install; `star` is placed in `/usr/local/bin`.
6+
7+
For a DMG wrapper, use [create-dmg](https://github.com/create-dmg/create-dmg) or similar after building the .pkg.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/usr/bin/env bash
2+
# Build macOS installer (.pkg) for STAR CLI.
3+
# Prerequisites: .NET 8 SDK. Run on macOS (or cross-publish from Windows then run this on macOS).
4+
# Usage: ./build-installer.sh [osx-x64|osx-arm64] (default: detect current arch and build)
5+
6+
set -e
7+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8+
PROJECT_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
9+
PUBLISH_DIR="$PROJECT_DIR/publish"
10+
INSTALLER_OUT="$PUBLISH_DIR/installers"
11+
VERSION="${VERSION:-1.0.0}"
12+
ARCH="${1:-}"
13+
14+
mkdir -p "$INSTALLER_OUT"
15+
16+
if [ -z "$ARCH" ]; then
17+
ARCH=$(uname -m)
18+
if [ "$ARCH" = "arm64" ]; then
19+
ARCH="osx-arm64"
20+
else
21+
ARCH="osx-x64"
22+
fi
23+
fi
24+
25+
if [ ! -d "$PUBLISH_DIR/$ARCH" ] || [ ! -f "$PUBLISH_DIR/$ARCH/star" ]; then
26+
echo "Publishing $ARCH..."
27+
dotnet publish "$PROJECT_DIR/NextGenSoftware.OASIS.STAR.CLI.csproj" \
28+
-c Release -r "$ARCH" \
29+
-p:PublishSingleFile=true -p:SelfContained=true \
30+
-o "$PUBLISH_DIR/$ARCH"
31+
fi
32+
33+
STAR_BIN="$PUBLISH_DIR/$ARCH/star"
34+
if [ ! -f "$STAR_BIN" ]; then
35+
echo "Error: $STAR_BIN not found." >&2
36+
exit 1
37+
fi
38+
39+
# Stage: star in /usr/local/bin; DNA folder (JSON only) next to it (same rule as Windows/Linux)
40+
PKG_ROOT="$INSTALLER_OUT/pkgroot"
41+
rm -rf "$PKG_ROOT"
42+
mkdir -p "$PKG_ROOT/usr/local/bin"
43+
cp "$STAR_BIN" "$PKG_ROOT/usr/local/bin/star"
44+
chmod 755 "$PKG_ROOT/usr/local/bin/star"
45+
if [ -d "$PUBLISH_DIR/$ARCH/DNA" ]; then
46+
cp -R "$PUBLISH_DIR/$ARCH/DNA" "$PKG_ROOT/usr/local/bin/"
47+
fi
48+
49+
# Build .pkg (flat package)
50+
OUTPUT_PKG="$INSTALLER_OUT/star-cli-${VERSION}-${ARCH}.pkg"
51+
pkgbuild --root "$PKG_ROOT" \
52+
--identifier com.oasis.star.cli \
53+
--version "$VERSION" \
54+
--install-location / \
55+
"$OUTPUT_PKG"
56+
57+
rm -rf "$PKG_ROOT"
58+
echo "Installer: $OUTPUT_PKG"
59+
echo "Done."
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Windows installer (Inno Setup)
2+
3+
- **Build:** Run `build-installer.bat` or `build-installer.ps1` from the STAR CLI project directory. This publishes `win-x64` and, if Inno Setup 6 is installed, produces an EXE installer.
4+
- **Prerequisites:** .NET 8 SDK; [Inno Setup 6](https://jrsoftware.org/isinfo.php) (optional; if missing, only the binary is published to `publish/win-x64/`).
5+
- **Output:** `publish/installers/star-cli-1.0.0-win-x64.exe`. The installer installs to `Program Files\OASIS STAR CLI` and can add it to the system PATH.
6+
7+
To change the version, edit the `#define MyAppVersion` line in `star-cli.iss` (and/or pass version from the build script in a future update).
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@echo off
2+
setlocal
3+
set "SCRIPT_DIR=%~dp0"
4+
powershell -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_DIR%build-installer.ps1"
5+
exit /b %ERRORLEVEL%
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Build Windows installer for STAR CLI (Inno Setup).
2+
# Prerequisites:
3+
# 1. .NET 8 SDK
4+
# 2. Inno Setup 6 (https://jrsoftware.org/isinfo.php) - optional; if not installed, only publish step runs.
5+
# Run from: STAR ODK\NextGenSoftware.OASIS.STAR.CLI (or repo root).
6+
7+
$ErrorActionPreference = "Stop"
8+
$ScriptDir = if ($PSScriptRoot) { $PSScriptRoot } else { "." }
9+
$ProjectDir = Resolve-Path (Join-Path $ScriptDir "..\..")
10+
$PublishDir = Join-Path $ProjectDir "publish"
11+
$WinPublishDir = Join-Path $PublishDir "win-x64"
12+
$InstallerOutputDir = Join-Path $PublishDir "installers"
13+
14+
# 1. Publish win-x64 single-file executable
15+
Write-Host "Publishing STAR CLI for win-x64..." -ForegroundColor Cyan
16+
Push-Location $ProjectDir
17+
try {
18+
dotnet publish (Join-Path $ProjectDir "NextGenSoftware.OASIS.STAR.CLI.csproj") `
19+
-c Release `
20+
-r win-x64 `
21+
-p:PublishSingleFile=true `
22+
-p:SelfContained=true `
23+
-o $WinPublishDir
24+
if ($LASTEXITCODE -ne 0) { throw "dotnet publish failed" }
25+
} finally {
26+
Pop-Location
27+
}
28+
29+
if (-not (Test-Path (Join-Path $WinPublishDir "star.exe"))) {
30+
throw "Publish did not produce star.exe in $WinPublishDir"
31+
}
32+
33+
# 2. Compile Inno Setup script if ISCC is available
34+
$iscc = $null
35+
$paths = @(
36+
"${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe",
37+
"${env:ProgramFiles}\Inno Setup 6\ISCC.exe",
38+
"${env:ProgramFiles(x86)}\Inno Setup 5\ISCC.exe"
39+
)
40+
foreach ($p in $paths) {
41+
if (Test-Path $p) { $iscc = $p; break }
42+
}
43+
44+
if ($iscc) {
45+
Write-Host "Building installer with Inno Setup..." -ForegroundColor Cyan
46+
New-Item -ItemType Directory -Force -Path $InstallerOutputDir | Out-Null
47+
& $iscc (Join-Path $ScriptDir "star-cli.iss")
48+
if ($LASTEXITCODE -ne 0) { throw "Inno Setup compilation failed" }
49+
Write-Host "Installer created in: $InstallerOutputDir" -ForegroundColor Green
50+
} else {
51+
Write-Host "Inno Setup not found. Install from https://jrsoftware.org/isinfo.php and re-run, or use: $WinPublishDir\star.exe" -ForegroundColor Yellow
52+
}
53+
54+
Write-Host "Done." -ForegroundColor Green
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
; Inno Setup script for OASIS STAR CLI (Windows)
2+
; Build: Run publish-crossplatform.ps1 first, then compile this script with Inno Setup.
3+
; Requires: Inno Setup 6 (https://jrsoftware.org/isinfo.php)
4+
5+
#define MyAppName "OASIS STAR CLI"
6+
#define MyAppId "OASIS.STAR.CLI"
7+
#define MyAppVersion "3.4.0"
8+
#define MyAppPublisher "NextGen Software Ltd"
9+
#define MyAppURL "https://github.com/NextGenSoftware/OASIS"
10+
#define MyAppExe "star.exe"
11+
; Publish output relative to this script (installers\windows): project dir is ..\..\
12+
#define PublishDir "..\..\publish\win-x64"
13+
14+
[Setup]
15+
AppId={#MyAppId}
16+
AppName={#MyAppName}
17+
AppVersion={#MyAppVersion}
18+
AppPublisher={#MyAppPublisher}
19+
AppPublisherURL={#MyAppURL}
20+
AppSupportURL={#MyAppURL}
21+
AppUpdatesURL={#MyAppURL}
22+
DefaultDirName={autopf}\OASIS STAR CLI
23+
DefaultGroupName=OASIS STAR CLI
24+
DisableProgramGroupPage=yes
25+
; Add install dir to system PATH so "star" works from any terminal
26+
ChangesEnvironment=yes
27+
OutputDir=..\..\publish\installers
28+
OutputBaseFilename=star-cli-{#MyAppVersion}-win-x64
29+
SetupIconFile=
30+
Compression=lzma2/ultra64
31+
SolidCompression=yes
32+
WizardStyle=modern
33+
PrivilegesRequired=admin
34+
ArchitecturesAllowed=x64 arm64
35+
ArchitecturesInstallIn64BitMode=x64 arm64
36+
37+
[Languages]
38+
Name: "english"; MessagesFile: "compiler:Default.isl"
39+
40+
[Tasks]
41+
Name: "addpath"; Description: "Add STAR CLI to system PATH"; GroupDescription: "Options:"
42+
43+
[Files]
44+
Source: "{#PublishDir}\{#MyAppExe}"; DestDir: "{app}"; Flags: ignoreversion
45+
; DNA folder next to star.exe (only JSON files; populated at publish by CLI csproj)
46+
Source: "{#PublishDir}\DNA\*"; DestDir: "{app}\DNA"; Flags: ignoreversion recursesubdirs createallsubdirs skipifsourcedoesntexist
47+
48+
[Registry]
49+
; Add install dir to PATH (only if task selected). Uses {olddata} to append.
50+
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}"; Tasks: addpath
51+
; Note: Uninstall does not remove from PATH (safe; user can edit PATH if needed).
52+
53+
[Icons]
54+
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExe}"; Comment: "OASIS STAR CLI"
55+
Name: "{group}\Uninstall {#MyAppName}"; Filename: "{uninstallexe}"
Binary file not shown.

0 commit comments

Comments
 (0)