+sub flavour {
+ my $etc = '/etc';
+
+ if (@_) {
+ croak "do not pass a directory, it's for testing only"
+ unless $ENV{HARNESS_ACTIVE};
+ $etc = shift;
+ }
+
+ if (open(my $f, '-|', 'openssl version')) {
+ <$f> =~ /1.1.1/ && return "openssl_1_1_1";
+ }
+
+ if (open(my $f, '<', "$etc/os-release")) {
+ local $_ = join '', <$f>;
+ my ($id) = /^ID="?(.*?)"?\s*$/m;
+ my $version = /^VERSION_ID="?(.*?)"?\s*$/m ? $1 : '';
+ return "$id$version";
+ }
+
+ if (open(my $f, '<', "$etc/debian_version")) {
+ chomp(local $_ = <$f>);
+ $_ = int $_;
+ return "debian$_";
+ }
+
+ undef;
+}
+
+sub flavours {
+ my %h = map { /\.(\S+)$/, 1 }
+ grep { !/\.orig$/ } glob('stdout/*.*'), glob('stderr/*.*'), glob('log/*.*');
+ return sort keys %h;
+}