view debian/postinst @ 27697:099f8372c2cf

r27182: apply parameter name change of no-correct-pts from r26842 to man page r27208: dvd:// streams accept the device path in the url; patch by Mathieu SCHROETER mathieu.schroeter gamesover ch r27230: Give all shell scripts a .sh suffix for consistency. r27235: moved o option beetwen m* and p* r27236: another alphabetical order correction r27334: -border/-noborder are supported by gl/gl2, too, but only on Windows. r27337: No idea which vos support -noborder how well, though those based on X11 or running on Windows _should_ work. Just remove that line for now. r27342: Remove outdated "X11 only" from xineramascreen option and try to make clearer what it does and what it does not. r27348: add list of supported vo's to -xineramascreen
author kraymer
date Wed, 08 Oct 2008 16:22:23 +0000
parents a5bef61f49bf
children
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(2.0);
my $didupgrade = 0;

dealwithupgrades();

my $mcfg = new ConfHelper('mplayer', "/etc/mplayer/mplayer.conf");



my $dcarea = "" ;
my $font =  scalar(get("mplayer/ttfont"))  ;
  $dcarea .= "#truetype font\nfont=" . $font . "\n"   if $font;
$mcfg->setconfarea($dcarea);



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')) {
    $didupgrade = 1;
    for my $file ("/etc/mplayer/mplayer.conf"    ) {
      debug("Moving away $file");
      rename($file,$file . ".old");
    }
  } else {
    debug("Upgrade refused, exiting");
    exit 0;
  }
}

sub debug {
  print STDERR @_, "\n";
}


# pass control to debhelper scripts..
#
my $temp="set -e\nset -- @ARGV\n" . << 'DEBHELPER_EOF_';
#DEBHELPER#
DEBHELPER_EOF_
system ($temp) / 256 == 0
   or die "Problem with debhelper scripts: $!";