~ubuntu-branches/ubuntu/natty/knemo/natty

« back to all changes in this revision

Viewing changes to src/kconf_update/knemo-0.5.1-iconsets.pl

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2011-02-22 16:36:22 UTC
  • mfrom: (1.1.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20110222163622-d8i62gy1stn7tydv
Tags: 0.7.0-0ubuntu1
* New upstream release.
* Switch to source format 3.0 (quilt).
* Make knemo depend on libqt4-sql-sqlite.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl -w
 
2
 
 
3
# Change IconSet values from int to their text values
 
4
 
 
5
use strict;
 
6
 
 
7
my $currentGroup = "";
 
8
my %configFile;
 
9
while ( <> ) {
 
10
    chomp;
 
11
    next if ( /^$/ );
 
12
    next if ( /^\#/ );
 
13
    if ( /^\[/ ) {
 
14
        $currentGroup = $_;
 
15
        next;
 
16
    } elsif ( $currentGroup ne "" ) {
 
17
        my ($key,$value) = split /=/;
 
18
        $configFile{$currentGroup}{$key}=$value;
 
19
    }
 
20
}
 
21
 
 
22
my @ifaceGroups = grep { /^\[Interface_\S+\]/ } keys %configFile;
 
23
 
 
24
my $newSet;
 
25
foreach my $ifaceGroup (@ifaceGroups) {
 
26
    my $oldSet = $configFile{$ifaceGroup}{'IconSet'};
 
27
    $newSet = $oldSet;
 
28
    if ( $oldSet eq "0" ) {
 
29
        $newSet = "monitor";
 
30
    }
 
31
    elsif ( $oldSet eq "1" ) {
 
32
        $newSet = "modem";
 
33
    }
 
34
    elsif ( $oldSet eq "2" ) {
 
35
        $newSet = "network";
 
36
    }
 
37
    elsif ( $oldSet eq "3" ) {
 
38
        $newSet = "wireless";
 
39
    }
 
40
 
 
41
    print "# DELETE ${ifaceGroup}IconSet\n";
 
42
    print "${ifaceGroup}\nIconSet=$newSet\n";
 
43
}