~ubuntu-branches/ubuntu/utopic/kget/utopic

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
#!/usr/bin/perl

$doChange=0;
$connections=0;

while(<>)
{
    ($key)   = ($_ =~ /([^=]*)=(.*)$/);
    ($value) = ($_ =~ /^[^=]*=(.*)$/);

    if( $key eq "LimitDownloads" )
    {
        if ( $value eq "false" )
        {
            $doChange=1;
        }
        print "# DELETE " . $key . "\n";
        next;
    }
    if ( $key eq "MaxConnections" )
    {
        $connections=$value;
        print "# DELETE MaxConnections\n";
        next;
    }

    print $_;
}

if ( $doChange eq 1 )
{
    print "MaxConnections=0\n";
} else {
    print "MaxConnections=" . $connections . "\n";
}