I want to solve a problem (which you can read about here as I don't feel like this should be part of the question).
So this is what I came up with:
$ tar -cO Templates | 7z a -si -mx=3 -p /t/out.tar.7z
I'm using the Templates
folder on my computer so I can test it on a very small amount of data first.
And it works just as expected.
However, when I want to create a checksum of it, it fails:
$ tar -cO Templates | 7z a -si -so -mx=3 -p | tee /t/out.tar.7z | sha256sum
7-Zip [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,8 CPUs)
Error:
Incorrect command line
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 -
I noticed that when I execute what's in the first block of code, the tar ball inside the 7zip archive is called out.tar
. In fact, that's why I let it end in .tar.7z
: So the tar ball's name ends in .tar
.
So maybe I should still include the file name, especially because the entire synopsis of the 7z
command in its man page is:
7z [adeltux] [-] [SWITCH] <ARCHIVE_NAME> <ARGUMENTS>...
Unfortunately, this doesn't work either:
$ tar -cO Templates | 7z a -si -so -mx=3 -p out.tar.7z | tee /t/out.tar.7z | sha256sum
7-Zip [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,8 CPUs)
Creating archive stdout
Enter password (will not be echoed) :
Verify password (will not be echoed) :
System error:
E_NOTIMPL
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 -
It doesn't even work if I explicitly state the archive type:
$ tar -cO Templates | 7z a -si -so -mx=3 -p -t7z | tee /t/out.tar.7z | sha256sum
7-Zip [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,8 CPUs)
Error:
Incorrect command line
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 -
$ tar -cO Templates | 7z a -si -so -mx=3 -p -t7z out.tar.7z | tee /t/out.tar.7z | sha256sum
7-Zip [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,8 CPUs)
Creating archive stdout
Enter password (will not be echoed) :
Verify password (will not be echoed) :
System error:
E_NOTIMPL
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 -
How do I solve this? Writing the data to its destination and then hashing that file is not an option. I need the data to be encrypted.
-so
switch:Write data to StdOut (eg: % echo foo | 7z a dummy -tgzip -si -so > /dev/null)
What else is it going to write to stdout if not the archive. Regarding your proposal: Doesn't work for me. I specifically mentioned this in the last sentence of my question./t/out.tar.7z
file that you could hashsum, but you later say that you don't want to write the file for later hashing.