3 # 1999 (c) Piotr Roszatycki <dexter@debian.org>
4 # This software is under GNU license
5 # last modification: 1999-12-08
13 @time = localtime($dt);
14 $bt = sprintf "%02d-%02d-%02d %02d:%02d", $time[4], $time[3], $time[5], $time[2], $time[1];
48 } elsif( $n & 0100 ) {
66 } elsif( $n & 0010 ) {
84 } elsif( $n & 0001 ) {
95 my @stat = stat($file);
96 # mode, nlink, uid, gid, size, mtime, filename
97 printf "%s%s %d %d %d %d %s CONTENTS%s\n", ft
($file), fm
($stat[2] & 07777),
98 $stat[3], $stat[4], $stat[5], $stat[7], bt
($stat[9]), $file;
104 chop($date=`LC_ALL=C date "+%b %d %Y %H:%M"`);
105 chop($info_size=`dpkg -s $archive | wc -c`);
106 $repack_size=length($pressrepack);
107 $reinstall_size=length($pressreinstall);
108 $remove_size=length($pressremove);
109 $purge_size=length($presspurge);
110 $reconfigure_size=length($pressreconfigure);
111 $reinstall_size=length($pressreinstall);
112 $select_size=length($pressselect);
113 $unselect_size=length($pressunselect);
115 print "dr-xr-xr-x 1 root root 0 $date CONTENTS\n";
116 print "dr-xr-xr-x 1 root root 0 $date DEBIAN\n";
117 print "-r--r--r-- 1 root root $info_size $date INFO\n";
118 print "-r-xr--r-- 1 root root $purge_size $date DPKG-PURGE\n";
120 chop($status = `dpkg -s $archive | grep ^Status`);
121 if( $status =~ /deinstall/ ) {
122 print "-r-xr--r-- 1 root root $select_size $date DPKG-SELECT\n";
123 } elsif( $status =~ /install/ ) {
124 print "-r-xr--r-- 1 root root $unselect_size $date DPKG-UNSELECT\n";
126 if( $status !~ /config-files/ ) {
127 if ( -x
"/usr/bin/dpkg-repack" ) {
128 print "-r-xr--r-- 1 root root $repack_size $date DPKG-REPACK\n";
130 print "-r-xr--r-- 1 root root $remove_size $date DPKG-REMOVE\n";
131 if ( -x
"/usr/bin/apt-get" ) {
132 print "-r-xr--r-- 1 root root $remove_size $date APT-REMOVE\n";
133 print "-r-xr--r-- 1 root root $reinstall_size $date APT-REINSTALL\n";
134 print "-r-xr--r-- 1 root root $purge_size $date APT-PURGE\n";
137 if( -x
"/usr/bin/dpkg-reconfigure" && -x
"/var/lib/dpkg/info/$archive.config" ) {
138 print "-r-xr--r-- 1 root root $reconfigure_size $date DPKG-RECONFIGURE\n";
143 if ( open(PIPEIN
, "LANG=C ls -l /var/lib/dpkg/info/$archive.* |") ) {
147 s
%/var/lib
/dpkg/info
/$archive.%DEBIAN/%;
153 if ( open(LIST
, "/var/lib/dpkg/info/$archive.list") ) {
164 my($archive,$filename,$destfile)=@_;
166 if($filename eq "INFO") {
167 system("dpkg -s $archive > $destfile");
168 } elsif($filename eq "DPKG-REPACK") {
169 if ( open(FILEOUT
,">$destfile") ) {
170 print FILEOUT
$pressrepack;
172 system("chmod a+x $destfile");
174 } elsif($filename =~ /^DEBIAN/) {
175 $filename=~s!^DEBIAN/!!;
176 system("cat /var/lib/dpkg/info/$archive.$filename > $destfile");
177 } elsif($filename eq "DPKG-REMOVE" || $filename eq "APT-REMOVE") {
178 if ( open(FILEOUT
,">$destfile") ) {
179 print FILEOUT
$pressremove;
181 system("chmod a+x $destfile");
183 } elsif($filename eq "DPKG-PURGE" || $filename eq "APT-PURGE") {
184 if ( open(FILEOUT
,">$destfile") ) {
185 print FILEOUT
$presspurge;
187 system("chmod a+x $destfile");
189 } elsif($filename eq "DPKG-RECONFIGURE") {
190 if ( open(FILEOUT
,">$destfile") ) {
191 print FILEOUT
$pressreconfigure;
193 system("chmod a+x $destfile");
195 } elsif($filename eq "APT-REINSTALL") {
196 if ( open(FILEOUT
,">$destfile") ) {
197 print FILEOUT
$pressreinstall;
199 system("chmod a+x $destfile");
201 } elsif($filename eq "DPKG-SELECT") {
202 if ( open(FILEOUT
,">$destfile") ) {
203 print FILEOUT
$pressselect;
205 system("chmod a+x $destfile");
207 } elsif($filename eq "DPKG-UNSELECT") {
208 if ( open(FILEOUT
,">$destfile") ) {
209 print FILEOUT
$pressunselect;
211 system("chmod a+x $destfile");
214 $filename=~s!^CONTENTS!!;
215 system("cat $filename > $destfile");
221 my($archive,$filename)=@_;
222 if($filename eq "DPKG-REMOVE") {
223 system("dpkg --remove $archive");
224 } elsif($filename eq "APT-REMOVE") {
225 system("apt-get remove $archive");
226 } elsif($filename eq "DPKG-PURGE") {
227 system("dpkg --purge $archive");
228 } elsif($filename eq "APT-PURGE") {
229 system("apt-get --purge remove $archive");
230 } elsif($filename eq "DPKG-REPACK") {
231 system("dpkg-repack $archive");
232 } elsif($filename eq "DPKG-SELECT") {
233 system("echo $archive install | dpkg --set-selections");
234 } elsif($filename eq "DPKG-UNSELECT") {
235 system("echo $archive deinstall | dpkg --set-selections");
236 } elsif($filename eq "APT-REINSTALL") {
237 system("apt-get -u --reinstall install $archive");
238 } elsif($filename eq "DPKG-RECONFIGURE") {
239 system("dpkg-reconfigure $archive");
240 } elsif($filename=~/^DEBIAN/) {
241 $filename=~s!^DEBIAN!!;
242 system("/var/lib/dpkg/info/$archive.$filename");
244 $filename=~s!^CONTENTS!!;
249 $pressrepack=<<EOInstall;
252 Don\'t use this method if you are not willing to repack this package...
254 This is not a real file. It is a way to repack the package you are browsing.
256 To repack this package go back to the panel and press Enter on this file.
260 $pressreinstall=<<EOInstall;
263 Don\'t use this method if you are not willing to reinstall this package...
265 This is not a real file. It is a way to reinstall the package you are browsing.
267 To reinstall this package go back to the panel and press Enter on this file.
271 $pressremove=<<EOInstall;
274 Don\'t use this method if you are not willing to remove this package...
276 This is not a real file. It is a way to remove the package you are browsing.
278 To remove this package go back to the panel and press Enter on this file.
282 $presspurge=<<EOInstall;
285 Don\'t use this method if you are not willing to purge this package...
287 This is not a real file. It is a way to purge the package you are browsing.
289 To purge this package go back to the panel and press Enter on this file.
293 $pressreconfigure=<<EOInstall;
296 Don\'t use this method if you are not willing to reconfigure this package...
298 This is not a real file. It is a way to reconfigure the package you are browsing.
300 To reconfigure this package go back to the panel and press Enter on this file.
304 $pressreinstall=<<EOInstall;
307 Don\'t use this method if you are not willing to reinstall this package...
309 This is not a real file. It is a way to reinstall the package you are browsing.
311 To reinstall this package go back to the panel and press Enter on this file.
315 $pressselect=<<EOInstall;
318 Don\'t use this method if you are not willing to select this package...
320 This is not a real file. It is a way to select the package you are browsing.
322 To select this package go back to the panel and press Enter on this file.
326 $pressunselect=<<EOInstall;
329 Don\'t use this method if you are not willing to unselect this package...
331 This is not a real file. It is a way to unselect the package you are browsing.
333 To unselect this package go back to the panel and press Enter on this file.
339 chop($name = `if [ -f "$ARGV[1]" ]; then cat $ARGV[1]; else echo $ARGV[1]; fi`);
340 $name =~ s
%.*/([0-9a
-z
.-]*)_
.*%$1%;
344 if($ARGV[0] eq "list") { &list
($name); exit 0; }
345 elsif($ARGV[0] eq "copyout") { ©out
($name,$ARGV[2],$ARGV[3]); exit 0; }
346 elsif($ARGV[0] eq "run") { &run
($name,$ARGV[2]); exit 0; }