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

tests/manual/gl.pl: Bind-mount members of /etc, /var individually


This is what Flatpak does. It means those directories remain
read/write, so we can create new top-level items in them.

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent 9984e841
No related branches found
No related tags found
1 merge request!311Build capsule-capture-libs from a bundled copy of libcapsule
......@@ -829,16 +829,33 @@ my @bwrap = qw(
);
push @bwrap, '--dir', $ENV{HOME};
if (-d "$container_tree/etc") {
push @bwrap, '--ro-bind', "$container_tree/etc", '/etc';
}
push @bwrap, '--tmpfs', '/tmp';
push @bwrap, '--tmpfs', '/var/tmp';
foreach my $mutable (qw(/etc /var)) {
if (-d "$container_tree$mutable") {
opendir(my $dir, "$container_tree$mutable");
while (defined(my $member = readdir $dir)) {
next if $member eq '.' || $member eq '..';
next if "$mutable/$member" eq '/etc/machine-id';
next if "$mutable/$member" eq '/etc/passwd';
no autodie 'readlink';
my $target = readlink "$container_tree$mutable/$member";
if (defined $target) {
push @bwrap, '--symlink', "$target", "$mutable/$member";
}
else {
push @bwrap, '--ro-bind', "$container_tree$mutable/$member", "$mutable/$member";
}
}
if (-d "$container_tree/var") {
push @bwrap, '--ro-bind', "$container_tree/var", '/var';
closedir($dir);
}
}
push @bwrap, '--tmpfs', '/tmp';
push @bwrap, '--tmpfs', '/var/tmp';
push @bwrap, '--ro-bind', '/etc/machine-id', '/etc/machine-id';
push @bwrap, '--ro-bind', '/etc/passwd', '/etc/passwd';
push @bwrap, '--bind', '/tmp/.X11-unix', '/tmp/.X11-unix';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment