mirror of
https://github.com/webmin/webmin.git
synced 2026-05-04 22:30:33 +01:00
Added package_files function
This commit is contained in:
@@ -25,3 +25,4 @@ Added detection of epochs for RPMs and packages from YUM.
|
||||
Added an Upgrade All button for CSW packages.
|
||||
---- Changes since 1.440 ----
|
||||
Added a Module Config option to not use any update system, even if YUM or APT are installed.
|
||||
Added the function package_files for other modules to call, when only a list of files in some package is needed.
|
||||
|
||||
@@ -90,6 +90,22 @@ while($file = <PKGINFO>) {
|
||||
return $i;
|
||||
}
|
||||
|
||||
# package_files(package)
|
||||
# Returns a list of all files in some package
|
||||
sub package_files
|
||||
{
|
||||
local ($pkg) = @_;
|
||||
local $qn = quotemeta($pkg);
|
||||
local @rv;
|
||||
&open_execute_command(RPM, "dpkg --listfiles $qn", 1, 1);
|
||||
while(<RPM>) {
|
||||
s/\r|\n//g;
|
||||
push(@rv, $_);
|
||||
}
|
||||
close(RPM);
|
||||
return @rv;
|
||||
}
|
||||
|
||||
# installed_file(file)
|
||||
# Given a filename, fills %file with details of the given file and returns 1.
|
||||
# If the file is not known to the package system, returns 0
|
||||
|
||||
@@ -70,6 +70,24 @@ while($file = <PKGINFO>) {
|
||||
return $i;
|
||||
}
|
||||
|
||||
# package_files(package)
|
||||
# Returns a list of all files in some package
|
||||
sub package_files
|
||||
{
|
||||
local ($pkg) = @_;
|
||||
local $qn = quotemeta($pkg);
|
||||
local @rv;
|
||||
&open_execute_command(RPM, "pkg_info -L $qn", 1, 1);
|
||||
while(<RPM>) {
|
||||
s/\r|\n//g;
|
||||
if (/^\//) {
|
||||
push(@rv, $_);
|
||||
}
|
||||
}
|
||||
close(RPM);
|
||||
return @rv;
|
||||
}
|
||||
|
||||
# installed_file(file)
|
||||
# Given a filename, fills %file with details of the given file and returns 1.
|
||||
# If the file is not known to the package system, returns 0
|
||||
|
||||
@@ -285,6 +285,22 @@ close(RPM);
|
||||
return $i;
|
||||
}
|
||||
|
||||
# package_files(package, [version])
|
||||
# Returns a list of all files in some package
|
||||
sub package_files
|
||||
{
|
||||
local ($pkg, $version) = @_;
|
||||
local $qn = quotemeta($version ? "$pkg-$version" : $pkg);
|
||||
local @rv;
|
||||
&open_execute_command(RPM, "rpm -q -l $qn", 1, 1);
|
||||
while(<RPM>) {
|
||||
s/\r|\n//g;
|
||||
push(@rv, $_);
|
||||
}
|
||||
close(RPM);
|
||||
return @rv;
|
||||
}
|
||||
|
||||
# installed_file(file)
|
||||
# Given a filename, fills %file with details of the given file and returns 1.
|
||||
# If the file is not known to the package system, returns 0
|
||||
|
||||
@@ -120,6 +120,26 @@ while($file = <PKG>) {
|
||||
return $i;
|
||||
}
|
||||
|
||||
# package_files(package)
|
||||
# Returns a list of all files in some package
|
||||
sub package_files
|
||||
{
|
||||
local ($pkg) = @_;
|
||||
local @rv;
|
||||
&open_readfile(PKG, "$package_dir/$_[0]");
|
||||
while(<PKG>) {
|
||||
last if (/^FILE LIST:/i);
|
||||
}
|
||||
while(my $file = <PKG>) {
|
||||
$file =~ s/\r|\n//g;
|
||||
next if ($file eq "./");
|
||||
$file = '/'.$file;
|
||||
push(@rv, $file);
|
||||
}
|
||||
close(PKG);
|
||||
return @rv;
|
||||
}
|
||||
|
||||
# installed_file(file)
|
||||
# Given a filename, fills %file with details of the given file and returns 1.
|
||||
# If the file is not known to the package system, returns 0
|
||||
|
||||
Reference in New Issue
Block a user