App-LXC-Container
view release on metacpan or search on metacpan
lib/App/LXC/Container/Data/common.pm view on Meta::CPAN
=cut
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
sub content_device_default($)
{
my $self = _check_singleton(shift);
my @output = ('# changes to ' . $self->{SYSTEM_COMMON} . ':',
'',
'# lxc.autodev = 1 # The default should be sufficient!',
'lxc.pty.max = 8',
'lxc.mount.auto = cgroup:ro proc:mixed sys:ro');
return @output
}
#########################################################################
=head2 B<content_default_filter> - return default filter
internal object-oriented implementation of the function
L<App::LXC::Container::Data::content_default_filter>
=cut
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
sub content_default_filter($)
{
use constant POSSIBLE_LINKS =>
qw(/bin /lib /lib32 /lib64 /libx32 /libx64 /sbin);
_check_singleton(shift);
my @head =
('# The filter contains paths that are always ignored (excluded) when',
'# considering mount-points derived from packages. But there are',
'# still some specials possible, the paths may be followed (after some',
'# white-spaces) by one of the following keywords:',
'# copy path (usually a symbolic link) is simply copied',
'# empty creates empty file or directory for path',
'# ignore path is completely ignored (never creates mount-point)',
'# nomerge sub-directories of this path are never merged into it',
'',
'# common:');
my @output =
('/boot ignore',
'/dev ignore',
'/home nomerge',
'/proc ignore',
'/sys ignore',
'/usr nomerge',
'/usr/games nomerge',
'/usr/include nomerge',
'/usr/lib nomerge',
'/usr/share nomerge',
'/usr/share/doc nomerge',
'/usr/share/dpkg ignore',
'/usr/share/info nomerge',
'/usr/share/lintian/overrides ignore',
'/usr/share/man ignore',
'/usr/share/misc/magic.mgc ignore',
'/usr/src nomerge',
'/var nomerge',
'/var/backups ignore',
'/var/cache nomerge',
# Note that /var/lib would break the start of a container due to
# /var/lib/lxc* behaving unexpectedly:
'/var/lib nomerge',
'/var/lib/dpkg ignore',
'/var/log empty',
'/var/spool nomerge');
local $_;
foreach (POSSIBLE_LINKS)
{ push @output, "$_\t\t\t\tcopy" if -l $_; }
return (@head, sort @output);
}
#########################################################################
=head2 B<content_default_mounts> - return default mount configuration
internal object-oriented implementation of the function
L<App::LXC::Container::Data::content_default_mounts>
=cut
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
sub content_default_mounts($)
{
_check_singleton(shift);
my @output =
('# Some notes to the list of default mounts (mounts that are needed in',
'# every application container):',
'#',
'# 1. Default mounts are read-only bind mounts.',
'# 2. Other mount options must be specified explicitly in field 2.',
'# 3. Special filesystems must be specified explicitly in field 3.',
'#',
'# In addition to directories (for mount-points) this list may also',
'# contain symbolic links, that are simply copied to the created',
'# configuration.',
'',
'# common:');
local $_;
foreach
('/bin',
'/dev/shm create=dir,rw tmpfs',
# the next 3 are needed by su:
'/etc/login.defs',
'/etc/pam.d',
'/etc/security',
'/lib',
'/root create=dir,rw,mode=700 tmpfs',
'/sbin',
# a shared and writable /tmp and extra unshared /usr/tmp and /var/tmp:
'/tmp create=dir,rw,bind',
'/usr/tmp create=dir,rw tmpfs',
'/var/tmp create=dir,rw tmpfs',
)
{
(my $entry = $_) =~ s/\s+.*//;
next if -l $entry;
next unless -d $entry or -f $entry;
push @output, abs_path($_);
( run in 0.935 second using v1.01-cache-2.11-cpan-c966e8aa7e8 )