summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2019-12-12 20:49:51 +0000
committer Eric Hameleers <alien@slackware.com>2019-12-12 20:49:51 +0000
commit9252035ed139519ed94c7581b45056cd66ff952d (patch)
tree666dc85810778f5d73201db9764619540228126b
parentf44729a8764a07b07e7ab5897ae8a99f8bfe502e (diff)
downloadmultilib-9252035ed139519ed94c7581b45056cd66ff952d.tar.gz
multilib-9252035ed139519ed94c7581b45056cd66ff952d.tar.xz
compat32-tools: fix the check-compat32 script
-rw-r--r--source/compat32-tools/check-compat3275
1 files changed, 75 insertions, 0 deletions
diff --git a/source/compat32-tools/check-compat32 b/source/compat32-tools/check-compat32
new file mode 100644
index 0000000..5ed2e91
--- /dev/null
+++ b/source/compat32-tools/check-compat32
@@ -0,0 +1,75 @@
+#!/bin/bash
+#$Id$
+#
+# Purpose:
+# To check if any of the installed -compat32 packages is older than
+# the accompanying 64-bit package.
+#
+# Author:
+# Eric Hameleers <alien@slackware.com>
+#
+
+# No verbose output by default:
+DEBUG=0
+
+showhelp () {
+cat <<EOT
+
+Script name:
+ $(basename $0)
+Purpose:
+ To check if any of the installed -compat32 packages is older than
+ the accompanying 64-bit package.
+Usage:
+ Run the program without parameters to make it check your packages.
+Parameters:
+ -h|--help Show this help text
+ -v|--verbose Verbose output
+
+EOT
+}
+
+# Parse the commandline parameters:
+while [ ! -z "$1" ]; do
+ case $1 in
+ -h|--help)
+ showhelp
+ exit 0
+ ;;
+ -v|--verbose)
+ DEBUG=1
+ shift
+ ;;
+ -*)
+ echo "Unsupported parameter '$1'!"
+ exit 1
+ ;;
+ *)
+ # Do nothing
+ shift
+ ;;
+ esac
+done
+
+
+# Loop through the -compat32 packages we find installed,
+# and compare their versions to the 64-bit packages
+[ $DEBUG -ne 0 ] && echo "-- Checking installed packages..."
+for FULL32 in $(find /var/log/packages/ -name "*-compat32-*") ; do
+ PKG32=$(echo ${FULL32} |cut -f5 -d'/' |rev |cut -f4- -d'-' |rev)
+ VER32=$(echo ${FULL32} |cut -f5 -d'/' |rev |cut -f3 -d'-' |rev)
+
+ [ $DEBUG -ne 0 ] && echo ">> Found '$PKG32'..."
+
+ PKG64=$(echo ${FULL32} |cut -f5 -d'/' |rev |cut -f5- -d'-' |rev)
+ # Differentiate between eg. 'openssl' and 'openssl-solibs':
+ VER64=$( for PACK in $(find /var/log/packages/ -name "${PKG64}-*" |grep -v -- -compat32) ; do if [ "$(echo $PACK |cut -f5 -d'/' |rev |cut -f4- -d'-' |rev)" = "${PKG64}" ]; then echo $(echo $PACK |cut -f5 -d'/' | rev | cut -f3 -d'-' |rev) ; fi ; done )
+
+ # Issue a warning if the version of the 64-bit package differs:
+ if [ -n "$VER64" -a "$VER32" != "$VER64" ]; then
+ echo "** Package '$PKG64' has version '$VER64' but package '$PKG32' has version '$VER32'"
+ fi
+done
+
+[ $DEBUG -ne 0 ] && echo "-- Finished checking installed packages."
+