annotate debian/postinst @ 20194:10cebc4e94ae

code simplification and minor bug fix for files restarting rather than moving to the next file within the playlist.
author vayne
date Fri, 13 Oct 2006 17:30:41 +0000
parents a5bef61f49bf
children
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;
17346
a5bef61f49bf Improve the Debian package configuration: Remove the vo module configuration,
diego
parents: 17323
diff changeset
10 my $version = version(2.0);
1398
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
11 my $didupgrade = 0;
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
12
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
13 dealwithupgrades();
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
14
7096
6746866a94c6 Use the confdir we compiled with (/etc/mplayer/mplayer.conf instead of
diego
parents: 4521
diff changeset
15 my $mcfg = new ConfHelper('mplayer', "/etc/mplayer/mplayer.conf");
1398
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
16
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
17346
a5bef61f49bf Improve the Debian package configuration: Remove the vo module configuration,
diego
parents: 17323
diff changeset
19 my $dcarea = "" ;
a5bef61f49bf Improve the Debian package configuration: Remove the vo module configuration,
diego
parents: 17323
diff changeset
20 my $font = scalar(get("mplayer/ttfont")) ;
a5bef61f49bf Improve the Debian package configuration: Remove the vo module configuration,
diego
parents: 17323
diff changeset
21 $dcarea .= "#truetype font\nfont=" . $font . "\n" if $font;
1398
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
22 $mcfg->setconfarea($dcarea);
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 sub dealwithupgrades {
7096
6746866a94c6 Use the confdir we compiled with (/etc/mplayer/mplayer.conf instead of
diego
parents: 4521
diff changeset
27 open(OLDCONF, "</etc/mplayer/mplayer.conf") || return 1;
1398
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
28 close OLDCONF;
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
29
7096
6746866a94c6 Use the confdir we compiled with (/etc/mplayer/mplayer.conf instead of
diego
parents: 4521
diff changeset
30 my $mconf = new ConfHelper("mplayer", "/etc/mplayer/mplayer.conf");
1398
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
31 return 1 if ($mconf->hasconfarea());
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
32 undef $mconf;
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 if ((get('mplayer/replace-existing-files') eq 'true') &&
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
35 (fget('mplayer/replace-existing-files', 'isdefault') eq 'false')) {
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
36 $didupgrade = 1;
17346
a5bef61f49bf Improve the Debian package configuration: Remove the vo module configuration,
diego
parents: 17323
diff changeset
37 for my $file ("/etc/mplayer/mplayer.conf" ) {
a5bef61f49bf Improve the Debian package configuration: Remove the vo module configuration,
diego
parents: 17323
diff changeset
38 debug("Moving away $file");
a5bef61f49bf Improve the Debian package configuration: Remove the vo module configuration,
diego
parents: 17323
diff changeset
39 rename($file,$file . ".old");
1398
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 } else {
17346
a5bef61f49bf Improve the Debian package configuration: Remove the vo module configuration,
diego
parents: 17323
diff changeset
42 debug("Upgrade refused, exiting");
1398
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
43 exit 0;
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
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
47 sub debug {
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
48 print STDERR @_, "\n";
10e236ceac5e update to perl debconf. fixed problem with configure.
eyck
parents:
diff changeset
49 }
8909
e59659bea3e0 postinst should pass control to debconf scripts.
eyck
parents: 7096
diff changeset
50
e59659bea3e0 postinst should pass control to debconf scripts.
eyck
parents: 7096
diff changeset
51
e59659bea3e0 postinst should pass control to debconf scripts.
eyck
parents: 7096
diff changeset
52 # pass control to debhelper scripts..
e59659bea3e0 postinst should pass control to debconf scripts.
eyck
parents: 7096
diff changeset
53 #
17346
a5bef61f49bf Improve the Debian package configuration: Remove the vo module configuration,
diego
parents: 17323
diff changeset
54 my $temp="set -e\nset -- @ARGV\n" . << 'DEBHELPER_EOF_';
8909
e59659bea3e0 postinst should pass control to debconf scripts.
eyck
parents: 7096
diff changeset
55 #DEBHELPER#
17346
a5bef61f49bf Improve the Debian package configuration: Remove the vo module configuration,
diego
parents: 17323
diff changeset
56 DEBHELPER_EOF_
a5bef61f49bf Improve the Debian package configuration: Remove the vo module configuration,
diego
parents: 17323
diff changeset
57 system ($temp) / 256 == 0
a5bef61f49bf Improve the Debian package configuration: Remove the vo module configuration,
diego
parents: 17323
diff changeset
58 or die "Problem with debhelper scripts: $!";