feat: harden CASAN production install lifecycle
This commit is contained in:
+14
-19
@@ -75,34 +75,29 @@ log "version : $VERSION"
|
||||
log "level : $LEVEL (core=harness+CLI, devkit=+adoption tooling)"
|
||||
log "install : $CASAN_HOME"
|
||||
|
||||
# ── 2) Copy harness + devkit + CLI into a versioned dir ──────────────────────
|
||||
# ── 2) Copy the production runtime allowlist into a versioned dir ─────────────
|
||||
DEST="$CASAN_HOME/versions/$VERSION"
|
||||
rm -rf "$DEST"
|
||||
mkdir -p "$DEST/packages" "$DEST/bin"
|
||||
|
||||
copy_tree() { # <relpath>
|
||||
[ -e "$SRC/$1" ] || return 0
|
||||
if command -v rsync >/dev/null 2>&1; then
|
||||
rsync -a --exclude='__pycache__' --exclude='*.pyc' --exclude='.DS_Store' \
|
||||
--exclude='*.log' "$SRC/$1/" "$DEST/$1/"
|
||||
else
|
||||
mkdir -p "$DEST/$1"
|
||||
cp -R "$SRC/$1/." "$DEST/$1/"
|
||||
fi
|
||||
}
|
||||
# L1 core: harness + CLI + installer + level manifest.
|
||||
copy_tree "packages/casan-harness"
|
||||
RUNTIME_COPIER="$SRC/scripts/copy-runtime.py"
|
||||
[ -f "$RUNTIME_COPIER" ] || die "missing production runtime copier: scripts/copy-runtime.py"
|
||||
python3 "$RUNTIME_COPIER" \
|
||||
--source-root "$SRC" --destination-root "$DEST" --component harness --clean \
|
||||
|| die "failed to assemble the production harness runtime."
|
||||
|
||||
# L1 core: production harness + CLI.
|
||||
cp "$SRC/bin/casan" "$DEST/bin/casan"
|
||||
chmod +x "$DEST/bin/casan"
|
||||
cp "$SRC/VERSION" "$DEST/VERSION" 2>/dev/null || printf '%s\n' "$VERSION" > "$DEST/VERSION"
|
||||
for f in install.sh install.ps1; do [ -f "$SRC/$f" ] && cp "$SRC/$f" "$DEST/$f"; done
|
||||
mkdir -p "$DEST/packaging"; [ -f "$SRC/packaging/levels.json" ] && cp "$SRC/packaging/levels.json" "$DEST/packaging/levels.json"
|
||||
mkdir -p "$DEST/packaging"
|
||||
cp "$SRC/packaging/runtime-layout.json" "$DEST/packaging/runtime-layout.json"
|
||||
|
||||
# L2 devkit: adoption tooling (templates, domain-pack, casan init, package-release).
|
||||
# L2 devkit: production adoption tooling only.
|
||||
if [ "$LEVEL" = "devkit" ]; then
|
||||
copy_tree "packages/casan-devkit"
|
||||
mkdir -p "$DEST/scripts"; [ -f "$SRC/scripts/package-release.sh" ] && cp "$SRC/scripts/package-release.sh" "$DEST/scripts/package-release.sh"
|
||||
[ -d "$SRC/docs/packaging" ] && { mkdir -p "$DEST/docs"; cp -R "$SRC/docs/packaging" "$DEST/docs/packaging"; }
|
||||
python3 "$RUNTIME_COPIER" \
|
||||
--source-root "$SRC" --destination-root "$DEST" --component devkit --clean \
|
||||
|| die "failed to assemble the production DevKit runtime."
|
||||
fi
|
||||
printf '%s\n' "$LEVEL" > "$DEST/.casan-level"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user