diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-28 12:33:51 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-28 12:33:51 +0200 |
| commit | 10dfe74aa8e847b89211572946596c590b1f8d39 (patch) | |
| tree | 2b636d663e226e31f10a065a31073d69ded1b027 | |
| parent | d839077ef4218575608589f2746e4feb4a36a4df (diff) | |
pkgrepo: fix test package build scripts for FreeBSD and OpenBSD
FreeBSD: use -p plist flag so files are actually included in the package.
OpenBSD: use -D COMMENT flag and separate desc file as required by
pkg_create, auto-detect OS version for repo path.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| -rwxr-xr-x | f3s/pkgrepo/test-artifacts/build-test-packages.sh | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/f3s/pkgrepo/test-artifacts/build-test-packages.sh b/f3s/pkgrepo/test-artifacts/build-test-packages.sh index 2ec8626..feb83ce 100755 --- a/f3s/pkgrepo/test-artifacts/build-test-packages.sh +++ b/f3s/pkgrepo/test-artifacts/build-test-packages.sh @@ -15,28 +15,22 @@ build_freebsd() { OUTDIR="$PWD/freebsd-output" mkdir -p "$OUTDIR" - # Create the hello-test script - mkdir -p "$WORKDIR/usr/local/bin" - cat > "$WORKDIR/usr/local/bin/hello-test" <<'SCRIPT' + # Create the hello-test script under a staging root + STAGEDIR="$WORKDIR/stage" + mkdir -p "$STAGEDIR/usr/local/bin" + cat > "$STAGEDIR/usr/local/bin/hello-test" <<'SCRIPT' #!/bin/sh echo "Hello from the custom FreeBSD package repo!" SCRIPT - chmod 755 "$WORKDIR/usr/local/bin/hello-test" - - # Create the package manifest - cat > "$WORKDIR/+MANIFEST" <<'MANIFEST' -name: hello-test -version: "1.0" -origin: local/hello-test -comment: "Test package for the custom FreeBSD package repository" -desc: "A minimal hello-world package to verify the custom pkg repo works." -maintainer: "paul@buetow.org" -www: "https://buetow.org" -prefix: /usr/local -MANIFEST + chmod 755 "$STAGEDIR/usr/local/bin/hello-test" # Create the packing list - cat > "$WORKDIR/+COMPACT_MANIFEST" <<'MANIFEST' + cat > "$WORKDIR/plist" <<'PLIST' +bin/hello-test +PLIST + + # Create the package manifest with files reference + cat > "$WORKDIR/+MANIFEST" <<MANIFEST name: hello-test version: "1.0" origin: local/hello-test @@ -47,9 +41,9 @@ www: "https://buetow.org" prefix: /usr/local MANIFEST - # Build the package + # Build the package using plist and staging directory mkdir -p "$OUTDIR/All" - pkg create -M "$WORKDIR/+MANIFEST" -r "$WORKDIR" -o "$OUTDIR/All" + pkg create -M "$WORKDIR/+MANIFEST" -p "$WORKDIR/plist" -r "$STAGEDIR" -o "$OUTDIR/All" # Generate the unsigned repo metadata pkg repo "$OUTDIR" @@ -67,26 +61,34 @@ build_openbsd() { OUTDIR="$PWD/openbsd-output" mkdir -p "$OUTDIR" - # Create the hello-test script - mkdir -p "$WORKDIR/usr/local/bin" - cat > "$WORKDIR/usr/local/bin/hello-test" <<'SCRIPT' + # Detect OpenBSD version for the repo path + OSVER=$(uname -r) + + # Create the hello-test script under a staging root + STAGEDIR="$WORKDIR/stage" + mkdir -p "$STAGEDIR/usr/local/bin" + cat > "$STAGEDIR/usr/local/bin/hello-test" <<'SCRIPT' #!/bin/sh echo "Hello from the custom OpenBSD package repo!" SCRIPT - chmod 755 "$WORKDIR/usr/local/bin/hello-test" + chmod 755 "$STAGEDIR/usr/local/bin/hello-test" # Create the packing list cat > "$WORKDIR/packing-list" <<'PLIST' -@name hello-test-1.0 -@comment Test package for the custom OpenBSD package repository -@bin usr/local/bin/hello-test +usr/local/bin/hello-test PLIST + # Create the description file + cat > "$WORKDIR/desc" <<'DESC' +A minimal hello-world package to verify the custom pkg repo works. +DESC + # Build the package - cd "$WORKDIR" - pkg_create -d "A minimal hello-world package to verify the custom pkg repo works." \ + pkg_create \ + -D COMMENT="Test package for the custom OpenBSD package repository" \ + -d "$WORKDIR/desc" \ -f "$WORKDIR/packing-list" \ - -B "$WORKDIR" \ + -B "$STAGEDIR" \ -p / \ "$OUTDIR/hello-test-1.0.tgz" @@ -94,8 +96,9 @@ PLIST echo "" echo "OpenBSD package built in: $OUTDIR" + echo "OpenBSD version detected: $OSVER" echo "Copy contents to the PV:" - echo " scp $OUTDIR/hello-test-1.0.tgz <nfs-host>:/data/nfs/k3svolumes/pkgrepo/openbsd/7.7/packages/amd64/" + echo " scp $OUTDIR/hello-test-1.0.tgz <nfs-host>:/data/nfs/k3svolumes/pkgrepo/openbsd/$OSVER/packages/amd64/" } case "$1" in |
