Improve the Debian package configuration: Remove the vo module configuration,

add a debconf TrueType font configuration.
Based on the Debian package by Andrea Menucci.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17347 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
diego 2006-01-08 18:33:54 +00:00
parent 8ebd8076c8
commit 11250d1f4c
3 changed files with 79 additions and 189 deletions

143
debian/config vendored
View File

@ -1,99 +1,52 @@
#!/usr/bin/perl -w #!/bin/sh
# Script to configure mplayer CONFIGFILE=/etc/mplayer/mplayer.conf
# based on etherconf by John Goerzen <jgoerzen@progenylinux.com>
use Debconf::Client::ConfModule qw(:all); set -e
# Source debconf library.
. /usr/share/debconf/confmodule
if test -r $CONFIGFILE && ! grep -q '### mplayer DEBCONF AREA' $CONFIGFILE
then
db_input medium 'mplayer/replace-existing-files' || true
db_go || true
if [ "$RET" != "true" ]; then
exit 0
fi
db_get 'mplayer/replace-existing-files' || true
fi
########################################## find fonts
#default font (if available)
BESTFONT=/usr/share/fonts/truetype/Arial.ttf
[ -r $BESTFONT ] || BESTFONT=/usr/share/fonts/truetype/freefont/FreeSans.ttf
t=$(tempfile -p fonts )
find /usr/share/fonts/ /?/?in*/?ont* -type f -iname '*.ttf' -maxdepth 3 2> /dev/null > $t || true
if test -s $t
then
fonts=$( awk '{print a $0;a=", "}' $t || true )
db_subst "mplayer/ttfont" ttfontchoices $fonts || true
## suppose the question is skipped: give a default
a=$BESTFONT
[ -r $BESTFONT ] || a=$(head -1 $t)
db_subst "mplayer/ttfont" ttfontdefault $a || true
db_input medium mplayer/ttfont || true
if [ "$?" = 30 ] ; then
db_set mplayer/ttfont $a || true
fi
else
db_input medium "mplayer/no-ttfont" || true
fi
rm $t
db_go || true
############################################################
my $version = version(2.0); exit 0
title('MPlayer Configuration');
my $PRIORITY = 'high';
#TODO: 'medium'
my $next = 'mainmenu';
my $isediting = 0;
my @nextargs = ();
checkupgrade(); # Find out if we have to upgrade.
mainloop(letsgo());
sub checkupgrade {
open(MCFG, "</etc/mplayer/mplayer.conf") || return 1;
my $line = <MCFG>;
return 1 if ($line =~ /mplayer DEBCONF AREA/);
exit(0) if (input($PRIORITY, 'mplayer/replace-existing-files') eq "question skipped");
go();
if (get('mplayer/replace-existing-files') eq 'false') {
input($PRIORITY, 'mplayer/replace-existing-files-bail');
go();
exit();
}
close MCFG;
}
sub mainloop {
$next = shift @_;
do {
my @retval = &$next(@nextargs);
# if ($retval[0] eq 'BACK') {
# $retval[0] = $backups{$next};
# }
($next, @nextargs) = @retval;
} while ($next ne 'Exit');
}
sub letsgo {
#useless!
return "configure";
}
sub configure {
subst("mplayer/voutput", "vochoices", "xv, xmga, mga, x11, gl, sdl, xvidix");
# db_subst mplayer/output vo xc,xmga,mga,x11,gl,sdl
exit(0) if (input($PRIORITY, "mplayer/voutput") eq "question skipped");
go();
exit 0 unless (get("mplayer/voutput") eq 'true');
#return 'audioout';
return 'mainmenu';
}
sub mainmenu {
go(); # To catch spare things from before
my @choices = (
'Video Output: ' . scalar(get("mplayer/voutput")));
#,
$choices = join(', ', @choices);
$isediting = 1;
subst('mplayer/mainmenu', 'choices', $choices);
input($PRIORITY, 'mplayer/mainmenu');
go();
my $selection = get('mplayer/mainmenu');
if ($selection =~ /^Exit/) {
return 'Exit';
}
# Set to redisplay.
fset('mplayer/mainmenu', 'isdefault', 'true');
$_ = $selection;
return 'configure' if /^Video/;
# return 'aoutput' if /^Aoutput/;
return 'Exit';
}
sub editreturn {
my @args = @_;
return 'mainmenu' if $isediting;
return @args;
}
sub editfix {
my $template = shift @_;
if ($isediting) {
fset($template, 'isdefault', 'true');
}
}

60
debian/postinst vendored
View File

@ -7,44 +7,20 @@ require ConfHelper;
use Debconf::Client::ConfModule qw(:all); use Debconf::Client::ConfModule qw(:all);
use IO::Handle; use IO::Handle;
use Fcntl; use Fcntl;
my $version = version(1.0); my $version = version(2.0);
my @savedolddata = ();
my $didupgrade = 0; my $didupgrade = 0;
dealwithupgrades(); dealwithupgrades();
my $mcfg = new ConfHelper('mplayer', "/etc/mplayer/mplayer.conf"); my $mcfg = new ConfHelper('mplayer', "/etc/mplayer/mplayer.conf");
$mcfg->setconfarea("
#MPlayer config file generated by .deb package.
#ffactor = 0.9
#fs = yes
");
###########################################################################
debug("Configuring video output driver...");
my $dcarea = <<"EOF";
# MPlayer video output driver, configured by mplayer.deb
EOF
$dcarea .= "vo=" . scalar(get("mplayer/voutput"));
$dcarea .= ",\n";
my $dcarea = "" ;
my $font = scalar(get("mplayer/ttfont")) ;
$dcarea .= "#truetype font\nfont=" . $font . "\n" if $font;
$mcfg->setconfarea($dcarea); $mcfg->setconfarea($dcarea);
if ($didupgrade) {
$mcfg->setotherarea_DANGEROUS(@savedolddata);
}
#%###################################
exit unless (get("mplayer/configure") eq 'true');
exit unless (fget("mplayer/configure", "isdefault") eq 'false');
#%##################################
get("mplayer/cfgnote");
sub dealwithupgrades { sub dealwithupgrades {
@ -57,31 +33,17 @@ sub dealwithupgrades {
if ((get('mplayer/replace-existing-files') eq 'true') && if ((get('mplayer/replace-existing-files') eq 'true') &&
(fget('mplayer/replace-existing-files', 'isdefault') eq 'false')) { (fget('mplayer/replace-existing-files', 'isdefault') eq 'false')) {
print STDERR "Upgrading...\n";
#? saveolddata("/etc/network/interfaces", "pppconf");
$didupgrade = 1; $didupgrade = 1;
for my $file ("/etc/mplayer/mplayer.conf" for my $file ("/etc/mplayer/mplayer.conf" ) {
#, "/etc/mplayer/fonts/sth debug("Moving away $file");
) { rename($file,$file . ".old");
debug("Deleting $file");
unlink $file;
} }
} else { } else {
print STDERR "Upgrade refused, exiting.\n"; debug("Upgrade refused, exiting");
exit 0; exit 0;
} }
} }
# Gets any debconf area for other packages and saves it off.
sub saveolddata {
my ($file, $package) = @_;
my $conf = new ConfHelper($package, $file);
push(@savedolddata, $conf->{startline} . "\n");
push(@savedolddata, $conf->getconfarea());
push(@savedolddata, $conf->{endline} . "\n");
}
sub debug { sub debug {
print STDERR @_, "\n"; print STDERR @_, "\n";
} }
@ -89,6 +51,8 @@ sub debug {
# pass control to debhelper scripts.. # pass control to debhelper scripts..
# #
system <<EODEBHELPER; my $temp="set -e\nset -- @ARGV\n" . << 'DEBHELPER_EOF_';
#DEBHELPER# #DEBHELPER#
EODEBHELPER DEBHELPER_EOF_
system ($temp) / 256 == 0
or die "Problem with debhelper scripts: $!";

65
debian/templates vendored
View File

@ -2,53 +2,26 @@ Template: mplayer/replace-existing-files
Type: boolean Type: boolean
Default: true Default: true
Description: Upgrade existing system? Description: Upgrade existing system?
It looks like you've configured your mplayer already. It looks like you've configured MPlayer already. If you'd like to
If you'd like to configure it with this program, I'll have configure it with this program, I'll have to delete the old
to delete the old configuration. Do you want to continue configuration /etc/mplayer/mplayer.conf. Do you want to continue
configuration with this program? If you say "yes", I'll go ahead configuration with this program? If you say "Yes", I'll go ahead and
and delete your old configuration and you can create it anew with delete your old configuration and you can create it anew with this
this program. program. If you say "No" I'm going to exit now since you don't want
me to replace your existing files. If you change your mind later,
you can run 'dpkg-reconfigure mplayer'.
Template: mplayer/replace-existing-files-bail Template: mplayer/ttfont
Type: note
Description: Files not replaced
I'm going to exit now since you don't want me to replace your
existing files. If you change your mind later, you can run
dpkg-reconfigure mplayer.
Template: mplayer/mainmenu
Type: select Type: select
Choices: ${choices}, Exit Choices: ${ttfontchoices}
Description: MPlayer Main Menu Default: ${ttfontdefault}
From this menu, you can modify any of the settings for your device. Description: MPlayer fonts
Simply select the item you'd like to change to modify it. MPlayer can use TrueType fonts to render the OSD and subtitles.
When you are done, select Exit. Choose your favorite.
Template: mplayer/voutput Template: mplayer/no-ttfont
Type: select
Default: xv
Choices: ${vochoices}
Description: MPlayer Video Output
MPlayer can use very wide range of video output drivers:
( order aproximately by speed: )
* mga, xmga - direct hardware access on MGA cards (G200/400/450), needs /dev/mga_vid
this driver can work without X and display video on secondary head of matrox cards
* xv - XVideo extensions of X 4.x ( hardware scaling, bilinear filtering )
* sdl - SDL library, it can also use hardware scaling, filtering etc
* ggi - GGI library, it can also use hardware scaling, filtering etc
* dga, fsdga - DGA extension.
* fsbdev - framebuffer device ( watching movies on text console )
* x11 - simple x11 output.
.
Please choose carefully because this will have a tremendous effect on speed.
Template: mplayer/cfgnote
Type: note Type: note
Description: Create your ~/.mplayer/conf file. Description: MPlayer cannot find TrueType fonts
Remember to read documentation and edit your ~/.mplayer/conf You should install a package providing TrueType fonts (such as
(or /etc/mplayer.conf) file. This binary depends heavily on 'ttf-freefont' or 'ttf-bitstream-vera' or 'msttcorefonts' )
your hardware - which means that it needs tweaking for every single and reconfigure mplayer.
machine it's installed to. And it also it means that it will use
your setup very effectively. Look at /usr/share/doc/mplayer
end