I am trying to add a file to a tar archive from a program output without generating it on disk first. Think of a file VERSION
, that is autogenerated, when the build script runs. I tried this but the dereferenced symlink is only a named pipe, not a regular file:
$ date +%s | \
tar cf test.tar \
--dereference \
--transform="s#/proc/self/fd/0#VERSION#" \
/proc/self/fd/0 \
other_files \
and_folders/
The result should be a file VERSION
with a timestamp inside the tar archive w/o locally generating a file:
$ tar tf test.tar
VERSION
other_files
and_folders