[Mplayer-cvslog] CVS: main/debian config,NONE,1.1 postinst,1.3,1.4 templates,NONE,1.1

Dariush Pietrzak eyck at mplayer.dev.hu
Sat Jul 28 09:54:54 CEST 2001


Update of /cvsroot/mplayer/main/debian
In directory mplayer:/var/tmp.root/cvs-serv16155

Added Files:
	config postinst templates 
Log Message:
update to perl debconf. fixed problem with configure.


--- NEW FILE ---
#!/usr/bin/perl -w

# Script to configure mplayer 
# based on etherconf by John Goerzen <jgoerzen at progenylinux.com>

use Debian::DebConf::Client::ConfModule qw(:all);

my $version = version(2.0);
title('MPlayer Configuration');
my $PRIORITY = 'high';
#TODO: 'medium'
my $next = 'mainmenu';
my $isediting = 0;

my @nextargs = ();

checkupgrade();			# Find out if we have to upgrade.
mainloop(letsgo());

sub checkupgrade {
  open(MCFG, "</etc/mplayer.conf") || return 1;
  my $line = <MCFG>;
  return 1 if ($line =~ /mplayer DEBCONF AREA/);
  exit(0) if (input($PRIORITY, 'mplayer/replace-existing-files') eq "question skipped");
  go();
  if (get('mplayer/replace-existing-files') eq 'false') {
    input($PRIORITY, 'mplayer/replace-existing-files-bail');
    go();
    exit();
  }
  close MCFG;
}

sub mainloop {
  $next = shift @_;
  do {
    my @retval = &$next(@nextargs);
    #  if ($retval[0] eq 'BACK') {
    #    $retval[0] = $backups{$next};
    #  }
    ($next, @nextargs) = @retval;
  } while ($next ne 'Exit');
}

sub letsgo {
#useless!
  return "configure";
}

sub configure {
  subst("mplayer/voutput", "vochoices", "xv, xmga, mga, x11, gl, sdl");
  # db_subst mplayer/output vo xc,xmga,mga,x11,gl,sdl
  exit(0) if (input($PRIORITY, "mplayer/voutput") eq "question skipped");
  go();
  exit 0 unless (get("mplayer/voutput") eq 'true');
  #return 'audioout';
  return 'mainmenu';
}

sub mainmenu {
  go();				# To catch spare things from before
  my @choices = (
    'Video Output: ' . scalar(get("mplayer/voutput")));
    #,
  $choices = join(', ', @choices);
  $isediting = 1;
  
  subst('mplayer/mainmenu', 'choices', $choices);
  input($PRIORITY, 'mplayer/mainmenu');
  go();
  
  my $selection = get('mplayer/mainmenu');
  if ($selection =~ /^Exit/) {
    return 'Exit';
  }

  # Set to redisplay.
  fset('mplayer/mainmenu', 'isdefault', 'true');

  $_ = $selection;

  return 'configure' if /^Video/;
#  return 'aoutput' if /^Aoutput/;
  return 'Exit';
}
      
sub editreturn {
  my @args = @_;
  return 'mainmenu' if $isediting;
  return @args;
}

sub editfix {
  my $template = shift @_;
  if ($isediting) {
    fset($template, 'isdefault', 'true');
  }
}


--- NEW FILE ---
Template: mplayer/replace-existing-files
Type: boolean
Default: true
Description: Upgrade existing system?
 It looks like you've configured your mplayer already.
 If you'd like to configure it with this program, I'll have
 to delete the old configuration.  Do you want to continue
 configuration with this program?  If you say "yes", I'll go ahead
 and delete your old configuration and you can create it anew with
 this program. 

Template: mplayer/replace-existing-files-bail
Type: note
Description: Files not replaced
 I'm going to exit now since you don't want me to replace your
 existing files.  If you change your mind later, you can run
 dpkg-reconfigure mplayer.

Template: mplayer/mainmenu
Type: select
Choices: ${choices}, Exit
Description: MPlayer Main Menu
 From this menu, you can modify any of the settings for your device.
 Simply select the item you'd like to change to modify it.
 When you are done, select Exit.

Template: mplayer/voutput
Type: select
Choices: ${vochoices}, x11
Description: MPlayer Video Output
 Yada yada..





More information about the MPlayer-cvslog mailing list