home *** CD-ROM | disk | FTP | other *** search
- # -------------------------------------------------------------------------------
- # dc-debconf-select.pl:
- # This file will be added to end of dictionaries-common.config-base
- # to make dictionaries-common.config, as well as installed under
- # /usr/share/dictionaries-common for single ispell dicts /wordlists use
- # -------------------------------------------------------------------------------
-
- sub dc_debconf_select (){
- my $class = shift;
- my $priority = shift;
- my $question = "shared/packages-$class";
- my $debug = "yes" if exists $ENV{'DICT_COMMON_DEBUG'};
- my @newchoices = ();
- my @oldchoices = ();
- my %title = ('ispell' => "Dictionaries-common: Ispell dictionary",
- 'wordlist' => "Dictionaries-common: Wordlist dictionary"
- );
-
- $priority = "medium" unless $priority;
-
- my ($errorcode,$pkgowners) = metaget ($question, "owners");
- return if $errorcode;
-
- foreach (split (/\s*,\s*/, $pkgowners)){
- my $entry = metaget ("$_/languages", "default");
- for ( $entry ){ # trim leading/trailing whitespaces
- s/^\s+//;
- s/\s+$//;
- }
- push (@newchoices, split(/\s*,\s*/, $entry));
- }
- my $choices = join (', ', sort {lc $a cmp lc $b} @newchoices);
-
- $question = "dictionaries-common/default-$class";
- @oldchoices = split(/\s*,\s*/,metaget ($question, "choices"));
- pop @oldchoices;
- my $oldchoices = join (', ', @oldchoices);
- print STDERR "** dictionaries-common: $class, $priority, $question\n" .
- " new:[$choices]\n old:[$oldchoices]\n" if $debug;
- unless ( scalar @newchoices == 0 ) {
- if ( $choices ne $oldchoices ) {
- subst ($question, "choices", $choices);
- fset ($question, "seen", "false");
- }
- input ($priority, $question);
- title ($title{$class});
- go ();
- }
-
- # If called from dictionaries-common.config, check actual values in debug mode
- if ( $debug && $fromdcconfig ){
- print STDERR "** dictionaries-common.config: Checking some real values for $question\n";
- print STDERR " Real choices: " . metaget ($question, "choices") . "\n";
- print STDERR " Real value: " . get ($question) . "\n";
- print STDERR "---\n";
- }
- }
-
- # Local Variables:
- # perl-indent-level: 2
- # End:
-
- 1;
-
-