Mercurial > mplayer.hg
comparison debian/postinst @ 1398:10e236ceac5e
update to perl debconf. fixed problem with configure.
author | eyck |
---|---|
date | Sat, 28 Jul 2001 07:54:52 +0000 |
parents | |
children | 50dc44570cd4 |
comparison
equal
deleted
inserted
replaced
1397:225b8fb7653f | 1398:10e236ceac5e |
---|---|
1 #!/usr/bin/perl -w | |
2 | |
3 # mplayer postinst | |
4 | |
5 require ConfHelper; | |
6 | |
7 use Debian::DebConf::Client::ConfModule qw(:all); | |
8 use IO::Handle; | |
9 use Fcntl; | |
10 my $version = version(1.0); | |
11 my @savedolddata = (); | |
12 my $didupgrade = 0; | |
13 | |
14 dealwithupgrades(); | |
15 | |
16 # We add lo0 right now, useful in case we exit anyway. | |
17 | |
18 my $mcfg = new ConfHelper('mplayer', "/etc/mplayer.conf"); | |
19 $mcfg->setconfarea(" | |
20 #MPlayer config file generated by .deb package. | |
21 #ffactor = 0.9 | |
22 #fs = yes | |
23 "); | |
24 | |
25 ########################################################################### | |
26 | |
27 debug("Configuring video output driver..."); | |
28 | |
29 my $dcarea = <<"EOF"; | |
30 # MPlayer config file, | |
31 | |
32 # MPlayer video output driver, configured by mplayer.deb | |
33 EOF | |
34 | |
35 $dcarea .= "vo=" . scalar(get("mplayer/voutput")); | |
36 $dcarea .= "\n"; | |
37 | |
38 $mcfg->setconfarea($dcarea); | |
39 | |
40 if ($didupgrade) { | |
41 $interfaces->setotherarea_DANGEROUS(@savedolddata); | |
42 } | |
43 | |
44 #%################################### | |
45 | |
46 exit unless (get("mplayer/configure") eq 'true'); | |
47 exit unless (fget("mplayer/configure", "isdefault") eq 'false'); | |
48 | |
49 | |
50 | |
51 sub dealwithupgrades { | |
52 open(OLDCONF, "</etc/mplayer.conf") || return 1; | |
53 close OLDCONF; | |
54 | |
55 my $mconf = new ConfHelper("mplayer", "/etc/mplayer.conf"); | |
56 return 1 if ($mconf->hasconfarea()); | |
57 undef $mconf; | |
58 | |
59 if ((get('mplayer/replace-existing-files') eq 'true') && | |
60 (fget('mplayer/replace-existing-files', 'isdefault') eq 'false')) { | |
61 print STDERR "Upgrading...\n"; | |
62 #? saveolddata("/etc/network/interfaces", "pppconf"); | |
63 $didupgrade = 1; | |
64 for my $file ("/etc/mplayer.conf" | |
65 #, "/etc/mplayer/fonts/sth | |
66 ) { | |
67 debug("Deleting $file"); | |
68 unlink $file; | |
69 } | |
70 } else { | |
71 print STDERR "Upgrade refused, exiting.\n"; | |
72 exit 0; | |
73 } | |
74 } | |
75 | |
76 # Gets any debconf area for other packages and saves it off. | |
77 | |
78 sub saveolddata { | |
79 my ($file, $package) = @_; | |
80 my $conf = new ConfHelper($package, $file); | |
81 push(@savedolddata, $conf->{startline} . "\n"); | |
82 push(@savedolddata, $conf->getconfarea()); | |
83 push(@savedolddata, $conf->{endline} . "\n"); | |
84 } | |
85 | |
86 sub debug { | |
87 print STDERR @_, "\n"; | |
88 } |