home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / dictionaries-common / dc-debconf-select.pl next >
Encoding:
Text File  |  2006-07-12  |  1.3 KB  |  52 lines

  1.  
  2. sub dc_debconf_select (){
  3.   my $class    = shift;
  4.   my $priority = shift;
  5.   my $question = "shared/packages-$class";
  6.   my @newchoices = ();
  7.   my @oldchoices = ();
  8.   
  9.   $priority = "medium" if not $priority;
  10.   
  11.   if ( $class eq "ispell" ){
  12.     $title = "Dictionaries-common: Ispell dictionary"; 
  13.   } else {
  14.     $title = "Dictionaries-common: Wordlist dictionary"; 
  15.   }
  16.   
  17.   my ($errorcode,$pkgowners) = metaget ($question, "owners");
  18.   return if $errorcode;
  19.   
  20.   foreach (split (/\s*,\s*/, $pkgowners)){
  21.     my $entry = metaget ("$_/languages", "default");
  22.     for ( $entry ){ # trim leading/trailing whitespaces the perlfaq way
  23.         s/^\s+//;
  24.         s/\s+$//;
  25.       }
  26.     push (@newchoices, split(/\s*,\s*/, $entry));
  27.   }
  28.   my $choices = join (', ', sort {lc $a cmp lc $b} @newchoices);
  29.   
  30.   $question = "dictionaries-common/default-$class";
  31.   @oldchoices = split(/\s*,\s*/,metaget ($question, "choices"));
  32.   pop @oldchoices;
  33.   my $oldchoices = join (', ', @oldchoices);
  34. #    print STDERR "**\nnew:$choices\nold:$oldchoices\n";
  35.   unless ( scalar @newchoices == 0 ) { 
  36.     if ( $choices ne $oldchoices ) {
  37.       subst ($question, "choices", $choices);
  38.       fset ($question, "seen", "false");
  39.     }   
  40.     input ($priority, $question);
  41.     title ($title);
  42.     go ();
  43.     }
  44. }
  45.  
  46. #Local Variables:
  47. #perl-indent-level: 2
  48. #End:
  49.  
  50. 1;
  51.  
  52.