forked from rhinstaller/kickstart-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
proxy-auth.ks.in
87 lines (72 loc) · 2.63 KB
/
proxy-auth.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
85
86
87
url @KSTEST_URL@ --proxy=http://anaconda:[email protected]:8080
repo --name=kstest-http --baseurl=HTTP-ADDON-REPO --proxy=http://anaconda:[email protected]:8080 --install
install
network --bootproto=dhcp
bootloader --timeout=1
zerombr
clearpart --all
autopart
keyboard us
lang en
timezone America/New_York
rootpw qweqwe
shutdown
# Install @core, which will also pull in testpkg-http-core from the addon repo
%packages
%end
# Start the proxy server
%include scripts/proxy-common.ks
# Set a password on the proxy server
%pre
echo 'anaconda:qweqwe' > /tmp/proxy.password
%end
%post --nochroot
# Look for the following as evidence that a proxy was used:
# a .treeinfo request
grep -q '\.treeinfo$' /tmp/proxy.log
if [[ $? -ne 0 ]]; then
echo '.treeinfo request was not proxied' >> $ANA_INSTALL_PATH/root/RESULT
fi
# primary.xml from the repodata
grep -q 'repodata/.*primary.xml' /tmp/proxy.log
if [[ $? -ne 0 ]]; then
echo 'repodata requests were not provxied' >> $ANA_INSTALL_PATH/root/RESULT
fi
# the kernel package from the Fedora repo
grep -q 'kernel-.*\.rpm' /tmp/proxy.log
if [[ $? -ne 0 ]]; then
echo 'base repo package requests were not proxied' >> $ANA_INSTALL_PATH/root/RESULT
fi
# testpkg-http-core from the addon repo
grep -q 'testpkg-http-core.*\.rpm' /tmp/proxy.log
if [[ $? -ne 0 ]]; then
echo 'addon repo package requests were not proxied' >> $ANA_INSTALL_PATH/root/RESULT
fi
# Check that the addon repo file was installed
if [[ ! -f $ANA_INSTALL_PATH/etc/yum.repos.d/kstest-http.repo ]]; then
echo 'kstest-http.repo does not exist' >> $ANA_INSTALL_PATH/root/RESULT
fi
# Check that the proxy configuration was written to the repo file
grep -q 'proxy=http://anaconda:[email protected]:8080' $ANA_INSTALL_PATH/etc/yum.repos.d/kstest-http.repo
if [[ $? -ne 0 ]]; then
echo 'kstest-http.repo does not contain proxy information' >> $ANA_INSTALL_PATH/root/RESULT
fi
# Check that the installed repo file is usable
# dnf exits with 0 even if something goes wrong, so do a repoquery and look for
# the package in the output
chroot $ANA_INSTALL_PATH \
dnf --disablerepo=\* --enablerepo=kstest-http --quiet repoquery testpkg-http-core 2>/dev/null | \
grep -q 'testpkg-http-core'
if [[ $? -ne 0 ]]; then
echo 'unable to query kstest-http repo' >> $ANA_INSTALL_PATH/root/RESULT
fi
# Finally, check that the repoquery used the proxy
tail -1 /tmp/proxy.log | grep -q repodata
if [[ $? -ne 0 ]]; then
echo 'repoquery on installed system was not proxied' >> $ANA_INSTALL_PATH/root/RESULT
fi
# If nothing was written to RESULT, it worked
if [[ ! -f $ANA_INSTALL_PATH/root/RESULT ]]; then
echo 'SUCCESS' > $ANA_INSTALL_PATH/root/RESULT
fi
%end