view debian/postinst @ 27146:a8681ded2d41

r25756: Document vo gl lscale=3 r25757: Add experimental unsharp-mask OpenGL scaler. r25767: misc spelling fixes r25768: misc markup fixes r25769: better ao/vo profile examples r25786: Add a fragment program for 5x5 unsharp masking r25821: (instead of adding quotation mark, this added a missing paragraph!) r25955: (previously applied) r25973: Hint about possible libmpeg2 problems with -hardframedrop r25984: Slightly document alpha for OSD color r26014: -dumpstream will not dump chapters anymore r26015: Document that framedrop needs -no-correct-pts r26017: removed wrong example
author kraymer
date Mon, 30 Jun 2008 19:35:36 +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: $!";