diff options
author | Steffen Joeris <white@debian.org> | 2006-09-06 04:56:38 +0000 |
---|---|---|
committer | Steffen Joeris <white@debian.org> | 2006-09-06 04:56:38 +0000 |
commit | 09a03897657091c3ea90b77d71eb09a27cbd0445 (patch) | |
tree | 3430e87a14497984c2d0cfbd83de00c5bea53873 | |
parent | 62ba6a65cd0348f1c2f8472f533f4906834f5010 (diff) | |
download | sitesummary-09a03897657091c3ea90b77d71eb09a27cbd0445.tar.gz sitesummary-09a03897657091c3ea90b77d71eb09a27cbd0445.tar.bz2 sitesummary-09a03897657091c3ea90b77d71eb09a27cbd0445.tar.xz |
* Reduce the code and also reflect if we have more
than one profile
-rw-r--r-- | SiteSummary.pm | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/SiteSummary.pm b/SiteSummary.pm index 1469f5d..5ed7541 100644 --- a/SiteSummary.pm +++ b/SiteSummary.pm @@ -89,23 +89,15 @@ sub get_debian_edu_ver { print STDERR "error: Missing $debian_edu_config file.\n"; return undef; } - my $profiles = "Main-Server Workstation Thin-Client-Server Standalone"; - my @profile = split(/ /, $profiles); - open(FILE, $debian_edu_config) or die "$!: $debian_edu_config\nDied"; - while ( my @config = <FILE> ) { - if ( "@config" =~ "$profile[0]" ) { - return $profile[0]; - }elsif ( "@config" =~ "$profile[1]" ) { - return $profile[1]; - }elsif ( "@config" =~ "$profile[2]" ) { - return $profile[2]; - }elsif ( "@config" =~ "$profile[3]" ) { - return $profile[3]; - }else{ - print STDERR "error: Can't determine debian-edu profile.\n"; - return undef; - } - } + if (open (FILE, $debian_edu_config)) { + while (<FILE>) { + chomp; + s/\#.+$//; + next if not (/PROFILE/); + s/^"PROFILE=//; + return $_; + } + } close(FILE); } |