Mercurial > mplayer.hg
annotate debian/postinst @ 7925:6e937de68683
Gregory Kovriga added
author | arpi |
---|---|
date | Sat, 26 Oct 2002 15:06:50 +0000 |
parents | 6746866a94c6 |
children | e59659bea3e0 |
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 | |
7096
6746866a94c6
Use the confdir we compiled with (/etc/mplayer/mplayer.conf instead of
diego
parents:
4521
diff
changeset
|
16 my $mcfg = new ConfHelper('mplayer', "/etc/mplayer/mplayer.conf"); |
1398 | 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 { | |
7096
6746866a94c6
Use the confdir we compiled with (/etc/mplayer/mplayer.conf instead of
diego
parents:
4521
diff
changeset
|
51 open(OLDCONF, "</etc/mplayer/mplayer.conf") || return 1; |
1398 | 52 close OLDCONF; |
53 | |
7096
6746866a94c6
Use the confdir we compiled with (/etc/mplayer/mplayer.conf instead of
diego
parents:
4521
diff
changeset
|
54 my $mconf = new ConfHelper("mplayer", "/etc/mplayer/mplayer.conf"); |
1398 | 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; | |
7096
6746866a94c6
Use the confdir we compiled with (/etc/mplayer/mplayer.conf instead of
diego
parents:
4521
diff
changeset
|
63 for my $file ("/etc/mplayer/mplayer.conf" |
1398 | 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 } |