1 diff -ur busybox/archival/Config.in busybox/archival/Config.in
2 --- busybox/archival/Config.in Sun May 23 09:15:37 2004
3 +++ busybox/archival/Config.in Sun May 23 09:15:58 2004
6 Converts an RPM file into a CPIO archive.
8 +config CONFIG_FEATURE_RPM2CPIO_BZIP2
9 + bool " Support bzip2 decompression"
11 + depends on CONFIG_RPM2CPIO
13 + If you enable this option you'll be able to extract
14 + rpms compressed with bzip2.
19 diff -ur busybox/archival/libunarchive/Makefile.in busybox/archival/libunarchive/Makefile.in
20 --- busybox/archival/libunarchive/Makefile.in Sun May 23 09:15:04 2004
21 +++ busybox/archival/libunarchive/Makefile.in Sun May 23 09:16:42 2004
23 LIBUNARCHIVE-$(CONFIG_GUNZIP) += $(GUNZIP_FILES)
24 LIBUNARCHIVE-$(CONFIG_FEATURE_GUNZIP_UNCOMPRESS) += decompress_uncompress.o
25 LIBUNARCHIVE-$(CONFIG_RPM2CPIO) += $(GUNZIP_FILES) get_header_cpio.o
26 +LIBUNARCHIVE-$(CONFIG_FEATURE_RPM2CPIO_BZIP2) += decompress_bunzip2.o
27 LIBUNARCHIVE-$(CONFIG_RPM) += $(GUNZIP_FILES) get_header_cpio.o
28 LIBUNARCHIVE-$(CONFIG_TAR) += get_header_tar.o
29 LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_BZIP2) += decompress_bunzip2.o get_header_tar_bz2.o
30 diff -ur busybox/archival/rpm2cpio.c busybox/archival/rpm2cpio.c
31 --- busybox/archival/rpm2cpio.c Sun May 23 09:15:04 2004
32 +++ busybox/archival/rpm2cpio.c Sun May 23 09:19:03 2004
36 bb_xread_all(rpm_fd, &magic, 2);
37 - if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) {
38 - bb_error_msg_and_die("Invalid gzip magic");
39 + if ((magic[0] == 0x1f) || (magic[1] == 0x8b)) {
40 + check_header_gzip(rpm_fd);
41 + if (inflate_gunzip(rpm_fd, fileno(stdout)) != 0)
42 + bb_error_msg("Error inflating (gzip)");
45 - check_header_gzip(rpm_fd);
46 - if (inflate_gunzip(rpm_fd, STDOUT_FILENO) != 0) {
47 - bb_error_msg("Error inflating");
48 + if ((magic[0] == 'B') && (magic[1] == 'Z')) {
49 +#ifdef CONFIG_FEATURE_RPM2CPIO_BZIP2
50 + /* return to position before magic (eek..!) */
51 + lseek(rpm_fd, -2, SEEK_CUR);
52 + if(uncompressStream(rpm_fd, fileno(stdout)) != 0)
53 + bb_error_msg("Error inflating (bzip2)");
55 + bb_error_msg_and_die("bzip2 not supported");
60 + bb_error_msg_and_die("not gzip or bzip2 compressed");