view debian/postinst @ 26877:4ab1cfcee430
Add a slave command to stop stream playback.
Mostly useful when used with -idle mode.
Patch by Mathieu Schroeter ( mathieu dot schroeter at gamesover dot ch )
author
ben
date
Tue, 27 May 2008 18:39:57 +0000 (2008-05-27)
parents
a5bef61f49bf
children
line source
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #!/usr/bin/perl -w
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 # mplayer postinst
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 require ConfHelper;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 use Debconf::Client::ConfModule qw(:all);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 use IO::Handle;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 use Fcntl;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 my $version = version(2.0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 my $didupgrade = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dealwithupgrades();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 my $mcfg = new ConfHelper('mplayer', "/etc/mplayer/mplayer.conf");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 my $dcarea = "" ;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 my $font = scalar(get("mplayer/ttfont")) ;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 $dcarea .= "#truetype font\nfont=" . $font . "\n" if $font;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 $mcfg->setconfarea($dcarea);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 sub dealwithupgrades {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 open(OLDCONF, "</etc/mplayer/mplayer.conf") || return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 close OLDCONF;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 my $mconf = new ConfHelper("mplayer", "/etc/mplayer/mplayer.conf");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1 if ($mconf->hasconfarea());
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 undef $mconf;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if ((get('mplayer/replace-existing-files') eq 'true') &&
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (fget('mplayer/replace-existing-files', 'isdefault') eq 'false')) {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 $didupgrade = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for my $file ("/etc/mplayer/mplayer.conf" ) {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 debug("Moving away $file");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 rename($file,$file . ".old");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 } else {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 debug("Upgrade refused, exiting");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 exit 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 sub debug {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 print STDERR @_, "\n";
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 # pass control to debhelper scripts..
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 my $temp="set -e\nset -- @ARGV\n" . << 'DEBHELPER_EOF_';
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #DEBHELPER#
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEBHELPER_EOF_
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 system ($temp) / 256 == 0
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 or die "Problem with debhelper scripts: $!";