enable .tar.bz2 for dpkg-deb
This commit is contained in:
parent
8e94098423
commit
18bbca18ac
@ -15,7 +15,12 @@ bool 'cpio' CONFIG_CPIO
|
|||||||
bool 'dpkg' CONFIG_DPKG
|
bool 'dpkg' CONFIG_DPKG
|
||||||
bool 'dpkg_deb' CONFIG_DPKG_DEB
|
bool 'dpkg_deb' CONFIG_DPKG_DEB
|
||||||
if [ "$CONFIG_DPKG_DEB" = "y" ] ; then
|
if [ "$CONFIG_DPKG_DEB" = "y" ] ; then
|
||||||
bool ' -x support only' CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
|
bool ' extract only (-x)' CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
|
||||||
|
fi
|
||||||
|
if [ "$CONFIG_DPKG" = "y" ] || [ "$CONFIG_DPKG_DEB" = "y" ] ; then
|
||||||
|
comment 'Common dpkg/dpkg-deb options'
|
||||||
|
bool ' gzip debian packages (normal)' CONFIG_FEATURE_DEB_TAR_GZ
|
||||||
|
bool ' bzip2 debian packages' CONFIG_FEATURE_DEB_TAR_BZ2
|
||||||
fi
|
fi
|
||||||
bool 'gunzip' CONFIG_GUNZIP
|
bool 'gunzip' CONFIG_GUNZIP
|
||||||
if [ "$CONFIG_GUNZIP" = "y" ]; then
|
if [ "$CONFIG_GUNZIP" = "y" ]; then
|
||||||
|
@ -24,10 +24,10 @@
|
|||||||
extern int dpkg_deb_main(int argc, char **argv)
|
extern int dpkg_deb_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
archive_handle_t *ar_archive;
|
archive_handle_t *ar_archive;
|
||||||
archive_handle_t *tar_gz_archive;
|
archive_handle_t *tar_archive;
|
||||||
int opt = 0;
|
int opt = 0;
|
||||||
#ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
|
#ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
|
||||||
const llist_t *control_tar_gz_llist = add_to_list(NULL, "control.tar.gz");
|
const llist_t *control_tar_llist = NULL;
|
||||||
#endif
|
#endif
|
||||||
#ifndef CONFIG_AR
|
#ifndef CONFIG_AR
|
||||||
char magic[7];
|
char magic[7];
|
||||||
@ -38,14 +38,26 @@ extern int dpkg_deb_main(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Setup the tar archive handle */
|
/* Setup the tar archive handle */
|
||||||
tar_gz_archive = init_handle();
|
tar_archive = init_handle();
|
||||||
|
|
||||||
/* Setup an ar archive handle that refers to the gzip sub archive */
|
/* Setup an ar archive handle that refers to the gzip sub archive */
|
||||||
ar_archive = init_handle();
|
ar_archive = init_handle();
|
||||||
ar_archive->action_data_subarchive = get_header_tar_gz;
|
ar_archive->sub_archive = tar_archive;
|
||||||
ar_archive->sub_archive = tar_gz_archive;
|
ar_archive->filter = filter_accept_list_reassign;
|
||||||
ar_archive->filter = filter_accept_list;
|
|
||||||
|
#ifdef CONFIG_FEATURE_DEB_TAR_GZ
|
||||||
ar_archive->accept = add_to_list(NULL, "data.tar.gz");
|
ar_archive->accept = add_to_list(NULL, "data.tar.gz");
|
||||||
|
# ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
|
||||||
|
control_tar_llist = add_to_list(NULL, "control.tar.gz");
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_FEATURE_DEB_TAR_BZ2
|
||||||
|
ar_archive->accept = add_to_list(ar_archive->accept, "data.tar.bz2");
|
||||||
|
# ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
|
||||||
|
control_tar_llist = add_to_list(control_tar_llist, "control.tar.bz2");
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
|
#ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
|
||||||
while ((opt = getopt(argc, argv, "cefXx")) != -1) {
|
while ((opt = getopt(argc, argv, "cefXx")) != -1) {
|
||||||
@ -55,26 +67,26 @@ extern int dpkg_deb_main(int argc, char **argv)
|
|||||||
switch (opt) {
|
switch (opt) {
|
||||||
#ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
|
#ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
|
||||||
case 'c':
|
case 'c':
|
||||||
tar_gz_archive->action_header = header_verbose_list;
|
tar_archive->action_header = header_verbose_list;
|
||||||
break;
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
ar_archive->accept = control_tar_gz_llist;
|
ar_archive->accept = control_tar_llist;
|
||||||
tar_gz_archive->action_data = data_extract_all;
|
tar_archive->action_data = data_extract_all;
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
/* Print the entire control file
|
/* Print the entire control file
|
||||||
* it should accept a second argument which specifies a
|
* it should accept a second argument which specifies a
|
||||||
* specific field to print */
|
* specific field to print */
|
||||||
ar_archive->accept = control_tar_gz_llist;
|
ar_archive->accept = control_tar_llist;
|
||||||
tar_gz_archive->accept = add_to_list(NULL, "./control");;
|
tar_archive->accept = add_to_list(NULL, "./control");;
|
||||||
tar_gz_archive->filter = filter_accept_list;
|
tar_archive->filter = filter_accept_list;
|
||||||
tar_gz_archive->action_data = data_extract_to_stdout;
|
tar_archive->action_data = data_extract_to_stdout;
|
||||||
break;
|
break;
|
||||||
case 'X':
|
case 'X':
|
||||||
tar_gz_archive->action_header = header_list;
|
tar_archive->action_header = header_list;
|
||||||
#endif
|
#endif
|
||||||
case 'x':
|
case 'x':
|
||||||
tar_gz_archive->action_data = data_extract_all;
|
tar_archive->action_data = data_extract_all;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
show_usage();
|
show_usage();
|
||||||
@ -85,7 +97,7 @@ extern int dpkg_deb_main(int argc, char **argv)
|
|||||||
show_usage();
|
show_usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
tar_gz_archive->src_fd = ar_archive->src_fd = xopen(argv[optind++], O_RDONLY);
|
tar_archive->src_fd = ar_archive->src_fd = xopen(argv[optind++], O_RDONLY);
|
||||||
|
|
||||||
/* Workout where to extract the files */
|
/* Workout where to extract the files */
|
||||||
/* 2nd argument is a dir name */
|
/* 2nd argument is a dir name */
|
||||||
|
@ -31,6 +31,7 @@ LIBUNARCHIVE-y:= \
|
|||||||
\
|
\
|
||||||
filter_accept_all.o \
|
filter_accept_all.o \
|
||||||
filter_accept_list.o \
|
filter_accept_list.o \
|
||||||
|
filter_accept_list_reassign.o \
|
||||||
filter_accept_reject_list.o \
|
filter_accept_reject_list.o \
|
||||||
\
|
\
|
||||||
get_header_ar.o \
|
get_header_ar.o \
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "unarchive.h"
|
#include "unarchive.h"
|
||||||
|
|
||||||
/* Accept any non-null name, its not really a filter at all */
|
/* Accept any non-null name, its not really a filter at all */
|
||||||
extern char filter_accept_all(const archive_handle_t *archive_handle)
|
extern char filter_accept_all(archive_handle_t *archive_handle)
|
||||||
{
|
{
|
||||||
if (archive_handle->file_header->name) {
|
if (archive_handle->file_header->name) {
|
||||||
return(EXIT_SUCCESS);
|
return(EXIT_SUCCESS);
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
/*
|
/*
|
||||||
* Accept names that are in the accept list, ignoring reject list.
|
* Accept names that are in the accept list, ignoring reject list.
|
||||||
*/
|
*/
|
||||||
extern char filter_accept_list(const archive_handle_t *archive_handle)
|
extern char filter_accept_list(archive_handle_t *archive_handle)
|
||||||
{
|
{
|
||||||
if (find_list_entry(archive_handle->accept, archive_handle->file_header->name)) {
|
if (find_list_entry(archive_handle->accept, archive_handle->file_header->name)) {
|
||||||
return(EXIT_SUCCESS);
|
return(EXIT_SUCCESS);
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
/*
|
/*
|
||||||
* Accept names that are in the accept list and not in the reject list
|
* Accept names that are in the accept list and not in the reject list
|
||||||
*/
|
*/
|
||||||
extern char filter_accept_reject_list(const archive_handle_t *archive_handle)
|
extern char filter_accept_reject_list(archive_handle_t *archive_handle)
|
||||||
{
|
{
|
||||||
const char *key = archive_handle->file_header->name;
|
const char *key = archive_handle->file_header->name;
|
||||||
const llist_t *accept_entry = find_list_entry(archive_handle->accept, key);
|
const llist_t *accept_entry = find_list_entry(archive_handle->accept, key);
|
||||||
|
@ -28,7 +28,7 @@ typedef struct llist_s {
|
|||||||
|
|
||||||
typedef struct archive_handle_s {
|
typedef struct archive_handle_s {
|
||||||
/* define if the header and data compenent should processed */
|
/* define if the header and data compenent should processed */
|
||||||
char (*filter)(const struct archive_handle_s *);
|
char (*filter)(struct archive_handle_s *);
|
||||||
const llist_t *accept;
|
const llist_t *accept;
|
||||||
const llist_t *reject;
|
const llist_t *reject;
|
||||||
const llist_t *passed; /* List of files that have successfully been worked on */
|
const llist_t *passed; /* List of files that have successfully been worked on */
|
||||||
@ -41,6 +41,8 @@ typedef struct archive_handle_s {
|
|||||||
|
|
||||||
/* process the data componenet, e.g. extract to filesystem */
|
/* process the data componenet, e.g. extract to filesystem */
|
||||||
void (*action_data)(struct archive_handle_s *);
|
void (*action_data)(struct archive_handle_s *);
|
||||||
|
|
||||||
|
/* How to process any sub archive, e.g. get_header_tar_gz */
|
||||||
char (*action_data_subarchive)(struct archive_handle_s *);
|
char (*action_data_subarchive)(struct archive_handle_s *);
|
||||||
|
|
||||||
/* Contains the handle to a sub archive */
|
/* Contains the handle to a sub archive */
|
||||||
@ -68,9 +70,10 @@ typedef struct archive_handle_s {
|
|||||||
|
|
||||||
extern archive_handle_t *init_handle(void);
|
extern archive_handle_t *init_handle(void);
|
||||||
|
|
||||||
extern char filter_accept_all(const archive_handle_t *archive_handle);
|
extern char filter_accept_all(archive_handle_t *archive_handle);
|
||||||
extern char filter_accept_list(const archive_handle_t *archive_handle);
|
extern char filter_accept_list(archive_handle_t *archive_handle);
|
||||||
extern char filter_accept_reject_list(const archive_handle_t *archive_handle);
|
extern char filter_accept_list_reassign(archive_handle_t *archive_handle);
|
||||||
|
extern char filter_accept_reject_list(archive_handle_t *archive_handle);
|
||||||
|
|
||||||
extern void unpack_ar_archive(archive_handle_t *ar_archive);
|
extern void unpack_ar_archive(archive_handle_t *ar_archive);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user