3 # Written by Fernando Alegre <alegre@debian.org> 1996
5 # Applied patch by Dimitri Maziuk <emaziuk@curtin.edu.au> 1997
6 # (to handle new tar format)
8 # Modified by Fernando Alegre <alegre@debian.org> 1997
9 # (to handle both new and old tar formats)
11 # Modified by Patrik Rak <prak@post.cz> 1998
12 # (add by Michael Bramer Debian-mc-maintainer <grisu@debian.org>)
13 # (to allow access to package control files)
17 # Copyright (C) 1997 Free Software Foundation
23 # CAVEAT: Hard links are listed as if they were symlinks
24 # Empty directories do not appear at all
26 local($archivename)=@_;
27 chop($date=`LC_ALL=C date "+%b %d %Y %H:%M"`);
28 chop($info_size=`dpkg -I $archivename | wc -c`);
29 $install_size=length($pressinstall);
31 print "dr-xr-xr-x 1 root root 0 $date CONTENTS\n";
33 print "dr-xr-xr-x 1 root root 0 $date DEBIAN\n";
34 print "-r--r--r-- 1 root root $info_size $date INFO\n";
35 print "-r-xr--r-- 1 root root $install_size $date INSTALL\n";
37 if ( open(PIPEIN, "dpkg-deb -c $archivename |") )
43 $perm=$_[0]; $owgr=$_[1]; $size=$_[2];
44 if($_[3] =~ /^\d\d\d\d\-/) { # New tar format
46 ($year,$mon,$day) = split(/-/,$_[3]);
47 $month = ("Gee","Jan","Feb","Mar","Apr","May","Jun",
48 "Jul","Aug","Sep","Oct","Nov","Dec")[$mon] || "Gee";
60 $path=$_[$pathindex++];
61 $arrow=$_[$pathindex++];
62 $link=$_[$pathindex++];
63 $link2=$_[$pathindex++];
69 # report hard links as soft links
70 $arrow='->'; $link="/$link2";
71 substr($perm, 0, 1) = "l";
78 print "$perm 1 $owgr $size $month $day $year $time CONTENTS/$path$arrow$link\n";
81 # begin from Patrik Rak
82 if ( open(PIPEIN, "dpkg-deb -I $archivename |") )
89 next if $size !~ /\d+/;
100 print "$perm 1 root root $size $date DEBIAN/$name\n";
103 # end from Patrik Rak
109 local($archive,$filename,$destfile)=@_;
111 if($filename eq "INFO")
113 system("dpkg-deb -I $archive > $destfile");
114 # begin from Patrik Rak
116 elsif($filename =~ /^DEBIAN/)
118 $filename=~s!^DEBIAN/!!;
119 system("dpkg-deb -I $archive $filename > $destfile");
120 # end from Patrik Rak
123 elsif($filename eq "INSTALL")
125 if ( open(FILEOUT,">$destfile") )
127 print FILEOUT $pressinstall;
129 system("chmod a+x $destfile");
134 $filename=~s!^CONTENTS/!!;
135 system("dpkg-deb --fsys-tarfile $archive | tar xOf - $filename > $destfile");
141 local($archive,$filename)=@_;
142 if($filename eq "INSTALL")
144 print "Installing $archive\n";
145 system("dpkg -i $archive");
151 $tmpdir = "/tmp/mcdebfs.run".$$.$suffix;
152 last if mkdir $tmpdir, 0700;
154 # Somebody is being really nasty, give up
155 exit 1 if $suffix eq "zzz";
158 $tmpcmd="$tmpdir/run";
159 &mcdebfs_copyout($archive, $filename, $tmpcmd);
160 system("chmod u+x $tmpcmd");
167 $pressinstall=<<EOInstall;
170 Don't use this method if you are not willing to reinstall everything...
172 This is not a real file. It is a way to install the package you are browsing.
174 To install this package go back to the panel and press Enter on this file.
176 In Debian systems, a package is automatically upgraded when you install a new
177 version of it. There is no special upgrade option. Install always works.
183 if($ARGV[0] eq "list") { shift; &mcdebfs_list(@ARGV); exit 0; }
184 elsif($ARGV[0] eq "copyout") { shift; &mcdebfs_copyout(@ARGV); exit 0; }
185 elsif($ARGV[0] eq "run") { shift; &mcdebfs_run(@ARGV); exit 0; }