]> git.proxmox.com Git - pve-manager-legacy.git/commitdiff
tell apt to use http_proxy settings
authorDietmar Maurer <dietmar@proxmox.com>
Fri, 26 Jul 2013 07:26:24 +0000 (09:26 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 26 Jul 2013 07:26:24 +0000 (09:26 +0200)
PVE/API2/APT.pm

index e78d4c19bdc2495d7b14e8f562e794602627cd37..a8f42eb306e3364f6394d12c3a854f4b3ff26059 100644 (file)
@@ -249,6 +249,16 @@ __PACKAGE__->register_method({
        my $realcmd = sub {
            my $upid = shift;
 
+           # setup proxy for apt
+           my $dcconf = PVE::Cluster::cfs_read_file('datacenter.cfg');
+
+           my $aptconf = "// no proxy configured\n";
+           if ($dcconf->{http_proxy}) {
+               $aptconf = "Acquire::http::Proxy \"$dcconf->{http_proxy}\";\n";
+           }
+           my $aptcfn = "/etc/apt/apt.conf.d/76pveproxy";
+           PVE::Tools::file_set_contents($aptcfn, $aptconf);
+
            my $cmd = ['apt-get', 'update'];
 
            print "starting apt-get update\n";