diff debian/postinst @ 17346:a5bef61f49bf

Improve the Debian package configuration: Remove the vo module configuration, add a debconf TrueType font configuration. Based on the Debian package by Andrea Menucci.
author diego
date Sun, 08 Jan 2006 18:33:54 +0000
parents 93590989822a
children
line wrap: on
line diff
--- a/debian/postinst	Sun Jan 08 17:37:48 2006 +0000
+++ b/debian/postinst	Sun Jan 08 18:33:54 2006 +0000
@@ -7,44 +7,20 @@
 use Debconf::Client::ConfModule qw(:all);
 use IO::Handle;
 use Fcntl;
-my $version = version(1.0);
-my @savedolddata = ();
+my $version = version(2.0);
 my $didupgrade = 0;
 
 dealwithupgrades();
 
 my $mcfg = new ConfHelper('mplayer', "/etc/mplayer/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 video output driver, configured by mplayer.deb
-EOF
 
-  $dcarea .= "vo=" . scalar(get("mplayer/voutput"));
-  $dcarea .= ",\n";
-
+my $dcarea = "" ;
+my $font =  scalar(get("mplayer/ttfont"))  ;
+  $dcarea .= "#truetype font\nfont=" . $font . "\n"   if $font;
 $mcfg->setconfarea($dcarea);
 
-if ($didupgrade) {
-  $mcfg->setotherarea_DANGEROUS(@savedolddata);
-}
-
-#%###################################
-
-exit unless (get("mplayer/configure") eq 'true');
-exit unless (fget("mplayer/configure", "isdefault") eq 'false');
-
-#%##################################
-get("mplayer/cfgnote");
-
 
 
 sub dealwithupgrades {
@@ -57,31 +33,17 @@
 
   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/mplayer.conf"
-    #, "/etc/mplayer/fonts/sth
-    ) {
-      debug("Deleting $file");
-      unlink $file;
+    for my $file ("/etc/mplayer/mplayer.conf"    ) {
+      debug("Moving away $file");
+      rename($file,$file . ".old");
     }
   } else {
-    print STDERR "Upgrade refused, exiting.\n";
+    debug("Upgrade refused, exiting");
     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";
 }
@@ -89,6 +51,8 @@
 
 # pass control to debhelper scripts..
 #
-system <<EODEBHELPER;
+my $temp="set -e\nset -- @ARGV\n" . << 'DEBHELPER_EOF_';
 #DEBHELPER#
-EODEBHELPER
+DEBHELPER_EOF_
+system ($temp) / 256 == 0
+   or die "Problem with debhelper scripts: $!";