Skip to content

Commit c84a930

Browse files
committed
Update zeek to version 7.0.8
1 parent 279b90e commit c84a930

File tree

6 files changed

+150
-4
lines changed

6 files changed

+150
-4
lines changed

pkgdefs/usbguard.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"download_fmt": "https://github.com/USBGuard/usbguard/releases/download/usbguard-%v/usbguard-%v.tar.gz",
3+
"tarball_fmt": "usbguard.tar"
4+
}

pkgdefs/zeek.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"download_fmt": "https://download.zeek.org/zeek-%v.tar.gz",
3+
"tarball_fmt": "zeek.tar"
4+
}

update-slackbuild.sh

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/bin/sh
2+
set -eu
3+
4+
# --- Parse Arguments ---
5+
if [ $# -lt 2 ] || [ $# -gt 3 ]; then
6+
echo "Usage: $0 <package-name> <new-version> [--dry-run]" >&2
7+
exit 1
8+
fi
9+
10+
PKG="$1"
11+
VERSION="$2"
12+
DRY_RUN="${3:-}"
13+
14+
CONF_JSON="pkgdefs/$PKG.json"
15+
PKGDIR="./$PKG"
16+
INFO_FILE="$PKGDIR/${PKG}.info"
17+
BUILD_FILE="$PKGDIR/${PKG}.SlackBuild"
18+
19+
# --- Validate files ---
20+
[ -f "$CONF_JSON" ] || { echo "Missing: $CONF_JSON" >&2; exit 1; }
21+
[ -f "$INFO_FILE" ] || { echo "Missing: $INFO_FILE" >&2; exit 1; }
22+
[ -f "$BUILD_FILE" ] || { echo "Missing: $BUILD_FILE" >&2; exit 1; }
23+
24+
# --- Load shared functions ---
25+
. ./utils.sh
26+
27+
# --- Extract current version and short-circuit if same ---
28+
CURRENT_VERSION=$(grep '^VERSION=' "$INFO_FILE" | cut -d= -f2 | tr -d '"')
29+
if [ "$CURRENT_VERSION" = "$VERSION" ]; then
30+
log "No update needed: current version already $VERSION."
31+
[ "$DRY_RUN" = "--dry-run" ] && exit 0
32+
fi
33+
34+
# --- Load template URL and generate download target ---
35+
DOWNLOAD_FMT=$(jq -r .download_fmt "$CONF_JSON")
36+
URL=$(printf "%s" "$DOWNLOAD_FMT" | sed "s/%v/$VERSION/g")
37+
38+
# --- Download and hash tarball ---
39+
RESULT=$(download_and_verify "$URL")
40+
WORKDIR=$(echo "$RESULT" | awk '{print $1}')
41+
MD5=$(echo "$RESULT" | awk '{print $2}')
42+
43+
# --- Copy working files ---
44+
cp -r "$PKGDIR"/* "$WORKDIR/"
45+
46+
# --- Apply updates ---
47+
update_info_file "$WORKDIR/${PKG}.info" "$VERSION" "$URL" "$MD5"
48+
update_build_file "$WORKDIR/${PKG}.SlackBuild" "$VERSION"
49+
50+
# --- Dry-run: show proposed changes without modifying files ---
51+
if [ "$DRY_RUN" = "--dry-run" ]; then
52+
echo "=== DRY RUN: Showing proposed changes for $PKG $VERSION ==="
53+
54+
if command -v delta >/dev/null 2>&1; then
55+
DIFF="delta --paging=always --syntax-theme=Dracula"
56+
else
57+
DIFF="cat"
58+
fi
59+
60+
echo "--- .info diff ---"
61+
diff -u "$PKGDIR/${PKG}.info" "$WORKDIR/${PKG}.info" | $DIFF || true
62+
63+
echo "--- .SlackBuild diff ---"
64+
diff -u "$PKGDIR/${PKG}.SlackBuild" "$WORKDIR/${PKG}.SlackBuild" | $DIFF || true
65+
66+
echo "Dry run complete. No files modified."
67+
rm -rf "$WORKDIR"
68+
exit 0
69+
fi
70+
71+
# --- Final archive ---
72+
create_archive "$PKG" "$WORKDIR"
73+
74+
# --- Cleanup ---
75+
rm -rf "$WORKDIR"

utils.sh

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/sh
2+
3+
# Print informational messages to stderr
4+
log() {
5+
printf '[INFO] %s\n' "$*" >&2
6+
}
7+
8+
# Download a file and return "<workdir> <md5sum>" via stdout
9+
download_and_verify() {
10+
URL="$1"
11+
TMPDIR="${TMPDIR:-/tmp}"
12+
WORKDIR="$(mktemp -d "$TMPDIR/pkgbuild_XXXXXX")"
13+
TARBALL_NAME=$(basename "$URL")
14+
15+
log "Downloading: $URL"
16+
if ! curl -fsSL -A "SlackBuildBot/1.0" -o "$WORKDIR/$TARBALL_NAME" "$URL"; then
17+
log "Download failed. No files were changed."
18+
rm -rf "$WORKDIR"
19+
exit 1
20+
fi
21+
22+
log "Calculating MD5..."
23+
if ! MD5=$(md5sum "$WORKDIR/$TARBALL_NAME" | awk '{print $1}'); then
24+
log "MD5 calculation failed."
25+
rm -rf "$WORKDIR"
26+
exit 1
27+
fi
28+
29+
# Return structured data
30+
echo "$WORKDIR $MD5"
31+
}
32+
33+
# Update .info file with new VERSION, DOWNLOAD, and MD5SUM
34+
update_info_file() {
35+
INFO_FILE="$1"
36+
VERSION="$2"
37+
URL="$3"
38+
MD5="$4"
39+
40+
sed -i '' \
41+
-e "s/^VERSION=.*/VERSION=\"$VERSION\"/" \
42+
-e "s|^DOWNLOAD=.*|DOWNLOAD=\"$URL\"|" \
43+
-e "s/^MD5SUM=.*/MD5SUM=\"$MD5\"/" \
44+
"$INFO_FILE"
45+
}
46+
47+
# Update the fallback VERSION line in the SlackBuild
48+
update_build_file() {
49+
BUILD_FILE="$1"
50+
VERSION="$2"
51+
sed -i '' "s/^VERSION=.*/VERSION=\${VERSION:-$VERSION}/" "$BUILD_FILE"
52+
}
53+
54+
# Create <pkg>.tar.gz from the working directory, including all contents
55+
create_archive() {
56+
PKG="$1"
57+
WORKDIR="$2"
58+
OUTFILE="${PKG}.tar.gz"
59+
60+
tar -czf "$OUTFILE" -C "$WORKDIR" .
61+
62+
log "Created metadata archive: $OUTFILE"
63+
}

zeek/zeek.SlackBuild

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
cd $(dirname $0) ; CWD=$(pwd)
2626

2727
PRGNAM=zeek
28-
VERSION=${VERSION:-7.0.7}
28+
VERSION=${VERSION:-7.0.8}
2929
BUILD=${BUILD:-1}
3030
TAG=${TAG:-_SBo}
3131
PKGTYPE=${PKGTYPE:-tgz}

zeek/zeek.info

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
PRGNAM="zeek"
2-
VERSION="7.0.7"
2+
VERSION="7.0.8"
33
HOMEPAGE="https://www.zeek.org"
4-
DOWNLOAD="https://download.zeek.org/zeek-7.0.7.tar.gz"
5-
MD5SUM="5bdd8521c1722c2e7d3dbb298e86ec29"
4+
DOWNLOAD="https://download.zeek.org/zeek-7.0.8.tar.gz"
5+
MD5SUM="c493e27f655846ab58fc6aa9f71afefd"
66
DOWNLOAD_x86_64=""
77
MD5SUM_x86_64=""
88
REQUIRES=""

0 commit comments

Comments
 (0)