annotate debian/postinst @ 1458:bd05276ed3d7

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