-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest_itcs.sh
executable file
·129 lines (101 loc) · 2.5 KB
/
test_itcs.sh
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/sh
# see https://www.altlinux.org/ViPNet_CSP
# TODO: since vipnetcsp_pkg_manager.sh
. $(dirname $0)/functions.sh
DEVEL=''
[ "$1" = "--devel" ] && DEVEL=$1 && shift
GUI='--gui'
[ "$1" = "--nogui" ] && GUI='' && shift
INSTALL32=''
INSTALL64=''
case "$1" in
32)
INSTALL32="$1"
;;
64)
INSTALL64="$1"
;;
both)
fatal "Sorry, biarch don't support yet"
INSTALL32="$1"
INSTALL64="$1"
;;
*)
fatal "Run with 32|64|both param"
esac
shift
[ "$1" = "--devel" ] && DEVEL=$1 && shift
[ "$1" = "--nogui" ] && GUI='' && shift
check_pkg()
{
local PKG="$1" || return
local VER="$2"
local ARCH="$3"
# TODO: check me on p8
QPKG="$(epm -q $PKG 2>/dev/null)"
if [ -z "$QPKG" ] ; then
printf " %-50s %s\n" "$PKG" "MISSED"
return 1
fi
if ! echo "$QPKG" | grep -q "^$PKG[-_]$VER.*.$ARCH" ; then
echo " $QPKG mismatch with $PKG[-_]$VER.*.$ARCH"
return 1
fi
printf " %-50s %s" "$PKG" "exists"
if ! epm checkpkg $PKG 2>/dev/null >/dev/null ; then
echo -en "\b\b\b\b\b\b"
echo "BRokEN"
epm checkpkg $QPKG
return 1
fi
echo -en "\b\b\b\b\b\b"
echo " OK"
}
# TODO: использовать список того, что ставили?
check_itcs()
{
local ARCH=$1
echo
NAME=$(epm -q itcs-csp-gost) || fatal "Can't find main package"
VER=$(echo "$NAME" | sed -e "s|itcs-csp-gost-\([4-5].[0-9]\)\..*|\1|") #"
echo "Checking $ARCH itcs-* version $VER packages ..."
check_pkg itcs-licensing 1 $ARCH
for i in itcs-winapi itcs-csp-gost \
itcs-integrity-check itcs-cryptofile ; do
check_pkg $i $VER $ARCH
done
if [ "$VER" = "4.4" ] ; then
ENTROPYVER="4.5"
for i in itcs-pkicmd itcs-known-path; do
check_pkg $i $VER $ARCH
done
else
ENTROPYVER="4.4"
fi
check_pkg itcs-entropy-gost $ENTROPYVER $ARCH
if [ -n "$GUI" ] ; then
check_pkg itcs-entropy-gost-gui $ENTROPYVER $ARCH
for i in itcs-csp-gost-gui itcs-winapi-gui ; do
check_pkg $i $VER $ARCH
done
fi
if [ -n "$DEVEL" ] ; then
for i in itcs-csp-dev ; do
check_pkg $i $VER $ARCH
done
fi
}
if [ -n "$INSTALL64" ] ; then
check_itcs x86_64
fi
if [ -n "$INSTALL32" ] ; then
check_itcs i386
fi
logger()
{
cat
}
IC=/opt/itcs/bin/csp_integrity_check.sh
echo
info "Checking integrity via $IC ..."
. $IC