annotate debian/postinst @ 7195:a5b2566f3c2b

print only fatal/error/warning to stderr, others go to stdout (actually reversed Nick's r1.10 commit)
author arpi
date Sat, 31 Aug 2002 13:44:03 +0000
parents 6746866a94c6
children e59659bea3e0
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
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
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
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
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
17 $mcfg->setconfarea("
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
18 #MPlayer config file generated by .deb package.
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
19 #ffactor = 0.9
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
20 #fs = yes
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
21 ");
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
22
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 debug("Configuring video output driver...");
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 my $dcarea = <<"EOF";
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
28 # MPlayer video output driver, configured by mplayer.deb
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
29 EOF
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
30
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
31 $dcarea .= "vo=" . scalar(get("mplayer/voutput"));
1691
0679bc99888f man goes to /usr/share
eyck
parents: 1458
diff changeset
32 $dcarea .= "\n";
1398
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
33
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
34 $mcfg->setconfarea($dcarea);
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
35
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
36 if ($didupgrade) {
1458
bd05276ed3d7 typo noticed by Amy.
eyck
parents: 1442
diff changeset
37 $mcfg->setotherarea_DANGEROUS(@savedolddata);
1398
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
38 }
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 #%###################################
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
41
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
42 exit unless (get("mplayer/configure") eq 'true');
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
43 exit unless (fget("mplayer/configure", "isdefault") eq 'false');
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
44
1442
50dc44570cd4 nice texts. substvars shouldn't be in cvs.
eyck
parents: 1398
diff changeset
45 #%##################################
50dc44570cd4 nice texts. substvars shouldn't be in cvs.
eyck
parents: 1398
diff changeset
46 get("mplayer/cfgnote");
50dc44570cd4 nice texts. substvars shouldn't be in cvs.
eyck
parents: 1398
diff changeset
47
1398
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
48
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
49
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
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
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
52 close OLDCONF;
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
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
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
55 return 1 if ($mconf->hasconfarea());
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
56 undef $mconf;
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 if ((get('mplayer/replace-existing-files') eq 'true') &&
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
59 (fget('mplayer/replace-existing-files', 'isdefault') eq 'false')) {
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
60 print STDERR "Upgrading...\n";
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
61 #? saveolddata("/etc/network/interfaces", "pppconf");
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
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
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
64 #, "/etc/mplayer/fonts/sth
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
65 ) {
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
66 debug("Deleting $file");
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
67 unlink $file;
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
68 }
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
69 } else {
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
70 print STDERR "Upgrade refused, exiting.\n";
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
71 exit 0;
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 }
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
74
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
75 # Gets any debconf area for other packages and saves it off.
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 sub saveolddata {
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
78 my ($file, $package) = @_;
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
79 my $conf = new ConfHelper($package, $file);
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
80 push(@savedolddata, $conf->{startline} . "\n");
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
81 push(@savedolddata, $conf->getconfarea());
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
82 push(@savedolddata, $conf->{endline} . "\n");
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
83 }
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
84
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
85 sub debug {
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
86 print STDERR @_, "\n";
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
87 }