#! /usr/bin/perl # # 1999 (c) Piotr Roszatycki # This software is under GNU license # last modification: 1999-12-08 # # deba sub quote { $_ = shift(@_); s/([^\w\/.+-])/\\$1/g; return($_); } sub list { my($qarchive)=@_; $qarchive = quote($qarchive); chop($date=`LC_ALL=C date "+%m-%d-%Y %H:%M"`); chop($info_size=`apt-cache show $qarchive | wc -c`); $install_size=length($pressinstall); $upgrade_size=length($pressupgrade); print "-r--r--r-- 1 root root $info_size $date INFO\n"; chop($debd = `dpkg -s $qarchive | grep -i ^Version | sed 's/^version: //i'`); chop($deba = `apt-cache show $qarchive | grep -i ^Version | sed 's/^version: //i'`); if( ! $debd ) { print "-r-xr--r-- 1 root root $install_size $date INSTALL\n"; } elsif( $debd ne $deba ) { print "-r-xr--r-- 1 root root $upgrade_size $date UPGRADE\n"; } } sub copyout { my($archive,$filename,$destfile)=@_; my $qarchive = quote($archive); my $qdestfile = quote($destfile); if($filename eq "INFO") { system("apt-cache show $qarchive > $qdestfile"); } elsif($filename eq "INSTALL") { if ( open(FILEOUT, "> $destfile") ) { print FILEOUT $pressinstall; close FILEOUT; system("chmod a+x $qdestfile"); } } elsif($filename eq "UPGRADE") { if ( open(FILEOUT, ">, $destfile") ) { print FILEOUT $pressupgrade; close FILEOUT; system("chmod a+x $qdestfile"); } } else { die "extfs: $filename: No such file or directory\n"; } } sub run { my($archive,$filename)=@_; my $qarchive = quote($archive); if($filename eq "INSTALL") { system("apt-get install $qarchive"); } elsif($filename eq "UPGRADE") { system("apt-get install $qarchive"); } else { die "extfs: $filename: Permission denied\n"; } } $pressinstall=<