# cspkg — company package client :id=top

------

> _Doc Ver:_ 1.7  
_App Ver:_ 2.6.6.53  
_Date:_ 09/10/2026

------

> Cross-platform single binary: discover company packages, pick LAN/Internet source by latency, download and verify, then **delegate to the product engine**. The SA1 engine is `sa1-upgrader`. **Not** a second upgrade engine and **not** a new package format.

Artifacts live in GitLab **`casstk/cspkg`** Generic Package (peer of `casstk/sa2`), not inside the SA1 tar.

Full product help: [cspkg quickstart](http://192.168.3.9/sa2/help/reader.html#/cspkg-quickstart) · [cspkg detail](http://192.168.3.9/sa2/help/reader.html#/cspkg)  
Terminal: `cspkg help`, `cspkg <command> -h` (command tree aligned with pip / npm).

------

## 1. Install the client

The script auto-detects Linux / macOS / Windows and arch, probing LAN then Internet.

### Linux / macOS

```bash
curl -fsSL http://192.168.3.9/sa2/install/cspkg | bash
```

External:

```bash
curl -fsSL http://sc.casstk.com/sa2/install/cspkg | bash
```

Installs to `/usr/local/bin/cspkg` (sudo if needed), otherwise `~/.local/bin/cspkg`. Override: `CSPKG_PLATFORM=linux_arm64` (wins over `SA2_PLATFORM`). Ships linux/darwin/windows × amd64/arm64, plus linux armv7.

### Windows (PowerShell)

```powershell
irm http://192.168.3.9/sa2/install/cspkg.ps1 | iex
```

External:

```powershell
irm http://sc.casstk.com/sa2/install/cspkg.ps1 | iex
```

------

## 2. After install (SA1)

SA1 has both native and docker flavors. The native engine is `sa1-upgrader`; docker delegates to the `docker-install` / `upgrade-docker.sh` scripts.

```bash
cspkg help
cspkg show sa1
sudo cspkg install sa1 -y                    # first refresh sa1-upgrader sidecar, then install --local
sudo cspkg install sa1 --flavor docker -y    # Docker stack (delegates to docker-install script)
cspkg list
cspkg check sa1
cspkg status sa1
cspkg upgrade sa1 -y                         # or: cspkg update sa1 -y (npm-style alias)
cspkg upgrade sa1 --flavor docker -y         # docker: delegate to upgrade-docker.sh
cspkg self update -y                         # client itself (like pip install -U pip)
cspkg upgrade cspkg -y                       # same
cspkg uninstall sa1 -y                       # native: without --purge, keeps sa1-upgrader
cspkg uninstall sa1 -y --flavor docker       # docker: compose down
```

`install` native first refreshes sidecar `sa1-upgrader-linux_*`, then calls `sa1-upgrader install --local <tar>`; `install` docker downloads the tar and calls `docker-install --local <tar>` (requires `-y`; airgap needs a sibling `docker-install` in the `--local` directory). `upgrade` native likewise refreshes the engine then `upgrade --local`; `upgrade` docker delegates to `upgrade-docker.sh`. Rollback and `persist` retention are still handled by `sa1-upgrader` (native) or compose (docker). Command tree matches pip / npm: `update sa1` means `upgrade sa1`; `check` / `status` / `upgrade` require a product name. Update the client with `self update`. Do not run a bare `cspkg update`. Do not `install cspkg`. Client **0.2.5+**: `cspkg help platform`, `cspkg help mutex`. HTTP fallback only if the product declares `http_lan` / `http_internet` (sa1 dist, cspkg tools; not sa2 tars).

SA1 and SA2 are **mutually exclusive** (same UDP 8190 / 7090 / 8080). Before `install` / `upgrade` of SA1, cspkg automatically checks and stops SA2 device (native + docker) via `systemctl stop` + `disable` (not `kill -9`). SA2 server/wind is not affected. Do not install both on the same machine. See [Start, check, upgrade](operate.md).

**csdfu** ships in the SA1 business tar and lands with `cspkg install sa1` / `upgrade sa1`. Do not run a separate `cspkg install csdfu`.

------

## 3. Offline / USB

No new package format. Download on a connected machine (`cspkg download`), copy the **whole output directory** via USB or scp, then `--local` (no registry I/O).

```bash
cspkg download sa1 --out /Volumes/USB
cspkg download sa1 --flavor docker --out /Volumes/USB
sudo cspkg install sa1 --local /media/usb/sa1-v2.6.6.22-linux_amd64.tar.gz -y
sudo cspkg install sa1 --flavor docker --local /media/usb -y
```

`download` still verifies SHA256 and writes yaml / sidecar / `docker-install`. Copy the **whole** directory. Field `curl …/install` scripts do not need to change. See `cspkg help download` and `cspkg help offline`.

------

## 4. Remote SSH

```bash
cspkg remote add lab-1 debian@192.168.3.10
cspkg remote bootstrap lab-1
cspkg remote run lab-1 -- check sa1
cspkg remote run lab-1 --sudo -- upgrade sa1 -y
cspkg remote run --cidr 192.168.3.0/24 --user debian --probe -- status sa1
```

Uses local OpenSSH, stores no passwords, forbids untargeted `exec all upgrade`. See `cspkg help remote`.

------

## 5. Relationship with curl install

| Entry | What it does |
|------|--------|
| `…/sa1/install/install` | Direct install of **SA1** (`sa1-upgrader`) |
| `…/sa2/install/cspkg` | Installs only **cspkg client**; then use `cspkg install sa1` for SA1 |

Sites can continue using `install` alone. Use cspkg when you need a unified entry, remote SSH, or multi-product (SA1 + SA2).

------

## 6. Package registry

Native and Docker tars share GitLab Generic **`casstk/sa1`** (public, anonymous pull, peer of `casstk/sa2`). cspkg probes `latest/index.json`, then `<ver>/manifest.json`: under `edge`, `linux_*` / `darwin_*` / `windows_*` are native packages and `*_docker` are Docker packages. Also `latest/cspkg.yaml` and sidecar `sa1-upgrader-linux_*`.

```text
LAN: http://192.168.3.8:8899/api/v4/projects/casstk%2Fsa1/packages/generic/sa1/
Internet: http://112.74.47.129:8899/api/v4/projects/casstk%2Fsa1/packages/generic/sa1/
```

If :8899 is unreachable, SA1 **product** packages fall back to the **LAN** HTTP dist (must also have `latest/index.json`, `<ver>/manifest.json`, and the tars). The public host does **not** hold tars (disk is small); internet pulls GitLab only:

```text
LAN: http://192.168.3.9/sa1/install/dist/
Internet: GitLab internet URL above
```

The cspkg client itself is in `casstk/cspkg` (peer of `casstk/sa2`, anonymous pull):

```text
LAN: http://192.168.3.8:8899/api/v4/projects/casstk%2Fcspkg/packages/generic/cspkg/
Internet: http://112.74.47.129:8899/api/v4/projects/casstk%2Fcspkg/packages/generic/cspkg/
```

Client HTTP mirror fallback:

```text
LAN: http://192.168.3.9/sa2/tools/cspkg/
Internet: http://sc.casstk.com/sa2/tools/cspkg/
```

Container image `192.168.3.8:5050/sa1/sa1/sa1-device` is for `docker-install --pull`. `cspkg install sa1 --flavor docker` downloads the Generic `*_docker` tar by default.

------

## Change log :id=changelog

|Version|Date|Description|
|:--:|----|----------|
|1.0|09/09/2026|SA1 install help adds cspkg section.|
|1.1|09/09/2026|Command tree aligned with pip / npm (download / uninstall / update=upgrade).|
|1.2|09/09/2026|0.2.0 client: download / --local / self update.|
|1.3|09/09/2026|0.2.3: named check/status/upgrade; SA1 Docker -y and airgap docker-install; help platform/mutex.|
|1.4|09/09/2026|Registry layout aligned with cspkg: native + docker tars in casstk/sa1; HTTP dist needs latest/index.json.|
|1.5|09/09/2026|0.2.4: HTTP fallback is per-product; sidecar also tries latest/.|
|1.6|09/10/2026|0.2.5: 'upgrade sa1 --force' no longer breaks (cspkg stops forwarding --force to sa1-upgrader).|
|1.7|09/10/2026|Public HTTP dist removed; internet artifacts are GitLab casstk/sa1 only.|

------

[Top](#top)
