]> git.t-rg.ws Git - slackbuilds.git/commitdiff
Added the script I use for incremental updates
authorfsLeg <fsleg@t-rg.ws>
Sun, 28 Sep 2025 16:36:55 +0000 (19:36 +0300)
committerfsLeg <fsleg@t-rg.ws>
Sun, 28 Sep 2025 16:36:55 +0000 (19:36 +0300)
update-version.sh [new file with mode: 0755]

diff --git a/update-version.sh b/update-version.sh
new file mode 100755 (executable)
index 0000000..c5f8a62
--- /dev/null
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+# Update the version of SlackBuilds. Useful for incremental updates.
+# Intended to be run from the root of the repo.
+# It updates the version in the .SlackBuild and .info files, generates
+# vendored-sources tarball and updates MD5 checksums in the .info file.
+
+set -e
+
+if [ -z "$1" ] || [ -z "$2" ]; then
+  echo "Usage: $0 PRGNAM NEWVER"
+  exit 1
+fi
+
+PRGNAM="${1%/}"
+NEWVER="$2"
+CWD="$(pwd)"
+
+cd "$PRGNAM"
+
+. "./$PRGNAM.info"
+sed -i "s|$VERSION|$NEWVER|g" "$PRGNAM.SlackBuild" "$PRGNAM.info"
+
+. "./$PRGNAM.info"
+if [ "$DOWNLOAD" != "UNSUPPORTED" ]; then
+  wget --tries=inf --retry-on-http-error=503 $DOWNLOAD || true
+fi
+if [ -n "$DOWNLOAD_x86_64" ]; then
+  wget --tries=inf --retry-on-http-error=503 $DOWNLOAD_x86_64 || true
+fi
+
+if [ -f mkvendor.sh ]; then
+  sh mkvendor.sh
+fi
+
+if [ "$DOWNLOAD" != "UNSUPPORTED" ]; then
+  for TARBALL in $(basename -a $DOWNLOAD); do
+    CHECKSUMS="$CHECKSUMS$(md5sum "$TARBALL" | cut -d' ' -f1) "
+  done
+  perl -0777 -pi -e 's|MD5SUM="[0-9a-f\s\\]*"|MD5SUM="'"${CHECKSUMS% }"'"|' "$PRGNAM.info"
+fi
+if [ -n "$DOWNLOAD_x86_64" ] && [ "$DOWNLOAD_x86_64" != "UNSUPPORTED" ]; then
+  for TARBALL in $(basename -a $DOWNLOAD_x86_64); do
+    CHECKSUMS64="$CHECKSUMS64$(md5sum "$TARBALL" | cut -d' ' -f1) "
+  done
+  perl -0777 -pi -e 's|MD5SUM_x86_64="[0-9a-f\s\\]*"|MD5SUM_x86_64="'"${CHECKSUMS64% }"'"|' "$PRGNAM.info"
+fi
+
+sbofixinfo
+rm -f "$PRGNAM.info.bak"
+
+cd "$CWD"