On Thu, 2022-06-09 at 19:57 +0200, Marc Haber wrote: > > I'd recommend the following: > > - invoke tar --create --auto-compress --file /tmp/foo.tar.suffix > --directory / usr/sbin/deluser > - if exit code 127 (compressor known, but not installed): > - print diagnostic > - set suffix to ".gz" (gzip is essential and guaranteed to exist) > - if exit code != 127 > - invoke tar --create --file /tmp/foo.tar > --directory / usr/sbin/deluser > - check whether foo.tar and foo.tar.sufffix are identical (that > happens when the tar file suffix does not match a known > compressor) > - if identical (unknown compressor given) > - print diagnostic > - set suffix to ".gz"
This sounds good to me. You could use something like 'file', but that isn't essential iirc, and anyway this tests actual functionality. I'm happy to implement this in a new branch. (TIL: the reverse of --auto-compress is on by default; 'tar [tx]f' will automatically determine the right algorithm.) Matt