Commit 50d13324 authored by intrigeri's avatar intrigeri
Browse files

Remove aufs-based IUK generation code & doc (refs: #17489)

parent d5786ad4
......@@ -25,8 +25,6 @@ my $bindir = path(__FILE__)->parent->parent->parent->parent->child('bin')->absol
use Env qw{@PATH};
unshift @PATH, $bindir;
my $union_type = $ENV{UNION_TYPE} // 'overlayfs';
Given qr{^a usable temporary directory$}, fun ($c) {
my $dirname = Path::Tiny->tempdir(CLEANUP => 0);
$c->{stash}->{scenario}->{tempdir} = $dirname;
......@@ -212,7 +210,6 @@ When qr{^I create an IUK$}, fun ($c) {
# that one needs to be root to create
"sudo SOURCE_DATE_EPOCH=$ENV{SOURCE_DATE_EPOCH} " .
path($bindir, "tails-create-iuk") .
' --union_type ' . $union_type .
' --old_iso "' .
path($c->{stash}->{scenario}->{tempdir}, 'old.iso') . '" ' .
' --new_iso "' .
......@@ -391,17 +388,11 @@ fun squashfs_in_iuk_deletes($iuk_in, $squashfs_name, $deleted_file) {
my $union_workdir = path($union_basedir, 'work');
my $union_mountpoint = path($union_basedir, 'mount');
$_->mkpath for ($union_workdir, $union_mountpoint);
my @mount_args = $union_type eq 'overlayfs'
? (
'-t', 'overlay',
'-o', sprintf("noatime,lowerdir=%s,upperdir=%s,workdir=%s",
$old_dir, $new_dir, $union_workdir),
'overlay'
)
: (
'-t', 'aufs',
'-o', sprintf("noatime,noxino,br=%s=rw:%s=rr+wh", $new_dir, $old_dir),
$new_dir
my @mount_args = (
'-t', 'overlay',
'-o', sprintf("noatime,lowerdir=%s,upperdir=%s,workdir=%s",
$old_dir, $new_dir, $union_workdir),
'overlay'
);
capturex(
......
......@@ -65,13 +65,6 @@ option 'outfile' =>
format => 's',
documentation => q{Location of the created IUK};
option 'union_type' =>
is => 'lazy',
isa => Enum[qw{aufs overlayfs}],
coerce => Enum->coercion,
format => 's',
documentation => q{aufs or overlayfs};
has 'format_version' =>
is => 'lazy',
isa => Str;
......@@ -248,7 +241,6 @@ method _build_mksquashfs_options () { [
qw{-no-progress -noappend},
qw{-comp xz -Xbcj x86 -b 1024K -Xdict-size 1024K},
]}
method _build_union_type () { "overlayfs"; }
method _build_delete_files () {
my $old_iso_obj = Device::Cdio::ISO9660::IFS->new(-source=>$self->old_iso->stringify);
......@@ -322,23 +314,16 @@ method create_squashfs_diff () {
croak "SquashFS '$new_squashfs' not found in '$new_iso_mount'" unless -e $new_squashfs;
run_as_root(qw{mount -t squashfs -o loop}, $new_squashfs, $new_squashfs_mount);
if ($self->union_type eq 'aufs') {
run_as_root(
qw{mount -t aufs},
"-o", sprintf("br=%s=rw:%s=ro", $union_upperdir, $old_squashfs_mount),
"none", $union_mount
);
} else {
run_as_root(
qw{mount -t overlay},
"-o", sprintf("lowerdir=%s,upperdir=%s,workdir=%s",
$old_squashfs_mount, $union_upperdir, $union_workdir),
"overlay", $union_mount
);
}
run_as_root(
qw{mount -t overlay},
"-o", sprintf("lowerdir=%s,upperdir=%s,workdir=%s",
$old_squashfs_mount, $union_upperdir, $union_workdir),
"overlay", $union_mount
);
my @rsync_options = qw{--archive --quiet --delete-after --acls --checksum
--xattrs};
my @rsync_options = qw{--archive --quiet --delete-after --acls --checksum};
push @rsync_options, "--xattrs" if $self->union_type eq 'overlayfs';
run_as_root(
"rsync", @rsync_options,
sprintf("%s/", $new_squashfs_mount),
......@@ -361,46 +346,40 @@ method create_squashfs_diff () {
} @candidates_for_removal;
}
if ($self->union_type eq 'aufs') {
run_as_root('auplink', $union_mount, 'flush');
}
run_as_root("umount", $union_mount);
# Remove trusted.overlay.* xattrs
if ($self->union_type eq 'overlayfs') {
my @xattrs_dump = stdout_as_root(
qw{getfattr --dump --recursive --no-dereference --absolute-names},
q{--match=^trusted\.overlay\.},
$union_upperdir->stringify,
);
my %xattrs;
my $current_filename;
foreach (@xattrs_dump) {
defined || last;
chomp;
if (! length($_)) {
$current_filename = undef;
next;
} elsif (my ($filename) = ($_ =~ m{\A [#] \s+ file: \s+ (.*) \z}xms)) {
$current_filename = $filename;
} elsif (my ($xattr, $value) = ($_ =~ m{\A(trusted[.]overlay[.][^=]+)=(.*)\z}xms)) {
push @{$xattrs{$xattr}}, $current_filename;
} else {
croak "Unrecognized line, aborting: '$_'";
}
}
while (my ($xattr, $files) = each %xattrs) {
my $stdin = join(chr(0), @$files);
my ($stdout, $stderr);
IPC::Run::run [
qw{sudo xargs --null --no-run-if-empty},
'setfattr', '--remove=' . $xattr,
'--no-dereference',
'--'
], \$stdin or croak "xargs failed: $?";
my @xattrs_dump = stdout_as_root(
qw{getfattr --dump --recursive --no-dereference --absolute-names},
q{--match=^trusted\.overlay\.},
$union_upperdir->stringify,
);
my %xattrs;
my $current_filename;
foreach (@xattrs_dump) {
defined || last;
chomp;
if (! length($_)) {
$current_filename = undef;
next;
} elsif (my ($filename) = ($_ =~ m{\A [#] \s+ file: \s+ (.*) \z}xms)) {
$current_filename = $filename;
} elsif (my ($xattr, $value) = ($_ =~ m{\A(trusted[.]overlay[.][^=]+)=(.*)\z}xms)) {
push @{$xattrs{$xattr}}, $current_filename;
} else {
croak "Unrecognized line, aborting: '$_'";
}
}
while (my ($xattr, $files) = each %xattrs) {
my $stdin = join(chr(0), @$files);
my ($stdout, $stderr);
IPC::Run::run [
qw{sudo xargs --null --no-run-if-empty},
'setfattr', '--remove=' . $xattr,
'--no-dereference',
'--'
], \$stdin or croak "xargs failed: $?";
}
run_as_root(
"SOURCE_DATE_EPOCH=$ENV{SOURCE_DATE_EPOCH}",
......
......@@ -7,8 +7,6 @@ use Path::Tiny;
use Tails::IUK;
use Test::Fatal qw{dies_ok};
my $union_type = $ENV{UNION_TYPE} // 'overlayfs';
my @genisoimage_opts = qw{--quiet -J -l -cache-inodes -allow-multidot};
my @genisoimage = ('genisoimage', @genisoimage_opts);
......@@ -57,7 +55,6 @@ describe 'An IUK object' => sub {
system(@genisoimage, "-o", $new_iso, $new_iso_tempdir);
$iuk = Tails::IUK->new(
union_type => $union_type,
old_iso => $old_iso,
new_iso => $new_iso,
squashfs_diff_name => 'test.squashfs',
......@@ -90,7 +87,6 @@ describe 'An IUK object' => sub {
system(@genisoimage, "-o", $new_iso, $new_iso_tempdir);
$iuk = Tails::IUK->new(
union_type => $union_type,
old_iso => $old_iso,
new_iso => $new_iso,
squashfs_diff_name => 'test.squashfs',
......@@ -116,7 +112,6 @@ describe 'An IUK object' => sub {
system(@genisoimage, "-o", $new_iso, $new_iso_tempdir);
$iuk = Tails::IUK->new(
union_type => $union_type,
old_iso => $old_iso,
new_iso => $new_iso,
squashfs_diff_name => 'test.squashfs',
......@@ -144,7 +139,6 @@ describe 'An IUK object' => sub {
system(@genisoimage, "-o", $new_iso, $new_iso_tempdir);
$iuk = Tails::IUK->new(
union_type => $union_type,
old_iso => $old_iso,
new_iso => $new_iso,
squashfs_diff_name => 'test.squashfs',
......
......@@ -57,19 +57,8 @@ conditions closer to production):
sudo true
umask 077
Run the upstream test suite with aufs:
Run the upstream test suite:
export UNION_TYPE=aufs
NODE_PATH="${TAILS_GIT_CHECKOUT}/submodules/mirror-pool-dispatcher/lib/js" \
PATH="${TAILS_GIT_CHECKOUT}/submodules/mirror-pool-dispatcher/bin:$PATH" \
PERL5LIB="${TAILS_GIT_CHECKOUT}/config/chroot_local-includes/usr/src/perl5lib/lib" \
RELEASE_TESTING=1 \
LC_ALL=C \
dzil test
… and with overlayfs:
export UNION_TYPE=overlayfs
NODE_PATH="${TAILS_GIT_CHECKOUT}/submodules/mirror-pool-dispatcher/lib/js" \
PATH="${TAILS_GIT_CHECKOUT}/submodules/mirror-pool-dispatcher/bin:$PATH" \
PERL5LIB="${TAILS_GIT_CHECKOUT}/config/chroot_local-includes/usr/src/perl5lib/lib" \
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment