mirror of
https://github.com/Project-OSS-Revival/alien.git
synced 2026-04-24 14:00:17 +00:00
Added checkfile class method.
This commit is contained in:
@@ -155,6 +155,20 @@ having to write your own new() method.
|
||||
|
||||
sub init {}
|
||||
|
||||
=item checkfile
|
||||
|
||||
This is a class method. Pass it a filename, and it will return true if it
|
||||
looks like the file is a package of the type handled by the class.
|
||||
|
||||
=cut
|
||||
|
||||
sub checkfile {
|
||||
my $this=shift;
|
||||
my $file=shift;
|
||||
|
||||
return ''; # children override this.
|
||||
}
|
||||
|
||||
=item install
|
||||
|
||||
Simply installs a package file. The filename is passed on standard input.
|
||||
|
||||
@@ -50,6 +50,19 @@ sub init {
|
||||
}
|
||||
}
|
||||
|
||||
=item checkfile
|
||||
|
||||
Detect deb files by their extention.
|
||||
|
||||
=cut
|
||||
|
||||
sub checkfile {
|
||||
my $this=shift;
|
||||
my $file=shift;
|
||||
|
||||
return $file =~ m/.*\.deb$/;
|
||||
}
|
||||
|
||||
=item install
|
||||
|
||||
Install a deb with dpkg. Pass in the filename of the deb to install.
|
||||
|
||||
@@ -28,6 +28,19 @@ Relocatable rpm packages have a prefixes field.
|
||||
|
||||
=over 4
|
||||
|
||||
=item checkfile
|
||||
|
||||
Detect rpm files by their extention.
|
||||
|
||||
=cut
|
||||
|
||||
sub checkfile {
|
||||
my $this=shift;
|
||||
my $file=shift;
|
||||
|
||||
return $file =~ m/.*\.rpm$/;
|
||||
}
|
||||
|
||||
=item install
|
||||
|
||||
Install a rpm. If RPMINSTALLOPT is set in the environement, the options in
|
||||
|
||||
@@ -92,6 +92,19 @@ Holds the slp package format version of the slp file.
|
||||
|
||||
=over 4
|
||||
|
||||
=item checkfile
|
||||
|
||||
Detect slp files by their extention.
|
||||
|
||||
=cut
|
||||
|
||||
sub checkfile {
|
||||
my $this=shift;
|
||||
my $file=shift;
|
||||
|
||||
return $file =~ m/.*\.slp$/;
|
||||
}
|
||||
|
||||
=item install
|
||||
|
||||
Install a slp. Pass in the filename of the slp to install.
|
||||
|
||||
@@ -45,6 +45,19 @@ use constant
|
||||
|
||||
=over 4
|
||||
|
||||
=item checkfile
|
||||
|
||||
Detect tgz files by their extention.
|
||||
|
||||
=cut
|
||||
|
||||
sub checkfile {
|
||||
my $this=shift;
|
||||
my $file=shift;
|
||||
|
||||
return $file =~ m/.*\.(?:tgz|tar\.(?:gz|Z|z)|taz)$/;
|
||||
}
|
||||
|
||||
=item install
|
||||
|
||||
Install a tgz with installpkg. Pass in the filename of the tgz to install.
|
||||
@@ -171,14 +184,14 @@ sub prep {
|
||||
|
||||
my $install_made=0;
|
||||
foreach my $script (keys %{scriptrans()}) {
|
||||
my $data=$this->$script;
|
||||
my $data=$this->$script();
|
||||
next if ! defined $data || $data =~ m/^\s*$/;
|
||||
if (!$install_made) {
|
||||
mkdir $this->unpacked_tree."/install", 0755;
|
||||
$install_made=1;
|
||||
}
|
||||
open OUT (">".$this->unpacked_tree."/install/$script") ||
|
||||
die $this->unpacked_tree."/install/$script: $!"
|
||||
open (OUT, ">".$this->unpacked_tree."/install/$script") ||
|
||||
die $this->unpacked_tree."/install/$script: $!";
|
||||
print OUT $data;
|
||||
close OUT;
|
||||
chmod 0755, $this->unpacked_tree."/install/$script";
|
||||
|
||||
Reference in New Issue
Block a user