diff options
| author | Danilo M. <danix@danix.xyz> | 2026-06-26 11:09:41 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-06-26 11:09:41 +0200 |
| commit | 32f320068b076b506b3aa66cf17e105d4fce16d6 (patch) | |
| tree | 217b1cf26154cb6cea16afecdda7d681f128ccdc /.extras/mksboarchive | |
| parent | 5afd8fc3f982197d12aedfd37ff821847252bb2e (diff) | |
| download | slackware-pentesting-suite-32f320068b076b506b3aa66cf17e105d4fce16d6.tar.gz slackware-pentesting-suite-32f320068b076b506b3aa66cf17e105d4fce16d6.zip | |
extras: make mksboarchive resolve the package from CWD
The previous version derived the repo root from the script's own location via
git, which broke once the script was installed outside the repo (e.g. ~/bin):
it ran git in ~/bin and failed with 'not a git repository'. Resolve the
package as <pkg>/ below the current directory instead and run from the repo
root. The installed copy now works identically. README updated.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to '.extras/mksboarchive')
| -rwxr-xr-x | .extras/mksboarchive | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/.extras/mksboarchive b/.extras/mksboarchive index a53fbf4..fc54709 100755 --- a/.extras/mksboarchive +++ b/.extras/mksboarchive @@ -8,9 +8,10 @@ usage() { usage: ${0##*/} <package-name> Build the SBo submission tarball <package-name>.tar.gz, the same archive the -post-commit hook produces, on demand by name. The package must exist in this -repo (<package-name>/<package-name>.SlackBuild). Any sbodl source symlinks in -the package directory are removed first so they never leak into the tarball. +post-commit hook produces, on demand by name. Run from the repo root: the +package is the <package-name>/ directory below the current directory, with a +matching <package-name>.SlackBuild. Any sbodl source symlinks in the package +directory are removed first so they never leak into the tarball. Output goes to the current directory by default; set OUTPUT to override: OUTPUT=/tmp ${0##*/} feroxbuster # writes /tmp/feroxbuster.tar.gz @@ -23,22 +24,22 @@ esac [ $# -eq 1 ] || { usage >&2; exit 2; } pkg=$1 -REPO_ROOT=$(git -C "$(dirname "$0")" rev-parse --show-toplevel) -# Where the tarball lands. Defaults to the current directory; override with -# the OUTPUT env var (e.g. OUTPUT=/tmp mksboarchive feroxbuster). +# Run this from the repo root. The package is the <pkg>/ directory below the +# current directory; the tarball is written to the current directory by +# default, override with the OUTPUT env var. OUTPUT=${OUTPUT:-$PWD} -# Must be a real package dir one level deep with a matching .SlackBuild. -if [ ! -f "$REPO_ROOT/$pkg/$pkg.SlackBuild" ]; then - echo "error: '$pkg' is not a package in this repo." >&2 +# Must be a real package dir below CWD with a matching .SlackBuild. +if [ ! -f "$pkg/$pkg.SlackBuild" ]; then + echo "error: no '$pkg/$pkg.SlackBuild' here. Run from the repo root." >&2 exit 1 fi # Drop any sbodl source symlinks before archiving so they never end up in an # SBo submission tarball (the pre-commit hook does the same for staged files). -find "$REPO_ROOT/$pkg" -type l -delete +find "$pkg" -type l -delete mkdir -p "$OUTPUT" -tar -czf "$OUTPUT/$pkg.tar.gz" -C "$REPO_ROOT" "$pkg" +tar -czf "$OUTPUT/$pkg.tar.gz" "$pkg" echo "Archive created: $OUTPUT/$pkg.tar.gz" |
