diff options
| author | Danilo M. <danix@danix.xyz> | 2026-07-14 16:35:44 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-07-14 16:35:44 +0200 |
| commit | 4cf9fe41ac1538843f9239a48e2af20734b2a3d2 (patch) | |
| tree | c640a85c2af5ad3ac7a9dfdfe25d5a261f0126d9 | |
| parent | b50ad8786a116bf4d30324b1bdfa65db71699e83 (diff) | |
| download | sbo-slackbuilds-4cf9fe41ac1538843f9239a48e2af20734b2a3d2.tar.gz sbo-slackbuilds-4cf9fe41ac1538843f9239a48e2af20734b2a3d2.zip | |
test-build: add --keep to save the built target package
Binary-repack packages (metasploit-framework-bin) need a post-install step on
the host: install the package, then regenerate artifacts that require a live
install (msfvenom bash-completion, man pages). This repo is deliberately outside
the buildsystem workflow, so producing that package meant a manual root build
here. --keep instead copies the built target .txz out to <data>/kept/ (path
printed) so it can be installed on the host directly from a normal test run. The
build is otherwise throwaway; deps are unaffected.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| -rwxr-xr-x | .extras/test-build | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/.extras/test-build b/.extras/test-build index 6c2d580..f245aed 100755 --- a/.extras/test-build +++ b/.extras/test-build @@ -38,6 +38,7 @@ USE_COLOR=1 # --no-color or non-TTY disables DRY_RUN=0 # --dry-run: resolve + print order, do not build ASSUME_YES=0 # --yes: skip the confirm prompt (still prints the order) USE_CACHE=1 # --no-cache disables the dep cache for one run +KEEP_TARGET=0 # --keep: copy the built target package out to KEEP_DIR VERSION_ID="current" # "current" | "15.0"; set by --stable TARGET_ARG="" @@ -66,6 +67,9 @@ OPTIONS: --dry-run Resolve, apply overrides, print the build order, do not build. --yes Skip the confirm prompt (the order is still printed first). --no-cache Rebuild all deps this run, ignore/refresh the cache. + --keep Copy the built target package out to a kept/ dir (path is + printed), so it can be installed on the host. The build is + otherwise throwaway. --no-color Disable ANSI color (auto-disabled when stdout is not a TTY). EOF } @@ -78,6 +82,7 @@ parse_args() { --dry-run) DRY_RUN=1; shift ;; --yes) ASSUME_YES=1; shift ;; --no-cache) USE_CACHE=0; shift ;; + --keep) KEEP_TARGET=1; shift ;; --no-color) USE_COLOR=0; shift ;; -*) echo "Unknown option: $1" >&2; usage >&2; exit 2 ;; *) @@ -643,6 +648,15 @@ CONTAINER_EOF elif grep -q '^LINT-CLEAN$' "$logf" 2>/dev/null; then echo " lint: ${C_GRN}clean${C_RST}" fi + # --keep: copy the built target package to a durable dir (sibling of the + # logs tree, not inside a throwaway run dir) so it can be installed on + # the host, e.g. to regenerate post-install artifacts. + if [[ $KEEP_TARGET -eq 1 ]]; then + local keepdir; keepdir="$(dirname "$LOG_ROOT")/kept" + mkdir -p "$keepdir" + cp -a "$newest" "$keepdir/" + echo " kept: $keepdir/$(basename "$newest")" + fi fi fi return 0 |
