3 # 1999 (c) Piotr Roszatycki <dexter@debian.org>
4 # This software is under GNU license
5 # last modification: 1999-12-08
11 s/([^\w\/.+-])/\\$1/g;
19 @time = localtime($dt);
20 $bt = sprintf "%02d-%02d-%d %02d:%02d", $time[4] + 1, $time[3],
21 $time[5] + 1900, $time[2], $time[1];
55 } elsif( $n & 0100 ) {
73 } elsif( $n & 0010 ) {
91 } elsif( $n & 0001 ) {
102 my @stat = stat($file);
103 # mode, nlink, uid, gid, size, mtime, filename
104 printf "%s%s %d %d %d %d %s CONTENTS%s\n", ft($file), fm($stat[2] & 07777),
105 $stat[3], $stat[4], $stat[5], $stat[7], bt($stat[9]), $file;
111 my $qarchive = quote($archive);
112 chop($date=`LC_ALL=C date "+%m-%d-%Y %H:%M"`);
113 chop($info_size=`dpkg -s $qarchive | wc -c`);
114 $repack_size=length($pressrepack);
115 $reinstall_size=length($pressreinstall);
116 $remove_size=length($pressremove);
117 $purge_size=length($presspurge);
118 $reconfigure_size=length($pressreconfigure);
119 $reinstall_size=length($pressreinstall);
120 $select_size=length($pressselect);
121 $unselect_size=length($pressunselect);
123 print "dr-xr-xr-x 1 root root 0 $date CONTENTS\n";
124 print "dr-xr-xr-x 1 root root 0 $date DEBIAN\n";
125 print "-r--r--r-- 1 root root $info_size $date INFO\n";
126 print "-r-xr--r-- 1 root root $purge_size $date DPKG-PURGE\n";
128 chop($status = `dpkg -s $qarchive | grep ^Status`);
129 if( $status =~ /deinstall/ ) {
130 print "-r-xr--r-- 1 root root $select_size $date DPKG-SELECT\n";
131 } elsif( $status =~ /install/ ) {
132 print "-r-xr--r-- 1 root root $unselect_size $date DPKG-UNSELECT\n";
134 if( $status !~ /config-files/ ) {
135 if ( -x "/usr/bin/dpkg-repack" ) {
136 print "-r-xr--r-- 1 root root $repack_size $date DPKG-REPACK\n";
138 print "-r-xr--r-- 1 root root $remove_size $date DPKG-REMOVE\n";
139 if ( -x "/usr/bin/apt-get" ) {
140 print "-r-xr--r-- 1 root root $remove_size $date APT-REMOVE\n";
141 print "-r-xr--r-- 1 root root $reinstall_size $date APT-REINSTALL\n";
142 print "-r-xr--r-- 1 root root $purge_size $date APT-PURGE\n";
145 if( -x "/usr/bin/dpkg-reconfigure" && -x "/var/lib/dpkg/info/$archive.config" ) {
146 print "-r-xr--r-- 1 root root $reconfigure_size $date DPKG-RECONFIGURE\n";
151 if ( open(PIPEIN, "LANG=C ls -l /var/lib/dpkg/info/$qarchive.* |") ) {
155 s%/var/lib/dpkg/info/$archive.%DEBIAN/%;
161 if ( open(LIST, "/var/lib/dpkg/info/$archive.list") ) {
172 my($archive,$filename,$destfile)=@_;
173 my $qarchive = quote($archive);
174 my $qfilename = quote($filename);
175 my $qdestfile = quote($destfile);
177 if($filename eq "INFO") {
178 system("dpkg -s $qarchive > $qdestfile");
179 } elsif($filename eq "DPKG-REPACK") {
180 if ( open(FILEOUT,">$destfile") ) {
181 print FILEOUT $pressrepack;
183 system("chmod a+x $qdestfile");
185 } elsif($filename =~ /^DEBIAN/) {
186 $qfilename=~s!^DEBIAN/!!;
187 system("cat /var/lib/dpkg/info/$qarchive.$qfilename > $qdestfile");
188 } elsif($filename eq "DPKG-REMOVE" || $filename eq "APT-REMOVE") {
189 if ( open(FILEOUT,">$destfile") ) {
190 print FILEOUT $pressremove;
192 system("chmod a+x $qdestfile");
194 } elsif($filename eq "DPKG-PURGE" || $filename eq "APT-PURGE") {
195 if ( open(FILEOUT,">$destfile") ) {
196 print FILEOUT $presspurge;
198 system("chmod a+x $qdestfile");
200 } elsif($filename eq "DPKG-RECONFIGURE") {
201 if ( open(FILEOUT,">$destfile") ) {
202 print FILEOUT $pressreconfigure;
204 system("chmod a+x $qdestfile");
206 } elsif($filename eq "APT-REINSTALL") {
207 if ( open(FILEOUT,">$destfile") ) {
208 print FILEOUT $pressreinstall;
210 system("chmod a+x $destfile");
212 } elsif($filename eq "DPKG-SELECT") {
213 if ( open(FILEOUT,">$destfile") ) {
214 print FILEOUT $pressselect;
216 system("chmod a+x $destfile");
218 } elsif($filename eq "DPKG-UNSELECT") {
219 if ( open(FILEOUT,">$destfile") ) {
220 print FILEOUT $pressunselect;
222 system("chmod a+x $qdestfile");
225 $qfilename=~s!^CONTENTS!!;
226 system("cat $qfilename > $qdestfile");
232 my($archive,$filename)=@_;
233 my $qarchive = quote($archive);
234 my $qfilename = quote($filename);
235 if($filename eq "DPKG-REMOVE") {
236 system("dpkg --remove $qarchive");
237 } elsif($filename eq "APT-REMOVE") {
238 system("apt-get remove $qarchive");
239 } elsif($filename eq "DPKG-PURGE") {
240 system("dpkg --purge $qarchive");
241 } elsif($filename eq "APT-PURGE") {
242 system("apt-get --purge remove $qarchive");
243 } elsif($filename eq "DPKG-REPACK") {
244 system("dpkg-repack $qarchive");
245 } elsif($filename eq "DPKG-SELECT") {
246 system("echo $aqrchive install | dpkg --set-selections");
247 } elsif($filename eq "DPKG-UNSELECT") {
248 system("echo $qarchive deinstall | dpkg --set-selections");
249 } elsif($filename eq "APT-REINSTALL") {
250 system("apt-get -u --reinstall install $qarchive");
251 } elsif($filename eq "DPKG-RECONFIGURE") {
252 system("dpkg-reconfigure $qarchive");
253 } elsif($filename=~/^DEBIAN/) {
254 $qfilename=~s!^DEBIAN!!;
255 system("/var/lib/dpkg/info/$qarchive.$qfilename");
257 $qfilename=~s!^CONTENTS!!;
262 $pressrepack=<<EOInstall;
265 Don\'t use this method if you are not willing to repack this package...
267 This is not a real file. It is a way to repack the package you are browsing.
269 To repack this package go back to the panel and press Enter on this file.
273 $pressreinstall=<<EOInstall;
276 Don\'t use this method if you are not willing to reinstall this package...
278 This is not a real file. It is a way to reinstall the package you are browsing.
280 To reinstall this package go back to the panel and press Enter on this file.
284 $pressremove=<<EOInstall;
287 Don\'t use this method if you are not willing to remove this package...
289 This is not a real file. It is a way to remove the package you are browsing.
291 To remove this package go back to the panel and press Enter on this file.
295 $presspurge=<<EOInstall;
298 Don\'t use this method if you are not willing to purge this package...
300 This is not a real file. It is a way to purge the package you are browsing.
302 To purge this package go back to the panel and press Enter on this file.
306 $pressreconfigure=<<EOInstall;
309 Don\'t use this method if you are not willing to reconfigure this package...
311 This is not a real file. It is a way to reconfigure the package you are browsing.
313 To reconfigure this package go back to the panel and press Enter on this file.
317 $pressreinstall=<<EOInstall;
320 Don\'t use this method if you are not willing to reinstall this package...
322 This is not a real file. It is a way to reinstall the package you are browsing.
324 To reinstall this package go back to the panel and press Enter on this file.
328 $pressselect=<<EOInstall;
331 Don\'t use this method if you are not willing to select this package...
333 This is not a real file. It is a way to select the package you are browsing.
335 To select this package go back to the panel and press Enter on this file.
339 $pressunselect=<<EOInstall;
342 Don\'t use this method if you are not willing to unselect this package...
344 This is not a real file. It is a way to unselect the package you are browsing.
346 To unselect this package go back to the panel and press Enter on this file.
352 chop($name = `if [ -f "$ARGV[1]" ]; then cat $ARGV[1]; else echo $ARGV[1]; fi`);
353 $name =~ s%.*/([0-9a-z.-]*)_.*%$1%;
357 if($ARGV[0] eq "list") { &list($name); exit 0; }
358 elsif($ARGV[0] eq "copyout") { ©out($name,$ARGV[2],$ARGV[3]); exit 0; }
359 elsif($ARGV[0] eq "run") { &run($name,$ARGV[2]); exit 0; }