2002-12-11 23:57:00 +03:00
|
|
|
#! @PERL@
|
1998-02-27 07:54:42 +03:00
|
|
|
#
|
|
|
|
# Written by Fernando Alegre <alegre@debian.org> 1996
|
|
|
|
#
|
|
|
|
# Applied patch by Dimitri Maziuk <emaziuk@curtin.edu.au> 1997
|
|
|
|
# (to handle new tar format)
|
|
|
|
#
|
|
|
|
# Modified by Fernando Alegre <alegre@debian.org> 1997
|
|
|
|
# (to handle both new and old tar formats)
|
|
|
|
#
|
1999-03-10 04:22:30 +03:00
|
|
|
# Modified by Patrik Rak <prak@post.cz> 1998
|
|
|
|
# (add by Michael Bramer Debian-mc-maintainer <grisu@debian.org>)
|
|
|
|
# (to allow access to package control files)
|
|
|
|
#
|
2000-01-03 02:50:56 +03:00
|
|
|
# Modified by Martin Bialasinski <martinb@debian.org> 1999
|
|
|
|
# (deal with change in tar format)
|
1999-03-10 04:22:30 +03:00
|
|
|
#
|
1998-02-27 07:54:42 +03:00
|
|
|
#
|
|
|
|
# Copyright (C) 1997 Free Software Foundation
|
|
|
|
#
|
|
|
|
|
|
|
|
sub mcdebfs_list
|
|
|
|
{
|
|
|
|
#
|
|
|
|
# CAVEAT: Hard links are listed as if they were symlinks
|
|
|
|
# Empty directories do not appear at all
|
|
|
|
#
|
|
|
|
local($archivename)=@_;
|
2004-08-19 21:37:01 +04:00
|
|
|
local $qarchivename = $archivename;
|
|
|
|
$qarchivename =~ s/([^\w\/.+-])/\\$1/g;
|
1998-02-27 07:54:42 +03:00
|
|
|
chop($date=`LC_ALL=C date "+%b %d %Y %H:%M"`);
|
2004-08-19 21:37:01 +04:00
|
|
|
chop($info_size=`dpkg -I $qarchivename | wc -c`);
|
1998-02-27 07:54:42 +03:00
|
|
|
$install_size=length($pressinstall);
|
|
|
|
|
|
|
|
print "dr-xr-xr-x 1 root root 0 $date CONTENTS\n";
|
1999-03-10 04:22:30 +03:00
|
|
|
# from Patrik Rak
|
|
|
|
print "dr-xr-xr-x 1 root root 0 $date DEBIAN\n";
|
1998-02-27 07:54:42 +03:00
|
|
|
print "-r--r--r-- 1 root root $info_size $date INFO\n";
|
|
|
|
print "-r-xr--r-- 1 root root $install_size $date INSTALL\n";
|
|
|
|
|
2004-08-19 21:37:01 +04:00
|
|
|
if ( open(PIPEIN, "dpkg-deb -c $qarchivename |") )
|
1998-02-27 07:54:42 +03:00
|
|
|
{
|
|
|
|
while(<PIPEIN>)
|
|
|
|
{
|
|
|
|
split;
|
|
|
|
|
|
|
|
$perm=$_[0]; $owgr=$_[1]; $size=$_[2];
|
|
|
|
if($_[3] =~ /^\d\d\d\d\-/) { # New tar format
|
|
|
|
|
|
|
|
($year,$mon,$day) = split(/-/,$_[3]);
|
|
|
|
$month = ("Gee","Jan","Feb","Mar","Apr","May","Jun",
|
|
|
|
"Jul","Aug","Sep","Oct","Nov","Dec")[$mon] || "Gee";
|
|
|
|
$time=$_[4];
|
|
|
|
$pathindex=5;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$month=$_[3];
|
|
|
|
$day=$_[4];
|
|
|
|
$time=$_[5];
|
|
|
|
$year=$_[6];
|
|
|
|
$pathindex=7;
|
|
|
|
}
|
|
|
|
|
|
|
|
$path=$_[$pathindex++];
|
|
|
|
$arrow=$_[$pathindex++];
|
|
|
|
$link=$_[$pathindex++];
|
|
|
|
$link2=$_[$pathindex++];
|
|
|
|
|
|
|
|
$owgr=~s!/! !;
|
|
|
|
next if $path=~m!/$!;
|
|
|
|
if($arrow eq 'link')
|
|
|
|
{
|
|
|
|
# report hard links as soft links
|
|
|
|
$arrow='->'; $link="/$link2";
|
|
|
|
substr($perm, 0, 1) = "l";
|
|
|
|
}
|
|
|
|
if($arrow ne '')
|
|
|
|
{
|
|
|
|
$arrow=' ' . $arrow;
|
|
|
|
$link= ' ' . $link;
|
|
|
|
}
|
|
|
|
print "$perm 1 $owgr $size $month $day $year $time CONTENTS/$path$arrow$link\n";
|
|
|
|
}
|
|
|
|
}
|
1999-03-10 04:22:30 +03:00
|
|
|
# begin from Patrik Rak
|
2004-08-19 21:37:01 +04:00
|
|
|
if ( open(PIPEIN, "dpkg-deb -I $qarchivename |") )
|
1999-03-10 04:22:30 +03:00
|
|
|
{
|
|
|
|
while(<PIPEIN>)
|
|
|
|
{
|
|
|
|
split;
|
|
|
|
$size=$_[0];
|
|
|
|
last if $size =~ /:/;
|
|
|
|
next if $size !~ /\d+/;
|
|
|
|
if($_[4] eq '*')
|
|
|
|
{
|
|
|
|
$perm='-r-xr-xr-x';
|
|
|
|
$name=$_[5];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$perm='-r--r--r--';
|
|
|
|
$name=$_[4];
|
|
|
|
}
|
|
|
|
print "$perm 1 root root $size $date DEBIAN/$name\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
# end from Patrik Rak
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
sub mcdebfs_copyout
|
|
|
|
{
|
|
|
|
local($archive,$filename,$destfile)=@_;
|
2004-08-19 21:37:01 +04:00
|
|
|
local $qarchive = $archive;
|
|
|
|
$qarchive =~ s/([^\w\/.+-])/\\$1/g;
|
|
|
|
local $qfilename = $filename;
|
|
|
|
$qfilename =~ s/([^\w\/.+-])/\\$1/g;
|
|
|
|
local $qdestfile = $destfile;
|
|
|
|
$qdestfile =~ s/([^\w\/.+-])/\\$1/g;
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
if($filename eq "INFO")
|
|
|
|
{
|
2004-08-19 21:37:01 +04:00
|
|
|
system("dpkg-deb -I $qarchive > $qdestfile");
|
1999-03-10 04:22:30 +03:00
|
|
|
# begin from Patrik Rak
|
|
|
|
}
|
|
|
|
elsif($filename =~ /^DEBIAN/)
|
|
|
|
{
|
|
|
|
$filename=~s!^DEBIAN/!!;
|
2004-08-19 21:37:01 +04:00
|
|
|
system("dpkg-deb -I $qarchive $qfilename > $qdestfile");
|
1999-03-10 04:22:30 +03:00
|
|
|
# end from Patrik Rak
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
elsif($filename eq "INSTALL")
|
|
|
|
{
|
|
|
|
if ( open(FILEOUT,">$destfile") )
|
|
|
|
{
|
|
|
|
print FILEOUT $pressinstall;
|
|
|
|
close FILEOUT;
|
2004-08-19 21:37:01 +04:00
|
|
|
system("chmod a+x $qdestfile");
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-01-03 02:50:56 +03:00
|
|
|
# files can be prepended with ./ or not, depending on the version of tar
|
1998-02-27 07:54:42 +03:00
|
|
|
$filename=~s!^CONTENTS/!!;
|
2004-08-19 21:37:01 +04:00
|
|
|
system("dpkg-deb --fsys-tarfile $qarchive | tar xOf - $qfilename ./$qfilename > $qdestfile 2>/dev/null");
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub mcdebfs_run
|
|
|
|
{
|
|
|
|
local($archive,$filename)=@_;
|
2004-08-19 21:37:01 +04:00
|
|
|
local $qarchive = $archive;
|
|
|
|
$qarchive =~ s/([^\w\/.+-])/\\$1/g;
|
1998-02-27 07:54:42 +03:00
|
|
|
if($filename eq "INSTALL")
|
|
|
|
{
|
|
|
|
print "Installing $archive\n";
|
2004-08-19 21:37:01 +04:00
|
|
|
system("dpkg -i $qarchive");
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-08-17 12:24:59 +04:00
|
|
|
use File::Temp qw(mkdtemp);
|
|
|
|
my $template = "/tmp/mcdebfs.run.XXXXXX";
|
|
|
|
$template="$ENV{MC_TMPDIR}/mcdebfs.XXXXXX" if ($ENV{MC_TMPDIR});
|
|
|
|
$tmpdir = mkdtemp($template);
|
1999-04-08 21:16:58 +04:00
|
|
|
$tmpcmd="$tmpdir/run";
|
1998-02-27 07:54:42 +03:00
|
|
|
&mcdebfs_copyout($archive, $filename, $tmpcmd);
|
|
|
|
system("chmod u+x $tmpcmd");
|
|
|
|
system($tmpcmd);
|
|
|
|
unlink($tmpcmd);
|
1999-04-08 21:16:58 +04:00
|
|
|
rmdir($tmpdir);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$pressinstall=<<EOInstall;
|
|
|
|
|
|
|
|
WARNING
|
2000-01-03 02:50:56 +03:00
|
|
|
Don\'t use this method if you are not willing to reinstall everything...
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
This is not a real file. It is a way to install the package you are browsing.
|
|
|
|
|
|
|
|
To install this package go back to the panel and press Enter on this file.
|
|
|
|
|
|
|
|
In Debian systems, a package is automatically upgraded when you install a new
|
|
|
|
version of it. There is no special upgrade option. Install always works.
|
|
|
|
|
|
|
|
EOInstall
|
|
|
|
|
1998-12-16 09:16:13 +03:00
|
|
|
umask 077;
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
if($ARGV[0] eq "list") { shift; &mcdebfs_list(@ARGV); exit 0; }
|
|
|
|
elsif($ARGV[0] eq "copyout") { shift; &mcdebfs_copyout(@ARGV); exit 0; }
|
|
|
|
elsif($ARGV[0] eq "run") { shift; &mcdebfs_run(@ARGV); exit 0; }
|
|
|
|
|
|
|
|
exit 1;
|
|
|
|
|