view debian/postinst @ 9278:caea8ed36b48

The reason why mplayer crashes (in some cases) when using x11 output and -wid (>0) parameter is this: Mplayer by default creates a colormap using DirectColor visual. If the window given to mplayer uses TrueColor visual there will be an error when mplayer sets the colormap for the window. This patch modifies mplayer to use TrueColor visual if the window given to mplayer uses TrueColor. Another solution is to make sure that the window given to mplayer is created using DirectColor visual if it is supported by the display. Jouni Tulkki <jitulkki@cc.hut.fi>
author arpi
date Tue, 04 Feb 2003 18:31:44 +0000
parents e59659bea3e0
children 93590989822a
line wrap: on
line source

#!/usr/bin/perl -w

# mplayer postinst

require ConfHelper;

use Debconf::Client::ConfModule qw(:all);
use IO::Handle;
use Fcntl;
my $version = version(1.0);
my @savedolddata = ();
my $didupgrade = 0;

dealwithupgrades();

my $mcfg = new ConfHelper('mplayer', "/etc/mplayer/mplayer.conf");
$mcfg->setconfarea("
#MPlayer config file generated by .deb package.
#ffactor	=	0.9
#fs	=	yes
");

###########################################################################

debug("Configuring video output driver...");

my $dcarea = <<"EOF";
# MPlayer video output driver, configured by mplayer.deb
EOF

  $dcarea .= "vo=" . scalar(get("mplayer/voutput"));
  $dcarea .= "\n";

$mcfg->setconfarea($dcarea);

if ($didupgrade) {
  $mcfg->setotherarea_DANGEROUS(@savedolddata);
}

#%###################################

exit unless (get("mplayer/configure") eq 'true');
exit unless (fget("mplayer/configure", "isdefault") eq 'false');

#%##################################
get("mplayer/cfgnote");



sub dealwithupgrades {
  open(OLDCONF, "</etc/mplayer/mplayer.conf") || return 1;
  close OLDCONF;

  my $mconf = new ConfHelper("mplayer", "/etc/mplayer/mplayer.conf");
  return 1 if ($mconf->hasconfarea());
  undef $mconf;

  if ((get('mplayer/replace-existing-files') eq 'true') &&
      (fget('mplayer/replace-existing-files', 'isdefault') eq 'false')) {
    print STDERR "Upgrading...\n";
#?    saveolddata("/etc/network/interfaces", "pppconf");
    $didupgrade = 1;
    for my $file ("/etc/mplayer/mplayer.conf"
    #, "/etc/mplayer/fonts/sth
    ) {
      debug("Deleting $file");
      unlink $file;
    }
  } else {
    print STDERR "Upgrade refused, exiting.\n";
    exit 0;
  }
}

# Gets any debconf area for other packages and saves it off.

sub saveolddata {
  my ($file, $package) = @_;
  my $conf = new ConfHelper($package, $file);
  push(@savedolddata, $conf->{startline} . "\n");
  push(@savedolddata, $conf->getconfarea());
  push(@savedolddata, $conf->{endline} . "\n");
}
		  
sub debug {
  print STDERR @_, "\n";
}


# pass control to debhelper scripts..
#
system <<EODEBHELPER;
#DEBHELPER#
EODEBHELPER