Index of /~too/sw/tarlisted
tarlisted 3.2 -- added support to xz compression.
tarlisted(1) User Commands tarlisted(1)
NAME
tarlisted - Create tar archive based on description list contents
SYNOPSIS
tarlisted [-nVhzj] [-C dir] [-i infile] [(-o|-a) outfile] [| ppcmd
[args]]
DESCRIPTION
Tarlisted takes lines of text as an input and creates tar archive based
on that information.
Each line contains permission, user, group and pathname that are to be
written in header part of the tar entry. In addition to that, at the
end of line the syntax varies depending the file type archived. For
example in case of reqular files the filename where file content is
read is added. Tarlisted creates POSIX.1-1998 tar file format (only)
and can archive all the (seven) file types it supports.
OPTIONS
-n Just check tarlist contents, not doing anything else
-V Verbose output. -VV: output to both stdout and stderr
-C Change to directory for input -- does not affect output
-i Defines input file, instead of stdin
-o Defines output file, instead of stdout. Required if '|' not used.
Giving - will use stdout anyway (if there is need for it)
-a Appends to output file. No compression nor postprosessing appicable
-z Compresses archive with gzip. Mutually exclusive with -j, -J and
'|'
-J Compresses archive with xz. Mutually exclusive with -z, -j and '|'
-j Compresses archive with bzip2. Mutually exclusive with -z, -J and
'|'
-O Comma-separated list of keywords for 'only' lines. See below
-h help
| ppcmd [args]
Internal piping to postprocess command. Archive output will be sent
to this program for further use. Also, if postprocess command
returns nonzero value, tarlisted will exit with value 1
SYNTAX
Files and directories to be archived are read from input file, each
line in one of the formats:
<perm> <uname> <gname> . <tarfilename> <sysfilename>
<perm> <uname> <gname> . <tarfilename> /
--- <uname> <gname> . <tarfilename> -> <symlink>
=== <uname> <gname> . <tarfilename> => <hardlink>
<perm> <uname> <gname> . <tarfilename> // c <devmajor> <devminor>
<perm> <uname> <gname> . <tarfilename> // b <devmajor> <devminor>
<perm> <uname> <gname> . <tarfilename> // fifo
Where:
perm: file permission in octal number format.
uname: name of the user this file is owned.
gname: name of the group this file belongs.
.: future extension for time...
tarfilename: name of the file that is written to the tar archive.
sysfilename: file to be added from filesystem.
/: add directory to the tar archive.
->: add tarfilename as symbolic link to given name.
=>: add tarfilename as hard link to given name.
// c ...: add character device to the tar archive.
// b ...: add block device to the tar archive.
// fifo: add fifo (named pipe) file to the tar archive.
Backspace "\" must be used when adding [back]spaces to filenames.
Input file may also have lines
tarlisted file format 3
tarlisted file end
The first one can be used to request strict format check. The second is
added for symmetry.
And also:
only <keyword1>[ <keyword2>[ <keyword3>]]
all
These are used for conditional selection of input. If none of the -O
command line strings match for any of the keywords after only above,
the following lines will be excluded, until there is matching only-
line, or all-line. All resets to include all following lines.
Output format is POSIX Unix Standard TAR (ustar, IEEE Std 1003.1-1988)
EXIT VALUE
tarlisted exits with 0 if everything goes ok. On failure it might exit
with nonzero value.
EXAMPLES
First, just one that shows all supported file types.
$ ./tarlisted -o test.tar << EOF
tarlisted file format 3
755 root root . /usr/bin/tarlisted ./tarlisted
700 too too . /tmp/path/to/nowhr /
--- unski unski . /one\ symlink -> /where/ever
=== wheel wheel . /one\ hrdlink => /bin/echo
666 root root . /dev/zero // c 1 5
640 root disk . /dev/loop0 // b 7 0
600 root root . /dev/initctl // fifo
tarlisted file end
EOF
The above created test.tar with content:
$ tar tvf test.tar
-rwxr-xr-x root/root 12453 2006-04-25 00:41:48 usr/bin/tarlisted
drwx------ too/too 0 2006-04-25 00:42:53 tmp/path/to/nowhr
lrwxrwxrwx unski/unski 0 2006-04-25 00:42:53 one symlink -> /where/ever
hrwxrwxrwx wheel/wheel 0 2006-04-25 00:42:53 one hrdlink link to /bin/echo
crw-rw-rw- root/root 1,5 2006-04-25 00:42:53 dev/zero
brw-r----- root/disk 7,0 2006-04-25 00:42:53 dev/loop0
prw------- root/root 0 2006-04-25 00:42:53 dev/initctl
Another to install perl4 (compiled from 4.0.36) (using installed tarlisted).
$ PREFIX=/usr
$ tarlisted '|' tar -C $PREFIX -xvf - << EOF
755 root root . bin/perl4 src/perl
644 root root . man/man1/perl4.1 src/perl.man
EOF
or, the above with same result:
$ PREFIX=/usr
$ tarlisted '|' tar -C / -xvf - << EOF
755 root root . $PREFIX/bin/perl4 src/perl
644 root root . $PREFIX/man/man1/perl4.1 src/perl.man
EOF
Finally, compress on the fly with xz
$ echo 755 root root . /usr/bin/tarlisted tarlisted | ./tarlisted -o tl.tar.xz '|' xz -c
Same with tarlisted 3.2 (or newer)
$ echo 755 root root . /usr/bin/tarlisted tarlisted | ./tarlisted -Jo tl.tar.xz
CAVEAT
Remember to escape | from shell when using the internal pipeline fea-
ture of tarlisted. There are three ways to enter that on the command
line: '|', "|" and \|. Now there is less chance for that since -o is
seldom used in this case -- tarlisted will not work without -o now if
'|' is not used.
TODO
Add features from latest POSIX tar specifications to support long file-
names when necessary.
Plan and implement "modification time" setting.
AUTHOR
Tomi Ollila
COPYRIGHT
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
4. The names of the authors may not be used to endorse or promote
products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
SEE ALSO
tar(1), star(1), tar(5)
tarlisted 3.2 Sep 25, 2012 tarlisted(1)