]> xenbits.xensource.com Git - people/aperard/osstest.git/commitdiff
Osstest/RedHat: kickstart: handle httpproxy in %post hook
authorAnthony PERARD <anthony.perard@citrix.com>
Fri, 8 Jun 2018 15:37:26 +0000 (16:37 +0100)
committerAnthony PERARD <anthony.perard@citrix.com>
Thu, 12 Jul 2018 15:49:19 +0000 (16:49 +0100)
Osstest/RedHat.pm

index afa3eb1d7f279ae39f7939217200206483a1c1a2..71e5bd841667fef0c20a75c3c6aa5e38954b167f 100644 (file)
@@ -205,6 +205,21 @@ BOOTPROTO=dhcp
 ENDCFG
 END
 
+    if ($c{HttpProxy}) {
+        # This will always use mirror.centos.org, so packages can be cached by
+        # a HTTP proxy
+        kickstart_hook_command($ho, 'post', <<END);
+cat <<EOF >> /etc/yum.conf
+proxy=$c{HttpProxy}
+EOF
+
+repo_file=/etc/yum.repos.d/CentOS-Base.repo
+if test -e "\$repo_file"; then
+    sed -i -r -e 's/^mirrorlist=/#\\0/; s/^#(baseurl=)/\\1/;' "\$repo_file"
+fi
+END
+    }
+
     # pre & post sections
     $kickstart_file .= kickstart_hook_cmds();