annotate debian-build/postinst @ 12040:cdc4feff6023

-adapter, -refreshrate options, based on patch by Sascha Sommer
author diego
date Thu, 18 Mar 2004 01:19:20 +0000
parents 33f43b0f24f7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9364
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
1 #!/usr/bin/perl -w
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
2
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
3 # mplayer postinst
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
4
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
5 require ConfHelper;
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
6
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
7 use Debconf::Client::ConfModule qw(:all);
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
8 use IO::Handle;
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
9 use Fcntl;
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
10 my $version = version(1.0);
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
11 my @savedolddata = ();
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
12 my $didupgrade = 0;
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
13
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
14 dealwithupgrades();
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
15
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
16 my $mcfg = new ConfHelper('mplayer', "/etc/mplayer/mplayer.conf");
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
17 $mcfg->setconfarea("
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
18 #MPlayer config file generated by .deb package.
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
19 #ffactor = 0.9
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
20 #fs = yes
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
21 ");
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
22
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
23 ###########################################################################
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
24
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
25 debug("Configuring video output driver...");
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
26
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
27 my $dcarea = <<"EOF";
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
28 # MPlayer video output driver, configured by mplayer.deb
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
29 EOF
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
30
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
31 $dcarea .= "vo=" . scalar(get("mplayer/voutput"));
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
32 $dcarea .= "\n";
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
33
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
34 $mcfg->setconfarea($dcarea);
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
35
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
36 if ($didupgrade) {
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
37 $mcfg->setotherarea_DANGEROUS(@savedolddata);
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
38 }
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
39
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
40 #%###################################
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
41
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
42 exit unless (get("mplayer/configure") eq 'true');
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
43 exit unless (fget("mplayer/configure", "isdefault") eq 'false');
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
44
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
45 #%##################################
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
46 get("mplayer/cfgnote");
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
47
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
48
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
49
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
50 sub dealwithupgrades {
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
51 open(OLDCONF, "</etc/mplayer/mplayer.conf") || return 1;
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
52 close OLDCONF;
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
53
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
54 my $mconf = new ConfHelper("mplayer", "/etc/mplayer/mplayer.conf");
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
55 return 1 if ($mconf->hasconfarea());
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
56 undef $mconf;
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
57
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
58 if ((get('mplayer/replace-existing-files') eq 'true') &&
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
59 (fget('mplayer/replace-existing-files', 'isdefault') eq 'false')) {
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
60 print STDERR "Upgrading...\n";
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
61 #? saveolddata("/etc/network/interfaces", "pppconf");
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
62 $didupgrade = 1;
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
63 for my $file ("/etc/mplayer/mplayer.conf"
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
64 #, "/etc/mplayer/fonts/sth
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
65 ) {
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
66 debug("Deleting $file");
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
67 unlink $file;
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
68 }
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
69 } else {
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
70 print STDERR "Upgrade refused, exiting.\n";
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
71 exit 0;
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
72 }
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
73 }
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
74
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
75 # Gets any debconf area for other packages and saves it off.
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
76
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
77 sub saveolddata {
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
78 my ($file, $package) = @_;
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
79 my $conf = new ConfHelper($package, $file);
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
80 push(@savedolddata, $conf->{startline} . "\n");
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
81 push(@savedolddata, $conf->getconfarea());
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
82 push(@savedolddata, $conf->{endline} . "\n");
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
83 }
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
84
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
85 sub debug {
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
86 print STDERR @_, "\n";
33f43b0f24f7 Adding debian-build directory by request of Deriush Pietrzak
attila
parents:
diff changeset
87 }