-
Notifications
You must be signed in to change notification settings - Fork 0
/
check-compat64
executable file
·75 lines (60 loc) · 1.87 KB
/
check-compat64
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/sh
# $Id: check-compat64,v 1.1 2010/06/28 14:53:57 eha Exp eha $
# Purpose:
# To check if any of the installed -compat64 packages is older than the
# accompanying 32-bit package.
# Authors:
# Eric Hameleers <[email protected]>
# Ben Stern <[email protected]>
# No verbose output by default:
DEBUG=0
showhelp () {
cat <<EOT
Script name:
$(basename $0)
Purpose:
To check if any of the installed -compat64 packages is older than the
accompanying 32-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 command-line 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 -compat64 packages we find installed, and compare their
# versions to the 32-bit packages
[ $DEBUG -ne 0 ] && echo "-- Checking installed packages..."
for FULL64 in $(find /var/log/packages/ -name "*-compat64-*") ; do
PKG64=$(echo ${FULL64} | cut -f5 -d'/' | rev | cut -f4- -d'-' | rev)
VER64=$(echo ${FULL64} | cut -f5 -d'/' | rev | cut -f3 -d'-' | rev)
[ $DEBUG -ne 0 ] && echo ">> Found '$PKG64'..."
PKG32=$(echo ${FULL64} | cut -f5 -d'/' | rev | cut -f5- -d'-' | rev)
VER32=$($(find /var/log/packages/ -name "${PKG32}*" | grep -v -- -compat64) | cut -f5 -d'/' | rev | cut -f3 -d'-' | rev | grep "${PKG32}$")
# Issue a warning if the version of the 32-bit package differs:
if [ -n "$VER32" -a "$VER64" != "$VER32" ]; then
echo "** Package '$PKG32' has version '$VER32' but package '$PKG64' has version '$VER64'"
fi
done
[ $DEBUG -ne 0 ] && echo "-- Finished checking installed packages."