Skip to content
Snippets Groups Projects
Commit 2a469628 authored by Simon McVittie's avatar Simon McVittie
Browse files

tests/manual/gl.pl: Bind-mount in some more host files


These are the same ones special-cased by Flatpak, although Flatpak
would generate a minimal /etc/passwd and /etc/group rather than using
the ones from the host system.

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent 5318d2ed
No related branches found
No related tags found
1 merge request!311Build capsule-capture-libs from a bundled copy of libcapsule
...@@ -885,8 +885,13 @@ foreach my $mutable (qw(/etc /var)) { ...@@ -885,8 +885,13 @@ foreach my $mutable (qw(/etc /var)) {
while (defined(my $member = readdir $dir)) { while (defined(my $member = readdir $dir)) {
next if $member eq '.' || $member eq '..'; next if $member eq '.' || $member eq '..';
next if "$mutable/$member" eq '/etc/group';
next if "$mutable/$member" eq '/etc/host.conf';
next if "$mutable/$member" eq '/etc/hosts';
next if "$mutable/$member" eq '/etc/localtime';
next if "$mutable/$member" eq '/etc/machine-id'; next if "$mutable/$member" eq '/etc/machine-id';
next if "$mutable/$member" eq '/etc/passwd'; next if "$mutable/$member" eq '/etc/passwd';
next if "$mutable/$member" eq '/etc/resolv.conf';
no autodie 'readlink'; no autodie 'readlink';
my $target = readlink "$container_tree$mutable/$member"; my $target = readlink "$container_tree$mutable/$member";
...@@ -912,7 +917,23 @@ elsif (-e '/var/lib/dbus/machine-id') { ...@@ -912,7 +917,23 @@ elsif (-e '/var/lib/dbus/machine-id') {
push @bwrap, '--symlink', '/etc/machine-id', '/var/lib/dbus/machine-id'; push @bwrap, '--symlink', '/etc/machine-id', '/var/lib/dbus/machine-id';
} }
push @bwrap, '--ro-bind', '/etc/passwd', '/etc/passwd'; if (-e '/etc/localtime') {
no autodie 'readlink';
my $target = readlink '/etc/localtime';
if (defined $target && $target =~ m{^/usr/}) {
push @bwrap, '--symlink', $target, '/etc/localtime';
}
else {
push @bwrap, '--ro-bind', '/etc/localtime', '/etc/localtime';
}
}
foreach my $file (qw(resolv.conf host.conf hosts passwd group)) {
if (-e "/etc/$file") {
push @bwrap, '--ro-bind', "/etc/$file", "/etc/$file";
}
}
push @bwrap, bind_usr($container_tree); push @bwrap, bind_usr($container_tree);
push @bwrap, bind_usr($gl_provider_tree, '/gl-provider'); push @bwrap, bind_usr($gl_provider_tree, '/gl-provider');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment