Next Previous Contents

4. °t¦X tar¨Ó¨Ï¥Î bzip2

¤U­±¦³¤TºØ°t¦X tar ¨Ï¥Î bzip2 ªº¤èªk¡A¤]´N¬O

4.1 ®e©ö³]¥ß:

³o­Ó¤èªk¸ò¥»´N¤£¥²°µ³]©w¡C°õ¦æ¸Ñ¶}bzip2'd ªº tar¥]»q¡A ¦b²{¦æ¥Ø¿ý©³¤U¦³­Ó foo.tar.bz2¡A°õ¦æ

/path/to/bzip2 -cd foo.tar.bz2 | tar xf -

¦¨¥\¤F¡A¦ý¥i¯à¦³±`»Ý¿é¤Jªº¤p¯ÊÂI¡C

4.2 ®e©ö³]¥ß¡A®e©ö¨Ï¥Î¡A¤£»Ý­n root ªº¯SÅv:

·PÁ Leonard Jean-Marc °^Äm³o­Ó¤p§Þ¥©¡C¤]ÁÂÁ Alessandro Rubini ±q cshùؤÀÃþ ¥X bash ªº¡C

¦b§Aªº .bashrcùØ¡A§A¥i¥H¥[¤J¹³¤U­±³o¦æ:

alias btar='tar --use-compress-program /usr/local/bin/bzip2 '

¦b§Aªº .tcshrc ©Î .cshrcùØ¡A¥i¥Î¤U­±³o¦æ¬Û¦Pªº:

alias btar 'tar --use-compress-program /usr/local/bin/bzip2'

4.3 ¦P¼Ë¬O®e©ö¨Ï¥Î¡A¦ý»Ý­n root ¨Ó¦s¨ú¡C

¥Î¤U­±¨Ó¤èªk¨Ó­×¸É gnu tar 1.12¡G

cd tar-1.12/src; patch < /path/to/tar.diff
½sĶ¡B¦w¸Ë¥¦¡A§A¤w·Ç³Æ´Nºü¤F¡C¥Î"which tar" ©M "which bzip2"¨Ó½T»{³o¨â­Ó tar ©M bzip2 ¦³¦b§Aªº $PATH ùØ¡C­n¨Ï¥Î·sªº tar¡A¥u»Ý
 tar xyf foo.tar.bz2
¨ÓÀ£ÁYÀɮסC

­n»s§@·sªºÀ£ÁYÀÉ¡A¦P¼Ë¦a:

 tar cyf foo.tar.bz2 ÀɦW1 ÀɦW2 ÀɦW3...¥Ø¿ý1 ¥Ø¿ý2...

¤U­±¬O­×¸Éªº¦a¤è:

*** tar.c       Thu Jun 11 00:09:23 1998
--- tar.c.new   Thu Jun 11 00:14:24 1998
***************
*** 196,201 ****
--- 196,203 ----
    {"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 ****
--- 374,380 ----
                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,454 ****
     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)
--- 451,457 ----
     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)
***************
*** 805,810 ****
--- 808,817 ----
        case 'X':
        exclude_option = 1;
        add_exclude_file (optarg);
+       break;
+
+       case 'y':
+       set_use_compress_program_option ("bzip2");
        break;

        case 'z':


Next Previous Contents