2000-01-02 Martin Bialasinski <martin@internet-treff.uni-koeln.de>

* From debian: added deba, debd, dpkg, apt script file systems.
This commit is contained in:
Miguel de Icaza 2000-01-02 23:48:55 +00:00
parent ee4eabc27d
commit 32955de6bf
6 changed files with 1222 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2000-01-02 Martin Bialasinski <martin@internet-treff.uni-koeln.de>
* From debian: added deba, debd, dpkg, apt script file systems.
1999-12-21 Pavel Roskin <pavel_roskin@geocities.com>
* vfs/vfs.h: use #warning only for gcc. Not all compilers

345
vfs/extfs/apt Normal file
View File

@ -0,0 +1,345 @@
#! /usr/bin/perl
#
# 1999 (c) Piotr Roszatycki <dexter@debian.org>
# This software is under GNU license
# last modification: 1999-12-08
#
# apt
sub bt
{
my ($dt) = @_;
my (@time);
@time = localtime($dt);
$bt = sprintf "%02d-%02d-%02d %02d:%02d", $time[4], $time[3], $time[5], $time[2], $time[1];
return $bt;
}
sub ft
{
my ($f) = @_;
return "d" if -d $f;
return "l" if -l $f;
return "p" if -p $f;
return "S" if -S $f;
return "b" if -b $f;
return "c" if -c $f;
return "-";
}
sub fm
{
my ($n) = @_;
my ($m);
if( $n & 0400 ) {
$m .= "r";
} else {
$m .= "-";
}
if( $n & 0200 ) {
$m .= "w";
} else {
$m .= "-";
}
if( $n & 04000 ) {
$m .= "s";
} elsif( $n & 0100 ) {
$m .= "x";
} else {
$m .= "-";
}
if( $n & 0040 ) {
$m .= "r";
} else {
$m .= "-";
}
if( $n & 0020 ) {
$m .= "w";
} else {
$m .= "-";
}
if( $n & 02000 ) {
$m .= "s";
} elsif( $n & 0010 ) {
$m .= "x";
} else {
$m .= "-";
}
if( $n & 0004 ) {
$m .= "r";
} else {
$m .= "-";
}
if( $n & 0002 ) {
$m .= "w";
} else {
$m .= "-";
}
if( $n & 01000 ) {
$m .= "t";
} elsif( $n & 0001 ) {
$m .= "x";
} else {
$m .= "-";
}
return $m;
}
sub ls {
my ($file,$path,$mode) = @_;
my @stat = stat($file);
# mode, nlink, uid, gid, size, mtime, filename
printf "%s %d %d %d %d %s %s\n", $mode || ft($file).fm($stat[2] & 07777),
$stat[3], $stat[4], $stat[5], $stat[7], bt($stat[9]), $path;
}
$DATE=bt(time());
sub list
{
my ($pkg, $fn, $dn, $sz, $bt);
my($check,$stats,$config);
chop($check = `apt-get -q check 2>/dev/null`);
chop($available = `apt-cache dumpavail 2>/dev/null`);
chop($stats = `apt-cache stats 2>/dev/null`);
chop($config = `apt-config dump 2>&1`);
$sz = length($check);
print "-r--r--r-- 1 root root $sz $DATE CHECK\n";
$sz = length($available);
print "-r--r--r-- 1 root root $sz $DATE AVAILABLE\n";
$sz = length($stats);
print "-r--r--r-- 1 root root $sz $DATE STATS\n";
$sz = length($config);
print "-r--r--r-- 1 root root $sz $DATE CONFIG\n";
$sz = length($pressupdate);
print "-r-xr--r-- 1 root root $sz $DATE UPDATE\n";
$sz = length($pressupgrade);
print "-r-xr--r-- 1 root root $sz $DATE UPGRADE\n";
print "-r-xr--r-- 1 root root $sz $DATE DIST-UPGRADE\n";
ls("/etc/apt/sources.list","sources.list");
ls("/etc/apt/apt.conf","apt.conf");
print "drwxr-xr-x 1 root root 0 $DATE all\n";
if ( open(PIPEIN, "find /var/cache/apt/archives -type f |") ) {
while(<PIPEIN>) {
chop;
next if /\/lock$/;
my $file = $_;
s%/var/cache/apt/archives/%CACHE/%;
ls($file, $_);
}
close PIPEIN;
}
my %sects = ();
my %debd = ();
my %deba = ();
open STAT, "/var/lib/dpkg/status"
or exit 1;
while( <STAT> ) {
chop;
if( /^([\w-]*): (.*)/ ) {
$pkg = $2 if( lc($1) eq 'package' );
$debd{$pkg}{lc($1)} = $2;
}
}
close STAT;
foreach $pkg (sort keys %debd) {
next if $debd{$pkg}{status} =~ /not-installed/;
$fn = $debd{$pkg}{package}. "_". $debd{$pkg}{version};
$dn = $debd{$pkg}{section};
if( ! $dn ) {
$dn = "unknown";
} elsif( $dn =~ /^(non-us)$/i ) {
$dn .= "/main";
} elsif( $dn !~ /\// ) {
$dn = "main/". $dn;
}
unless( $sects{$dn} ) {
my $sub = $dn;
while( $sub =~ s!^(.*)/[^/]*$!$1! ) {
unless( $sects{$sub} ) {
print "drwxr-xr-x 1 root root 0 $DATE $sub/\n";
$sects{$sub} = 1;
}
}
print "drwxr-xr-x 1 root root 0 $DATE $dn/\n";
$sects{$dn} = 1;
}
$sz = $debd{$pkg}{'status'} =~ /config-files/ ? 0 : $debd{$pkg}{'installed-size'} * 1024;
@stat = stat("/var/lib/dpkg/info/".$debd{$pkg}{package}.".list");
$bt = bt($stat[9]);
print "-rw-r--r-- 1 root root $sz $bt $dn/$fn.debd\n";
print "lrwxrwxrwx 1 root root $sz $bt all/$fn.debd -> ../$dn/$fn.debd\n";
}
open STAT, "apt-cache dumpavail |"
or exit 1;
while( <STAT> ) {
chop;
if( /^([\w-]*): (.*)/ ) {
$pkg = $2 if( lc($1) eq 'package' );
$deba{$pkg}{lc($1)} = $2;
}
}
close STAT;
foreach $pkg (sort keys %deba) {
next if $deba{$pkg}{version} eq $debd{$pkg}{version};
$fn = $deba{$pkg}{package}. "_". $deba{$pkg}{version};
$dn = $deba{$pkg}{section};
if( ! $dn ) {
$dn = "unknown";
} elsif( $dn =~ /^(non-us)$/i ) {
$dn .= "/main";
} elsif( $dn !~ /\// ) {
$dn = "main/". $dn;
}
unless( $sects{$dn} ) {
my $sub = $dn;
while( $sub =~ s!^(.*)/[^/]*$!$1! ) {
unless( $sects{$sub} ) {
print "drwxr-xr-x 1 root root 0 $DATE $sub/\n";
$sects{$sub} = 1;
}
}
print "drwxr-xr-x 1 root root 0 $DATE $dn/\n";
$sects{$dn} = 1;
}
$sz = $deba{$pkg}{'status'} =~ /config-files/ ? 0 : $deba{$pkg}{'installed-size'} * 1024;
print "-rw-r--r-- 1 root root $sz $DATE $dn/$fn.deba\n";
print "lrwxrwxrwx 1 root root $sz $DATE all/$fn.deba -> ../$dn/$fn.deba\n";
}
}
sub copyout
{
my($archive,$filename) = @_;
if( $archive eq 'CHECK' ) {
system("apt-get -q check > $filename");
} elsif( $archive eq 'AVAILABLE' ) {
system("apt-cache dumpavail > $filename");
} elsif( $archive eq 'STATS' ) {
system("apt-cache stats > $filename");
} elsif( $archive eq 'CONFIG' ) {
system("(apt-config dump 2>&1) > $filename");
} elsif( $archive eq 'UPDATE' ) {
open O, ">$filename";
print O $pressupdate;
close O;
} elsif( $archive eq 'UPGRADE' || $archive eq 'DIST-UPGRADE' ) {
open O, ">$filename";
print O $pressupgrade;
close O;
} elsif( $archive eq 'apt.conf' ) {
system("cp /etc/apt/apt.conf $filename");
} elsif( $archive eq 'sources.list' ) {
system("cp /etc/apt/sources.list $filename");
} elsif( $archive =~ /^CACHE\// ) {
$archive =~ s%^CACHE/%/var/cache/apt/archives/%;
system("cp $archive $filename");
} else {
open O, ">$filename";
print O $archive, "\n";
close O;
}
}
sub copyin
{
my($archive,$filename) = @_;
if( $archive =~ /\.deb$/ ) {
system("dpkg -i $filename>/dev/null");
} elsif( $archive eq 'apt.conf' ) {
system("cp $filename /etc/apt/apt.conf");
} elsif( $archive eq 'sources.list' ) {
system("cp $filename /etc/apt/sources.list");
} elsif( $archive =~ /^CACHE\// ) {
$archive =~ s%^CACHE/%/var/cache/apt/archives/%;
system("cp $filename $archive");
} else {
die "extfs: cannot create regular file \`$archive\': Permission denied\n";
}
}
sub run
{
my($archive,$filename) = @_;
if( $archive eq 'UPDATE' ) {
system("apt-get update");
} elsif( $archive eq 'UPGRADE' ) {
system("apt-get upgrade -u");
} elsif( $archive eq 'DIST-UPGRADE' ) {
system("apt-get dist-upgrade -u");
} else {
die "extfs: $archive: command not found\n";
}
}
sub rm
{
my($archive) = @_;
if( $archive =~ /^CACHE\// ) {
$archive =~ s%^CACHE/%/var/cache/apt/archives/%;
system("rm -f $archive");
} elsif( $archive eq 'apt.conf' ) {
system("rm -f /etc/apt/apt.conf");
} elsif( $archive eq 'sources.list' ) {
system("rm -f /etc/apt/sources.list");
# This interact with user - it can't be execute :-(
# } elsif( $archive =~ /\.deb[ad]?$/ ) {
# my $name = $archive;
# $name =~ s%.*/%%g;
# $name =~ s%_.*%%g;
# system("apt-get remove $name");
# die("extfs: $archive: Operation not permitted\n") if $? != 0;
} else {
die "extfs: $archive: Operation not permitted\n";
}
}
$pressupdate=<<EOInstall;
WARNING
Don\'t use this method if you are not willing to retrieve new lists
of packages.
This is not a real file. It is a way to retrieve new lists of packages.
To update this information go back to the panel and press Enter on this file.
EOInstall
$pressupgrade=<<EOInstall;
WARNING
Don\'t use this method if you are not willing to perform an upgrade.
This is not a real file. It is a way to perform an upgrade.
To upgrade this information go back to the panel and press Enter on this file.
EOInstall
# override any locale for dates
$ENV{"LC_ALL"}="C";
if ($ARGV[0] eq "list") { list(); exit(0); }
elsif ($ARGV[0] eq "copyout") { copyout($ARGV[2], $ARGV[3]); exit(0); }
elsif ($ARGV[0] eq "copyin") { copyin($ARGV[2], $ARGV[3]); exit(0); }
elsif ($ARGV[0] eq "run") { run($ARGV[2]); exit(0); }
elsif ($ARGV[0] eq "rm") { rm($ARGV[2]); exit(0); }
exit(1);

190
vfs/extfs/deba Normal file
View File

@ -0,0 +1,190 @@
#!/usr/bin/perl
#
# 1999 (c) Piotr Roszatycki <dexter@debian.org>
# This software is under GNU license
# last modification: 1999-12-08
#
# deba
sub bt
{
my ($dt) = @_;
my (@time);
@time = localtime($dt);
$bt = sprintf "%02d-%02d-%02d %02d:%02d", $time[4], $time[3], $time[5], $time[2], $time[1];
return $bt;
}
sub ft
{
my ($f) = @_;
return "d" if -d $f;
return "l" if -l $f;
return "p" if -p $f;
return "S" if -S $f;
return "b" if -b $f;
return "c" if -c $f;
return "-";
}
sub fm
{
my ($n) = @_;
my ($m);
if( $n & 0400 ) {
$m .= "r";
} else {
$m .= "-";
}
if( $n & 0200 ) {
$m .= "w";
} else {
$m .= "-";
}
if( $n & 04000 ) {
$m .= "s";
} elsif( $n & 0100 ) {
$m .= "x";
} else {
$m .= "-";
}
if( $n & 0040 ) {
$m .= "r";
} else {
$m .= "-";
}
if( $n & 0020 ) {
$m .= "w";
} else {
$m .= "-";
}
if( $n & 02000 ) {
$m .= "s";
} elsif( $n & 0010 ) {
$m .= "x";
} else {
$m .= "-";
}
if( $n & 0004 ) {
$m .= "r";
} else {
$m .= "-";
}
if( $n & 0002 ) {
$m .= "w";
} else {
$m .= "-";
}
if( $n & 01000 ) {
$m .= "t";
} elsif( $n & 0001 ) {
$m .= "x";
} else {
$m .= "-";
}
return $m;
}
sub ls {
my ($file) = @_;
my @stat = stat($file);
# mode, nlink, uid, gid, size, mtime, filename
printf "%s%s %d %d %d %d %s CONTENTS%s\n", ft($file), fm($stat[2] & 07777),
$stat[3], $stat[4], $stat[5], $stat[7], bt($stat[9]), $file;
}
sub list
{
my($archive)=@_;
chop($date=`LC_ALL=C date "+%b %d %Y %H:%M"`);
chop($info_size=`apt-cache show $archive | 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 $archive | grep -i ^Version | sed 's/^version: //i'`);
chop($deba = `apt-cache show $archive | 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)=@_;
if($filename eq "INFO") {
system("apt-cache show $archive > $destfile");
} elsif($filename eq "INSTALL") {
if ( open(FILEOUT,">$destfile") ) {
print FILEOUT $pressinstall;
close FILEOUT;
system("chmod a+x $destfile");
}
} elsif($filename eq "UPGRADE") {
if ( open(FILEOUT,">$destfile") ) {
print FILEOUT $pressupgrade;
close FILEOUT;
system("chmod a+x $destfile");
}
} else {
die "extfs: $filename: No such file or directory\n";
}
}
sub run
{
my($archive,$filename)=@_;
if($filename eq "INSTALL") {
system("apt-get install $archive");
} elsif($filename eq "UPGRADE") {
system("apt-get install $archive");
} else {
die "extfs: $filename: Permission denied\n";
}
}
$pressinstall=<<EOInstall;
WARNING
Don\'t use this method if you are not willing to install this package...
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.
EOInstall
$pressupgrade=<<EOInstall;
WARNING
Don\'t use this method if you are not willing to upgrade this package...
This is not a real file. It is a way to upgrade the package you are browsing.
To upgrade this package go back to the panel and press Enter on this file.
EOInstall
umask 077;
chop($name = `if [ -f "$ARGV[1]" ]; then cat $ARGV[1]; else echo $ARGV[1]; fi`);
$name =~ s%.*/([0-9a-z.-]*)_.*%$1%;
exit 1 unless $name;
if($ARGV[0] eq "list") { &list($name); exit 0; }
elsif($ARGV[0] eq "copyout") { &copyout($name,$ARGV[2],$ARGV[3]); exit 0; }
elsif($ARGV[0] eq "run") { &run($name,$ARGV[2]); exit 0; }
exit 1;

349
vfs/extfs/debd Normal file
View File

@ -0,0 +1,349 @@
#!/usr/bin/perl
#
# 1999 (c) Piotr Roszatycki <dexter@debian.org>
# This software is under GNU license
# last modification: 1999-12-08
#
# debd
sub bt
{
my ($dt) = @_;
my (@time);
@time = localtime($dt);
$bt = sprintf "%02d-%02d-%02d %02d:%02d", $time[4], $time[3], $time[5], $time[2], $time[1];
return $bt;
}
sub ft
{
my ($f) = @_;
return "d" if -d $f;
return "l" if -l $f;
return "p" if -p $f;
return "S" if -S $f;
return "b" if -b $f;
return "c" if -c $f;
return "-";
}
sub fm
{
my ($n) = @_;
my ($m);
if( $n & 0400 ) {
$m .= "r";
} else {
$m .= "-";
}
if( $n & 0200 ) {
$m .= "w";
} else {
$m .= "-";
}
if( $n & 04000 ) {
$m .= "s";
} elsif( $n & 0100 ) {
$m .= "x";
} else {
$m .= "-";
}
if( $n & 0040 ) {
$m .= "r";
} else {
$m .= "-";
}
if( $n & 0020 ) {
$m .= "w";
} else {
$m .= "-";
}
if( $n & 02000 ) {
$m .= "s";
} elsif( $n & 0010 ) {
$m .= "x";
} else {
$m .= "-";
}
if( $n & 0004 ) {
$m .= "r";
} else {
$m .= "-";
}
if( $n & 0002 ) {
$m .= "w";
} else {
$m .= "-";
}
if( $n & 01000 ) {
$m .= "t";
} elsif( $n & 0001 ) {
$m .= "x";
} else {
$m .= "-";
}
return $m;
}
sub ls {
my ($file) = @_;
my @stat = stat($file);
# mode, nlink, uid, gid, size, mtime, filename
printf "%s%s %d %d %d %d %s CONTENTS%s\n", ft($file), fm($stat[2] & 07777),
$stat[3], $stat[4], $stat[5], $stat[7], bt($stat[9]), $file;
}
sub list
{
my($archive)=@_;
chop($date=`LC_ALL=C date "+%b %d %Y %H:%M"`);
chop($info_size=`dpkg -s $archive | wc -c`);
$repack_size=length($pressrepack);
$reinstall_size=length($pressreinstall);
$remove_size=length($pressremove);
$purge_size=length($presspurge);
$reconfigure_size=length($pressreconfigure);
$reinstall_size=length($pressreinstall);
$select_size=length($pressselect);
$unselect_size=length($pressunselect);
print "dr-xr-xr-x 1 root root 0 $date CONTENTS\n";
print "dr-xr-xr-x 1 root root 0 $date DEBIAN\n";
print "-r--r--r-- 1 root root $info_size $date INFO\n";
print "-r-xr--r-- 1 root root $purge_size $date DPKG-PURGE\n";
chop($status = `dpkg -s $archive | grep ^Status`);
if( $status =~ /deinstall/ ) {
print "-r-xr--r-- 1 root root $select_size $date DPKG-SELECT\n";
} elsif( $status =~ /install/ ) {
print "-r-xr--r-- 1 root root $unselect_size $date DPKG-UNSELECT\n";
}
if( $status !~ /config-files/ ) {
if ( -x "/usr/bin/dpkg-repack" ) {
print "-r-xr--r-- 1 root root $repack_size $date DPKG-REPACK\n";
}
print "-r-xr--r-- 1 root root $remove_size $date DPKG-REMOVE\n";
if ( -x "/usr/bin/apt-get" ) {
print "-r-xr--r-- 1 root root $remove_size $date APT-REMOVE\n";
print "-r-xr--r-- 1 root root $reinstall_size $date APT-REINSTALL\n";
print "-r-xr--r-- 1 root root $purge_size $date APT-PURGE\n";
}
}
if( -x "/usr/bin/dpkg-reconfigure" && -x "/var/lib/dpkg/info/$archive.config" ) {
print "-r-xr--r-- 1 root root $reconfigure_size $date DPKG-RECONFIGURE\n";
}
if ( open(PIPEIN, "LANG=C ls -l /var/lib/dpkg/info/$archive.* |") ) {
while(<PIPEIN>) {
chop;
next if /\.list$/;
s%/var/lib/dpkg/info/$archive.%DEBIAN/%;
print $_, "\n";
}
close PIPEIN;
}
if ( open(LIST, "/var/lib/dpkg/info/$archive.list") ) {
while(<LIST>) {
chop;
ls($_);
}
close LIST;
}
}
sub copyout
{
my($archive,$filename,$destfile)=@_;
if($filename eq "INFO") {
system("dpkg -s $archive > $destfile");
} elsif($filename eq "DPKG-REPACK") {
if ( open(FILEOUT,">$destfile") ) {
print FILEOUT $pressrepack;
close FILEOUT;
system("chmod a+x $destfile");
}
} elsif($filename =~ /^DEBIAN/) {
$filename=~s!^DEBIAN/!!;
system("cat /var/lib/dpkg/info/$archive.$filename > $destfile");
} elsif($filename eq "DPKG-REMOVE" || $filename eq "APT-REMOVE") {
if ( open(FILEOUT,">$destfile") ) {
print FILEOUT $pressremove;
close FILEOUT;
system("chmod a+x $destfile");
}
} elsif($filename eq "DPKG-PURGE" || $filename eq "APT-PURGE") {
if ( open(FILEOUT,">$destfile") ) {
print FILEOUT $presspurge;
close FILEOUT;
system("chmod a+x $destfile");
}
} elsif($filename eq "DPKG-RECONFIGURE") {
if ( open(FILEOUT,">$destfile") ) {
print FILEOUT $pressreconfigure;
close FILEOUT;
system("chmod a+x $destfile");
}
} elsif($filename eq "APT-REINSTALL") {
if ( open(FILEOUT,">$destfile") ) {
print FILEOUT $pressreinstall;
close FILEOUT;
system("chmod a+x $destfile");
}
} elsif($filename eq "DPKG-SELECT") {
if ( open(FILEOUT,">$destfile") ) {
print FILEOUT $pressselect;
close FILEOUT;
system("chmod a+x $destfile");
}
} elsif($filename eq "DPKG-UNSELECT") {
if ( open(FILEOUT,">$destfile") ) {
print FILEOUT $pressunselect;
close FILEOUT;
system("chmod a+x $destfile");
}
} else {
$filename=~s!^CONTENTS!!;
system("cat $filename > $destfile");
}
}
sub run
{
my($archive,$filename)=@_;
if($filename eq "DPKG-REMOVE") {
system("dpkg --remove $archive");
} elsif($filename eq "APT-REMOVE") {
system("apt-get remove $archive");
} elsif($filename eq "DPKG-PURGE") {
system("dpkg --purge $archive");
} elsif($filename eq "APT-PURGE") {
system("apt-get --purge remove $archive");
} elsif($filename eq "DPKG-REPACK") {
system("dpkg-repack $archive");
} elsif($filename eq "DPKG-SELECT") {
system("echo $archive install | dpkg --set-selections");
} elsif($filename eq "DPKG-UNSELECT") {
system("echo $archive deinstall | dpkg --set-selections");
} elsif($filename eq "APT-REINSTALL") {
system("apt-get -u --reinstall install $archive");
} elsif($filename eq "DPKG-RECONFIGURE") {
system("dpkg-reconfigure $archive");
} elsif($filename=~/^DEBIAN/) {
$filename=~s!^DEBIAN!!;
system("/var/lib/dpkg/info/$archive.$filename");
} else {
$filename=~s!^CONTENTS!!;
system($filename);
}
}
$pressrepack=<<EOInstall;
WARNING
Don\'t use this method if you are not willing to repack this package...
This is not a real file. It is a way to repack the package you are browsing.
To repack this package go back to the panel and press Enter on this file.
EOInstall
$pressreinstall=<<EOInstall;
WARNING
Don\'t use this method if you are not willing to reinstall this package...
This is not a real file. It is a way to reinstall the package you are browsing.
To reinstall this package go back to the panel and press Enter on this file.
EOInstall
$pressremove=<<EOInstall;
WARNING
Don\'t use this method if you are not willing to remove this package...
This is not a real file. It is a way to remove the package you are browsing.
To remove this package go back to the panel and press Enter on this file.
EOInstall
$presspurge=<<EOInstall;
WARNING
Don\'t use this method if you are not willing to purge this package...
This is not a real file. It is a way to purge the package you are browsing.
To purge this package go back to the panel and press Enter on this file.
EOInstall
$pressreconfigure=<<EOInstall;
WARNING
Don\'t use this method if you are not willing to reconfigure this package...
This is not a real file. It is a way to reconfigure the package you are browsing.
To reconfigure this package go back to the panel and press Enter on this file.
EOInstall
$pressreinstall=<<EOInstall;
WARNING
Don\'t use this method if you are not willing to reinstall this package...
This is not a real file. It is a way to reinstall the package you are browsing.
To reinstall this package go back to the panel and press Enter on this file.
EOInstall
$pressselect=<<EOInstall;
WARNING
Don\'t use this method if you are not willing to select this package...
This is not a real file. It is a way to select the package you are browsing.
To select this package go back to the panel and press Enter on this file.
EOInstall
$pressunselect=<<EOInstall;
WARNING
Don\'t use this method if you are not willing to unselect this package...
This is not a real file. It is a way to unselect the package you are browsing.
To unselect this package go back to the panel and press Enter on this file.
EOInstall
umask 077;
chop($name = `if [ -f "$ARGV[1]" ]; then cat $ARGV[1]; else echo $ARGV[1]; fi`);
$name =~ s%.*/([0-9a-z.-]*)_.*%$1%;
exit 1 unless $name;
if($ARGV[0] eq "list") { &list($name); exit 0; }
elsif($ARGV[0] eq "copyout") { &copyout($name,$ARGV[2],$ARGV[3]); exit 0; }
elsif($ARGV[0] eq "run") { &run($name,$ARGV[2]); exit 0; }
exit 1;

325
vfs/extfs/dpkg Normal file
View File

@ -0,0 +1,325 @@
#! /usr/bin/perl
#
# 1999 (c) Piotr Roszatycki <dexter@debian.org>
# This software is under GNU license
# last modification: 1999-12-08
#
# dpkg
sub bt
{
my ($dt) = @_;
my (@time);
@time = localtime($dt);
$bt = sprintf "%02d-%02d-%02d %02d:%02d", $time[4], $time[3], $time[5], $time[2], $time[1];
return $bt;
}
sub ft
{
my ($f) = @_;
return "d" if -d $f;
return "l" if -l $f;
return "p" if -p $f;
return "S" if -S $f;
return "b" if -b $f;
return "c" if -c $f;
return "-";
}
sub fm
{
my ($n) = @_;
my ($m);
if( $n & 0400 ) {
$m .= "r";
} else {
$m .= "-";
}
if( $n & 0200 ) {
$m .= "w";
} else {
$m .= "-";
}
if( $n & 04000 ) {
$m .= "s";
} elsif( $n & 0100 ) {
$m .= "x";
} else {
$m .= "-";
}
if( $n & 0040 ) {
$m .= "r";
} else {
$m .= "-";
}
if( $n & 0020 ) {
$m .= "w";
} else {
$m .= "-";
}
if( $n & 02000 ) {
$m .= "s";
} elsif( $n & 0010 ) {
$m .= "x";
} else {
$m .= "-";
}
if( $n & 0004 ) {
$m .= "r";
} else {
$m .= "-";
}
if( $n & 0002 ) {
$m .= "w";
} else {
$m .= "-";
}
if( $n & 01000 ) {
$m .= "t";
} elsif( $n & 0001 ) {
$m .= "x";
} else {
$m .= "-";
}
return $m;
}
sub ls {
my ($file,$path,$mode) = @_;
my @stat = stat($file);
# mode, nlink, uid, gid, size, mtime, filename
printf "%s %d %d %d %d %s %s\n", $mode || ft($file).fm($stat[2] & 07777),
$stat[3], $stat[4], $stat[5], $stat[7], bt($stat[9]), $path;
}
$DATE=bt(time());
sub list
{
my ($pkg, $fn, $dn, $sz, $bt);
my %debs = ();
my %sects = ();
my($diversions,$architecture);
chop($diversions = `dpkg-divert --list 2>/dev/null`);
chop($architecture = `dpkg-architecture 2>/dev/null`);
chop($list = `dpkg -l '*' 2>/dev/null`);
chop($getselections = `dpkg --get-selections 2>/dev/null`);
chop($audit = `dpkg --audit 2>/dev/null`);
$sz = length($diversions);
print "-r--r--r-- 1 root root $sz $DATE DIVERSIONS\n";
$sz = length($architecture);
print "-r--r--r-- 1 root root $sz $DATE ARCHITECTURE\n";
$sz = length($list);
print "-r--r--r-- 1 root root $sz $DATE LIST\n";
$sz = length($getselections);
print "-r--r--r-- 1 root root $sz $DATE GET-SELECTIONS\n";
$sz = length($audit);
print "-r--r--r-- 1 root root $sz $DATE AUDIT\n";
$sz = length($pressconfigure);
print "-r-xr--r-- 1 root root $sz $DATE CONFIGURE\n";
$sz = length($pressremove);
print "-r-xr--r-- 1 root root $sz $DATE REMOVE\n";
$sz = length($pressclearavail);
print "-r-xr--r-- 1 root root $sz $DATE CLEAR-AVAIL\n";
$sz = length($pressforgetoldunavail);
print "-r-xr--r-- 1 root root $sz $DATE FORGET-OLD-UNAVAIL\n";
ls("/var/lib/dpkg/status","STATUS","-r--r--r--");
# ls("/var/lib/dpkg/available","AVAILABLE","-r--r--r--");
print "drwxr-xr-x 1 root root 0 $DATE all\n";
open STAT, "/var/lib/dpkg/status"
or exit 1;
while( <STAT> ) {
chop;
if( /^([\w-]*): (.*)/ ) {
$pkg = $2 if( lc($1) eq 'package' );
$debs{$pkg}{lc($1)} = $2;
}
}
close STAT;
foreach $pkg (sort keys %debs) {
next if $debs{$pkg}{status} =~ /not-installed/;
$fn = $debs{$pkg}{package}. "_". $debs{$pkg}{version};
$dn = $debs{$pkg}{section};
if( ! $dn ) {
$dn = "unknown";
} elsif( $dn =~ /^(non-us)$/i ) {
$dn .= "/main";
} elsif( $dn !~ /\// ) {
$dn = "main/". $dn;
}
unless( $sects{$dn} ) {
my $sub = $dn;
while( $sub =~ s!^(.*)/[^/]*$!$1! ) {
unless( $sects{$sub} ) {
print "drwxr-xr-x 1 root root 0 $DATE $sub/\n";
$sects{$sub} = 1;
}
}
print "drwxr-xr-x 1 root root 0 $DATE $dn/\n";
$sects{$dn} = 1;
}
$sz = $debs{$pkg}{'status'} =~ /config-files/ ? 0 : $debs{$pkg}{'installed-size'} * 1024;
@stat = stat("/var/lib/dpkg/info/".$debs{$pkg}{package}.".list");
$bt = bt($stat[9]);
print "-rw-r--r-- 1 root root $sz $bt $dn/$fn.debd\n";
print "lrwxrwxrwx 1 root root $sz $bt all/$fn.debd -> ../$dn/$fn.debd\n";
}
}
sub copyout
{
my($archive,$filename) = @_;
if( $archive eq 'DIVERSIONS' ) {
system("dpkg-divert --list > $filename 2>/dev/null");
} elsif( $archive eq 'ARCHITECTURE' ) {
system("dpkg-architecture > $filename 2>/dev/null");
} elsif( $archive eq 'LIST' ) {
system("dpkg -l '*' > $filename 2>/dev/null");
} elsif( $archive eq 'AUDIT' ) {
system("dpkg --audit > $filename 2>/dev/null");
} elsif( $archive eq 'GET-SELECTIONS' ) {
system("dpkg --get-selections > $filename 2>/dev/null");
} elsif( $archive eq 'STATUS' ) {
system("cp /var/lib/dpkg/status $filename");
} elsif( $archive eq 'AVAILABLE' ) {
system("cp /var/lib/dpkg/available $filename");
} elsif( $archive eq 'CONFIGURE' ) {
open O, ">$filename";
print O $pressconfigure;
close O;
} elsif( $archive eq 'REMOVE' ) {
open O, ">$filename";
print O $pressremove;
close O;
} elsif( $archive eq 'CLEAR-AVAIL' ) {
open O, ">$filename";
print O $pressclearavail;
close O;
} elsif( $archive eq 'FORGET-OLD-UNAVAIL' ) {
open O, ">$filename";
print O $pressforgetoldunavail;
close O;
} else {
open O, ">$filename";
print O $archive, "\n";
close O;
}
}
# too noisy but less dangerouse
sub copyin
{
my($archive,$filename) = @_;
if( $archive =~ /\.deb$/ ) {
system("dpkg -i $filename>/dev/null");
} else {
die "extfs: cannot create regular file \`$archive\': Permission denied\n";
}
}
sub run
{
my($archive,$filename) = @_;
if( $archive eq 'CONFIGURE' ) {
system("dpkg --pending --configure");
} elsif( $archive eq 'REMOVE' ) {
system("dpkg --pending --remove");
} elsif( $archive eq 'CLEAR-AVAIL' ) {
system("dpkg --clear-avail");
} elsif( $archive eq 'FORGET-OLD-UNAVAIL' ) {
system("dpkg --forget-old-unavail");
} else {
die "extfs: $filename: command not found\n";
}
}
# Disabled - too dangerous and too noisy
sub rm_disabled
{
my($archive) = @_;
if( $archive =~ /\.debd?$/ ) {
my $name = $archive;
$name =~ s%.*/%%g;
$name =~ s%_.*%%g;
system("if dpkg -s $name | grep ^Status | grep -qs config-files; \
then dpkg --purge $name>/dev/null; \
else dpkg --remove $name>/dev/null; fi");
die("extfs: $archive: Operation not permitted\n") if $? != 0;
} else {
die "extfs: $archive: Operation not permitted\n";
}
}
$pressconfigure=<<EOInstall;
WARNING
Don\'t use this method if you are not willing to configure all
non configured packages.
This is not a real file. It is a way to configure all non configured packages.
To configure packages go back to the panel and press Enter on this file.
EOInstall
$pressremove=<<EOInstall;
WARNING
Don\'t use this method if you are not willing to remove all
unselected packages.
This is not a real file. It is a way to remove all unselected packages.
To remove packages go back to the panel and press Enter on this file.
EOInstall
$pressforgetoldunavail=<<EOInstall;
WARNING
Don\'t use this method if you are not willing to forget about
uninstalled unavailable packages.
This is not a real file. It is a way to forget about uninstalled
unavailable packages.
To forget this information go back to the panel and press Enter on this file.
EOInstall
$pressclearavail=<<EOInstall;
WARNING
Don\'t use this method if you are not willing to erase the existing
information about what packages are available.
This is not a real file. It is a way to erase the existing information
about what packages are available.
To clear this information go back to the panel and press Enter on this file.
EOInstall
# override any locale for dates
$ENV{"LC_ALL"}="C";
if ($ARGV[0] eq "list") { list(); exit(0); }
elsif ($ARGV[0] eq "copyout") { copyout($ARGV[2], $ARGV[3]); exit(0); }
elsif ($ARGV[0] eq "copyin") { copyin($ARGV[2], $ARGV[3]); exit(0); }
elsif ($ARGV[0] eq "run") { run($ARGV[2],$ARGV[3]); exit(0); }
#elsif ($ARGV[0] eq "rm") { rm($ARGV[2]); exit(0); }
exit(1);

View File

@ -39,4 +39,12 @@ mailfs
# Lists the rpms on the system
rpms:
trpm
trpm
# dpkg frontent
dpkg:
debd
# apt frontend
apt:
deba