-
Notifications
You must be signed in to change notification settings - Fork 0
/
runPostBuild.sh
executable file
·56 lines (43 loc) · 1.05 KB
/
runPostBuild.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
#!/usr/bin/env bash
set -ex
set -v
RPMDIR=$(realpath ./RPMS)
TMPDIR=$(realpath ./workspace)
if [[ -d $TMPDIR ]] ; then
rm -rf $TMPDIR
fi
mkdir -p $TMPDIR
pushd $TMPDIR
## START Regression Test: NETETH-2148
function check_permissions() {
local f=${1}
local expected=${2}
local actual="$(stat -L -c "%A" ${f})"
if [[ "$expected" != "$actual" ]] ; then
echo permission check failed for $f
echo Regression: NETETH-2148
echo expected: $expected
echo actual: $actual
exit 1
fi
}
binary_rpm=$(find $RPMDIR -name 'slingshot-utils*.rpm' | grep -v "src.rpm")
if [[ -z "$binary_rpm" ]] ; then
echo could not find slingshot-utils rpm
ls -al $RPMDIR
exit 1
fi
rpm2cpio $binary_rpm | cpio -id
## expecting 0755 for scripts
expected_permissions="-rwxr-xr-x"
for entry in slingshot-diag slingshot-snapshot slingshot-utils; do
filepath=$(find $TMPDIR -name "$entry" -type f)
if [[ -z "$filepath" ]] ; then
echo failed to find $entry
exit 1
fi
check_permissions $filepath $expected_permissions
done
## END NETETH-2148
popd
exit 0