Mercurial > mplayer.hg
annotate debian/postinst @ 6536:87942adf9c1c
IF09 added
author | arpi |
---|---|
date | Sun, 23 Jun 2002 19:31:31 +0000 |
parents | 0737156ad1f0 |
children | 6746866a94c6 |
rev | line source |
---|---|
1398 | 1 #!/usr/bin/perl -w |
2 | |
3 # mplayer postinst | |
4 | |
5 require ConfHelper; | |
6 | |
4521
0737156ad1f0
Juergen Kreileder changes, fixing some lintian errors, adding correct manpath and adding
eyck
parents:
1691
diff
changeset
|
7 use Debconf::Client::ConfModule qw(:all); |
1398 | 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 my $mcfg = new ConfHelper('mplayer', "/etc/mplayer.conf"); | |
17 $mcfg->setconfarea(" | |
18 #MPlayer config file generated by .deb package. | |
19 #ffactor = 0.9 | |
20 #fs = yes | |
21 "); | |
22 | |
23 ########################################################################### | |
24 | |
25 debug("Configuring video output driver..."); | |
26 | |
27 my $dcarea = <<"EOF"; | |
28 # MPlayer video output driver, configured by mplayer.deb | |
29 EOF | |
30 | |
31 $dcarea .= "vo=" . scalar(get("mplayer/voutput")); | |
1691 | 32 $dcarea .= "\n"; |
1398 | 33 |
34 $mcfg->setconfarea($dcarea); | |
35 | |
36 if ($didupgrade) { | |
1458 | 37 $mcfg->setotherarea_DANGEROUS(@savedolddata); |
1398 | 38 } |
39 | |
40 #%################################### | |
41 | |
42 exit unless (get("mplayer/configure") eq 'true'); | |
43 exit unless (fget("mplayer/configure", "isdefault") eq 'false'); | |
44 | |
1442 | 45 #%################################## |
46 get("mplayer/cfgnote"); | |
47 | |
1398 | 48 |
49 | |
50 sub dealwithupgrades { | |
51 open(OLDCONF, "</etc/mplayer.conf") || return 1; | |
52 close OLDCONF; | |
53 | |
54 my $mconf = new ConfHelper("mplayer", "/etc/mplayer.conf"); | |
55 return 1 if ($mconf->hasconfarea()); | |
56 undef $mconf; | |
57 | |
58 if ((get('mplayer/replace-existing-files') eq 'true') && | |
59 (fget('mplayer/replace-existing-files', 'isdefault') eq 'false')) { | |
60 print STDERR "Upgrading...\n"; | |
61 #? saveolddata("/etc/network/interfaces", "pppconf"); | |
62 $didupgrade = 1; | |
63 for my $file ("/etc/mplayer.conf" | |
64 #, "/etc/mplayer/fonts/sth | |
65 ) { | |
66 debug("Deleting $file"); | |
67 unlink $file; | |
68 } | |
69 } else { | |
70 print STDERR "Upgrade refused, exiting.\n"; | |
71 exit 0; | |
72 } | |
73 } | |
74 | |
75 # Gets any debconf area for other packages and saves it off. | |
76 | |
77 sub saveolddata { | |
78 my ($file, $package) = @_; | |
79 my $conf = new ConfHelper($package, $file); | |
80 push(@savedolddata, $conf->{startline} . "\n"); | |
81 push(@savedolddata, $conf->getconfarea()); | |
82 push(@savedolddata, $conf->{endline} . "\n"); | |
83 } | |
84 | |
85 sub debug { | |
86 print STDERR @_, "\n"; | |
87 } |