Search code examples
compressiontarfreebsd

How to install Tresorit on Freebsd to use Linux compat


Edited to make more appropriate for StackOverflow:

I have a binary shell script that acts as a self extractor for a tarball. It was originally targeted for Linux but I am trying to run it on FreeBSD. The main line giving me fits is:

tail -n$SKIP "$0" | tar xz -C /path/to/install

I had an error regarding "can't open /dev/sda0" which I resolved by changing the tar command to xzf - to force it to read from stdin. However, it now complains about an "unrecognized archive format" which indicates it can't determine the compression format of the binary tarball.

What techniques can I use to examine that header and figure out how to decompress this binary blob? Does tail -n work differently between BSD and Linux?

Original question: I'm trying to install the linux installer for Tresorit (https://tresorit.com/download/linux) on my FBSD13 box. It's a binary sh script where the first 92 lines are shell and the remainder is a compressed tarball of some kind. First, I had to put a uname of my own creation first in path because it was checking for uname -m to be x86_64 or i686. FBSD returns amd64. Changing the script renders it useless since it checks its own signature. Anyway, that was easy to bypass. Next it complained about not being able to open "/dev/sda0" when reading the tarball from stdin. That was also easy to "fix" by specifying "-f -" to force it to read from stdin.

I have been trying to execute the install line. It's this:

tail -n92 tresorit_installer.run | tar xzf -

Now it complains that "tar: Error opening archive: Unrecognized archive format". This is frustrating. It has to be gzip/bzip/xz or something similar. How can I determine the compression format and get to the next step?

I'm fairly certain that if I can decompress it, then I can install the program and get FBSD linux compat to work. Any suggestions on what to do next?


Solution

  • -n92 (or -92, since -n is the default) gives you the last 92 lines of the file. In order to start at line 93 (skipping the first 92 lines), you need a plus sign: -n+93.

    This is the same on Linux and BSD.