Comment out the correct #endif directive.
[mplayer/greg.git] / debian / postinst
blobe8fb6367abc7aafed1822295f0b12af6c01877c9
1 #!/usr/bin/perl -w
3 # mplayer postinst
5 require ConfHelper;
7 use Debconf::Client::ConfModule qw(:all);
8 use IO::Handle;
9 use Fcntl;
10 my $version = version(2.0);
11 my $didupgrade = 0;
13 dealwithupgrades();
15 my $mcfg = new ConfHelper('mplayer', "/etc/mplayer/mplayer.conf");
19 my $dcarea = "" ;
20 my $font = scalar(get("mplayer/ttfont")) ;
21 $dcarea .= "#truetype font\nfont=" . $font . "\n" if $font;
22 $mcfg->setconfarea($dcarea);
26 sub dealwithupgrades {
27 open(OLDCONF, "</etc/mplayer/mplayer.conf") || return 1;
28 close OLDCONF;
30 my $mconf = new ConfHelper("mplayer", "/etc/mplayer/mplayer.conf");
31 return 1 if ($mconf->hasconfarea());
32 undef $mconf;
34 if ((get('mplayer/replace-existing-files') eq 'true') &&
35 (fget('mplayer/replace-existing-files', 'isdefault') eq 'false')) {
36 $didupgrade = 1;
37 for my $file ("/etc/mplayer/mplayer.conf" ) {
38 debug("Moving away $file");
39 rename($file,$file . ".old");
41 } else {
42 debug("Upgrade refused, exiting");
43 exit 0;
47 sub debug {
48 print STDERR @_, "\n";
52 # pass control to debhelper scripts..
54 my $temp="set -e\nset -- @ARGV\n" . << 'DEBHELPER_EOF_';
55 #DEBHELPER#
56 DEBHELPER_EOF_
57 system ($temp) / 256 == 0
58 or die "Problem with debhelper scripts: $!";