diff options
author | attila <attila@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-02-09 12:26:11 +0000 |
---|---|---|
committer | attila <attila@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-02-09 12:26:11 +0000 |
commit | b571babb131b338653162dd2d4d5da529860b011 (patch) | |
tree | 599c911e26a31f1f25c08616334df4bd3b67b717 /debian-build/postinst | |
parent | 381752776c08d84ef9b8d2d54add027625231b74 (diff) | |
download | mpv-b571babb131b338653162dd2d4d5da529860b011.tar.bz2 mpv-b571babb131b338653162dd2d4d5da529860b011.tar.xz |
Adding debian-build directory by request of Deriush Pietrzak
This is thought for creating debian binary packages for distribution.
IMPORTANT: THIS DOESNT WORK CURRENTLY
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9365 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'debian-build/postinst')
-rwxr-xr-x | debian-build/postinst | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/debian-build/postinst b/debian-build/postinst new file mode 100755 index 0000000000..85fc11e227 --- /dev/null +++ b/debian-build/postinst @@ -0,0 +1,87 @@ +#!/usr/bin/perl -w + +# mplayer postinst + +require ConfHelper; + +use Debconf::Client::ConfModule qw(:all); +use IO::Handle; +use Fcntl; +my $version = version(1.0); +my @savedolddata = (); +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"; + +$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 { + 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')) { + 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; + } + } 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"; +} |