summaryrefslogtreecommitdiffstats
path: root/debian/postinst
diff options
context:
space:
mode:
authoreyck <eyck@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-07-28 07:54:52 +0000
committereyck <eyck@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-07-28 07:54:52 +0000
commit22f0bb22c5a5405bdfb3aaf3ce2ae555c83e4cc6 (patch)
tree293e87f64b28c33898569b8ffe6cd3aded56b8a5 /debian/postinst
parentba516b3a40acfc92f59ad786119b0594d5e5a98e (diff)
downloadmpv-22f0bb22c5a5405bdfb3aaf3ce2ae555c83e4cc6.tar.bz2
mpv-22f0bb22c5a5405bdfb3aaf3ce2ae555c83e4cc6.tar.xz
update to perl debconf. fixed problem with configure.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1399 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'debian/postinst')
-rwxr-xr-xdebian/postinst88
1 files changed, 88 insertions, 0 deletions
diff --git a/debian/postinst b/debian/postinst
new file mode 100755
index 0000000000..8853b8f73a
--- /dev/null
+++ b/debian/postinst
@@ -0,0 +1,88 @@
+#!/usr/bin/perl -w
+
+# mplayer postinst
+
+require ConfHelper;
+
+use Debian::DebConf::Client::ConfModule qw(:all);
+use IO::Handle;
+use Fcntl;
+my $version = version(1.0);
+my @savedolddata = ();
+my $didupgrade = 0;
+
+dealwithupgrades();
+
+# We add lo0 right now, useful in case we exit anyway.
+
+my $mcfg = new ConfHelper('mplayer', "/etc/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 config file,
+
+# MPlayer video output driver, configured by mplayer.deb
+EOF
+
+ $dcarea .= "vo=" . scalar(get("mplayer/voutput"));
+$dcarea .= "\n";
+
+$mcfg->setconfarea($dcarea);
+
+if ($didupgrade) {
+ $interfaces->setotherarea_DANGEROUS(@savedolddata);
+}
+
+#%###################################
+
+exit unless (get("mplayer/configure") eq 'true');
+exit unless (fget("mplayer/configure", "isdefault") eq 'false');
+
+
+
+sub dealwithupgrades {
+ open(OLDCONF, "</etc/mplayer.conf") || return 1;
+ close OLDCONF;
+
+ my $mconf = new ConfHelper("mplayer", "/etc/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.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";
+}