2001-07-28 07:54:52 +00:00
|
|
|
#!/usr/bin/perl -w
|
|
|
|
|
|
|
|
# mplayer postinst
|
|
|
|
|
|
|
|
require ConfHelper;
|
|
|
|
|
2002-02-03 20:27:20 +00:00
|
|
|
use Debconf::Client::ConfModule qw(:all);
|
2001-07-28 07:54:52 +00:00
|
|
|
use IO::Handle;
|
|
|
|
use Fcntl;
|
|
|
|
my $version = version(1.0);
|
|
|
|
my @savedolddata = ();
|
|
|
|
my $didupgrade = 0;
|
|
|
|
|
|
|
|
dealwithupgrades();
|
|
|
|
|
2002-08-27 09:57:12 +00:00
|
|
|
my $mcfg = new ConfHelper('mplayer', "/etc/mplayer/mplayer.conf");
|
2001-07-28 07:54:52 +00:00
|
|
|
$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"));
|
2001-08-25 19:40:04 +00:00
|
|
|
$dcarea .= "\n";
|
2001-07-28 07:54:52 +00:00
|
|
|
|
|
|
|
$mcfg->setconfarea($dcarea);
|
|
|
|
|
|
|
|
if ($didupgrade) {
|
2001-08-07 08:59:27 +00:00
|
|
|
$mcfg->setotherarea_DANGEROUS(@savedolddata);
|
2001-07-28 07:54:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#%###################################
|
|
|
|
|
|
|
|
exit unless (get("mplayer/configure") eq 'true');
|
|
|
|
exit unless (fget("mplayer/configure", "isdefault") eq 'false');
|
|
|
|
|
2001-08-05 19:11:58 +00:00
|
|
|
#%##################################
|
|
|
|
get("mplayer/cfgnote");
|
|
|
|
|
2001-07-28 07:54:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
sub dealwithupgrades {
|
2002-08-27 09:57:12 +00:00
|
|
|
open(OLDCONF, "</etc/mplayer/mplayer.conf") || return 1;
|
2001-07-28 07:54:52 +00:00
|
|
|
close OLDCONF;
|
|
|
|
|
2002-08-27 09:57:12 +00:00
|
|
|
my $mconf = new ConfHelper("mplayer", "/etc/mplayer/mplayer.conf");
|
2001-07-28 07:54:52 +00:00
|
|
|
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;
|
2002-08-27 09:57:12 +00:00
|
|
|
for my $file ("/etc/mplayer/mplayer.conf"
|
2001-07-28 07:54:52 +00:00
|
|
|
#, "/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";
|
|
|
|
}
|