Merge pull request 'Package Orbit with Orbit' (#1) from package-orbit into main

This commit was merged in pull request #1.
This commit is contained in:
nandi committed 2026-11-27 02:21:35 +00:00
commit 216ff99dd0
2 files changed
+53

No files matched your search

+28
View File
@@ -76,6 +76,34 @@ moon test --target native # semver / manifest unit tests
Linux only for now: arguments come from `/proc/self/cmdline`. It needs `oras`, `tar` and `/bin/sh` on `PATH`.
### Package Orbit with Orbit
From the repo root, build and stage the `orbit` package. The package version
comes from `moon.mod`; publishing is a separate step.
```sh
package_dir=$(sh scripts/package-orbit.sh) &&
_build/native/release/build/main/main.exe publish "$package_dir"
```
This publishes to the configured registry, so run `orbit init <registry>` (or
set `ORBIT_REGISTRY`) first and log in with `oras login <host>` if needed. The
package contains a native Linux binary for the build machine's architecture.
Use the same architecture on the install machine. `oras` and `tar` are still
system prerequisites; the package does not bundle them.
To bootstrap from source, install the published package with the binary you just
built. After adding Orbit's bin directory to `PATH`, use the installed binary
for future upgrades and rollbacks:
```sh
bootstrap=_build/native/release/build/main/main.exe
"$bootstrap" install orbit
eval "$("$bootstrap" env)"
orbit upgrade orbit
# If needed: orbit rollback orbit
```
## Layout
```
+25
View File
@@ -0,0 +1,25 @@
#!/bin/sh
# Build and stage Orbit as an Orbit package. Print the staging path on stdout.
set -eu
cd "$(dirname "$0")/.."
version=$(sed -n 's/^version[[:space:]]*=[[:space:]]*"\([0-9A-Za-z.+-]*\)"[[:space:]]*$/\1/p' moon.mod)
if [ -z "$version" ]; then
echo "Could not read Orbit's version from moon.mod" >&2
exit 1
fi
moon build --target native --release >&2
package_dir=$(mktemp -d "$PWD/_build/orbit-package.XXXXXX")
mkdir -p "$package_dir/files/bin"
install -m 755 _build/native/release/build/main/main.exe "$package_dir/files/bin/orbit"
cat > "$package_dir/orbit.json" <<EOF
{
"name": "orbit",
"version": "$version",
"description": "A package manager backed by an OCI registry",
"bin": ["bin/orbit"],
"depends": {}
}
EOF
printf '%s\n' "$package_dir"