forked from rhinstaller/kickstart-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
repo-install.ks.in
84 lines (67 loc) · 2.39 KB
/
repo-install.ks.in
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
#test name: repo-install
## Test for repo --install.
%ksappend repos/default.ks
%ksappend common/common_no_payload.ks
%ksappend payload/default_packages.ks
repo --name=test01 --baseurl=EMPTY_REPO_URL
repo --name=test02 --baseurl=EMPTY_REPO_URL --install
repo --name=test03 --baseurl=EMPTY_REPO_URL --cost=25 --install
repo --name=test04 --baseurl=EMPTY_REPO_URL --noverifyssl --install
repo --name=test05 --baseurl=EMPTY_REPO_URL --includepkgs=p1,p2 --excludepkgs=p3,p4 --install
%post
@KSINCLUDE@ scripts-lib.sh
platform="$(get_platform @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@)"
# Define patterns for repo options.
if [ "${platform}" == "rhel8" ] || [ "${platform}" == "rhel9" ]; then
cost='^cost=25$'
sslverify='^sslverify=0$'
includepkgs='^includepkgs=p1,p2$'
excludepkgs='^excludepkgs=p3,p4$'
else
cost='^cost = 25$'
sslverify='^sslverify = 0$'
includepkgs='^includepkgs = p1, p2$'
excludepkgs='^excludepkgs = p3, p4$'
fi
# Check the test01 repository.
repo=/etc/yum.repos.d/test01.repo
if [[ -e ${repo} ]]; then
echo "*** ${repo} shouldn't be installed" >> /root/RESULT
fi
# Check the test02 repository.
repo=/etc/yum.repos.d/test02.repo
if [[ ! -e ${repo} ]]; then
echo "*** ${repo} should be installed" >> /root/RESULT
fi
# Check the test03 repository.
repo=/etc/yum.repos.d/test03.repo
if [[ ! -e ${repo} ]]; then
echo "*** ${repo} should be installed" >> /root/RESULT
elif ! grep -q "${cost}" ${repo}; then
echo "*** ${repo} should specify the cost option" >> /root/RESULT
cat ${repo} >> /root/RESULT
fi
# Check the test04 repository.
repo=/etc/yum.repos.d/test04.repo
if [[ ! -e ${repo} ]]; then
echo "*** ${repo} should be installed" >> /root/RESULT
elif ! grep -q "${sslverify}" ${repo}; then
echo "*** ${repo} should specify the sslverify option" >> /root/RESULT
cat ${repo} >> /root/RESULT
fi
# Check the test05 repository.
repo=/etc/yum.repos.d/test05.repo
if [[ ! -e ${repo} ]]; then
echo "*** ${repo} should be installed" >> /root/RESULT
else
if ! grep -q "${includepkgs}" ${repo}; then
echo "*** ${repo} should specify the includepkgs option" >> /root/RESULT
cat ${repo} >> /root/RESULT
fi
if ! grep -q "${excludepkgs}" ${repo}; then
echo "*** ${repo} should specify the excludepkgs option" >> /root/RESULT
cat ${repo} >> /root/RESULT
fi
fi
%ksappend validation/success_if_result_empty.ks
%end