基本的に2つの方法があります:
この方法なら何も設定しなくてすみます。bzip2したtarアーカイブfoo.tar.bz2を un-tarするにはカレントディレクトリで、
/path/to/bzip2 -cd foo.tar.bz2 | tar xf -
とします。
これで動作しますが、いちいち入力するのは面倒(PITA)です。
以下のパッチをGNU tar 1.12を当ててコンパイル/インストールして下さい。
これでよいです。tarとbzip2が("which tar"、"which bzip2"と実行して)
$PATHにあるかどうか確認しておきます。ファイルを展開するには
tar xyf foo.tar.bz2
とします。
新しいアーカイブを作る時も同じようにして
tar cyf foo.tar.bz2 file1 file2 file3...directory1 directory2...
とします。
以下はパッチです :)
(訳注:patch -p1 < tar.c.diffとしてあてて下さい)
*** tar.c.orig Sat Feb 28 14:55:45 1998
--- tar.c Sat Feb 28 15:01:54 1998
***************
*** 16,21 ****
--- 16,24 ----
with this program; if not, write to the Free Software Foundation, Inc.,
59 Place - Suite 330, Boston, MA 02111-1307, USA. */
+ /* Feb 2 98: patched by David Fetter to use bzip2 as a
+ filter (option -y) */
+
#include "system.h"
#include <getopt.h>
***************
*** 196,201 ****
--- 199,206 ----
{"block-number", no_argument, NULL, 'R'},
{"block-size", required_argument, NULL, OBSOLETE_BLOCKING_FACTOR},
{"blocking-factor", required_argument, NULL, 'b'},
+ {"bzip2", required_argument, NULL, 'y'},
+ {"bunzip2", required_argument, NULL, 'y'},
{"catenate", no_argument, NULL, 'A'},
{"checkpoint", no_argument, &checkpoint_option, 1},
{"compare", no_argument, NULL, 'd'},
***************
*** 372,377 ****
--- 377,383 ----
PATTERN at list/extract time, a globbing PATTERN\
n\
-o, --old-archive, --portability write a V7 format archive\n\
--posix write a POSIX conformant archive\n\
+ -y, --bzip2, --bunzip2 filter the archive through bzip2\n\
-z, --gzip, --ungzip filter the archive through gzip\n\
-Z, --compress, --uncompress filter the archive through compress\n\
--use-compress-program=PROG filter through PROG (must accept -d)\n"),
***************
*** 448,455 ****
Y per-block gzip compression */
#define OPTION_STRING \
! "-01234567ABC:F:GK:L:MN:OPRST:UV:WX:Zb:cdf:g:hiklmoprstuvwxz"
!
static void
set_subcommand_option (enum subcommand subcommand)
{
--- 454,460 ----
Y per-block gzip compression */
#define OPTION_STRING \
! "-01234567ABC:F:GK:L:MN:OPRST:UV:WX:Zb:cdf:g:hiklmoprstuvwxyz"
static void
set_subcommand_option (enum subcommand subcommand)
{
***************
*** 806,811 ****
--- 811,820 ----
exclude_option = 1;
add_exclude_file (optarg);
break;
+
+ case 'y':
+ set_use_compress_program_option ("bzip2");
+ break;
case 'z':
set_use_compress_program_option ("gzip");