App-LXC-Container
view release on metacpan or search on metacpan
lib/App/LXC/Container/Data/common.pm view on Meta::CPAN
'',
'# network:',
'/etc/ssl/certs',
'/usr/lib/ssl',
'/usr/share/ca-certificates',
'/usr/share/ssl-cert');
return @output
}
#########################################################################
=head2 B<content_network_packages> - return mount configuration for NETWORK
internal object-oriented implementation of the function
L<App::LXC::Container::Data::content_network_packages>
=cut
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
sub content_network_packages($)
{
_check_singleton(shift);
my @output =
('# This is an additional packages needed for network access.',
'# See 30-PKG-default.packages for more explanations.');
local $_;
foreach (qw(ip))
{
my $exec = App::LXC::Container::Data::find_executable($_);
if ($exec)
{
my $pkg = App::LXC::Container::Data::package_of($exec);
push @output, $pkg if $pkg;
}
}
return @output;
}
#########################################################################
=head2 B<content_x11_mounts> - return mount configuration for X11
internal object-oriented implementation of the function
L<App::LXC::Container::Data::content_x11_mounts>
=cut
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
sub content_x11_mounts($)
{
_check_singleton(shift);
my @output =
('# This is an additional mount configuration file for X11 applications.',
'# See 40-MNT-default.mounts for more explanations.',
'',
'# common:',
'/dev/dri create=dir,rw,bind,optional',
'/usr/share/icons',
'/usr/share/mime',
'/usr/share/pixmaps',
'/var/cache/fontconfig',
'/var/lib/dbus');
return @output
}
#########################################################################
=head2 B<content_x11_packages> - return package configuration for X11
internal object-oriented implementation of the function
L<App::LXC::Container::Data::content_x11_packages>
=cut
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
sub content_x11_packages($)
{
_check_singleton(shift);
my @output =
('# list of mandatory packages needed for X11',
'# See 30-PKG-default.packages for more explanations.',
'fontconfig-config');
return @output;
}
#########################################################################
=head2 depends_on - find package of file
internal object-oriented implementation of the function
L<App::LXC::Container::Data::depends_on>
=cut
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
sub depends_on($$$)
{
my $self = _check_singleton(shift);
}
#########################################################################
=head2 libraries_used - find package of executable
internal object-oriented implementation of the function
L<App::LXC::Container::Data::libraries_used>
=cut
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
sub libraries_used($$)
{
_check_singleton(shift);
my ($executable) = @_;
-f $executable or fatal 'internal_error__1', 'not a file: ' . $executable;
# 1st check for non-standard interpreter to avoid security issues (see
# man-page of ldd under "Security"):
open my $file, '-|', 'file', $executable; # Note that file never fails!
my $info = join("\n", <$file>);
close $file;
my @libraries = ();
unless ($info =~
m|^$executable:\s.*\sinterpreter\s[a-z/0-9]+\bld-linux[-a-z0-9]*\.so|
or
$info =~ m|^$executable:\s.*\sLSB shared object,|)
{
error('bad_ldd_interpreter__1', $executable);
return @libraries;
}
# now call ldd:
open my $ldd, '-|', 'ldd', $executable; # doesn't fail in a useful way
local $_;
while (<$ldd>)
{
next unless s/\s+\(0x[0-9a-f]+\)\r?\n?$//;
s/^.+\s=>\s//;
s/^\s+//;
next unless m|^/|;
$_ = abs_path($_);
push @libraries, $_ if $_;
( run in 2.009 seconds using v1.01-cache-2.11-cpan-97f6503c9c8 )