dissect: add --make-archive option to convert DDI to tarball

This commit is contained in:
Lennart Poettering
2024-01-25 18:47:39 +01:00
parent 6811774510
commit b68f4cade4
18 changed files with 374 additions and 5 deletions
+62
View File
@@ -0,0 +1,62 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "libarchive-util.h"
#if HAVE_LIBARCHIVE
static void *libarchive_dl = NULL;
DLSYM_FUNCTION(archive_entry_free);
DLSYM_FUNCTION(archive_entry_new);
DLSYM_FUNCTION(archive_entry_set_ctime);
DLSYM_FUNCTION(archive_entry_set_filetype);
DLSYM_FUNCTION(archive_entry_set_gid);
DLSYM_FUNCTION(archive_entry_set_mtime);
DLSYM_FUNCTION(archive_entry_set_pathname);
DLSYM_FUNCTION(archive_entry_set_perm);
DLSYM_FUNCTION(archive_entry_set_rdevmajor);
DLSYM_FUNCTION(archive_entry_set_rdevminor);
DLSYM_FUNCTION(archive_entry_set_symlink);
DLSYM_FUNCTION(archive_entry_set_size);
DLSYM_FUNCTION(archive_entry_set_uid);
DLSYM_FUNCTION(archive_error_string);
DLSYM_FUNCTION(archive_write_close);
DLSYM_FUNCTION(archive_write_data);
DLSYM_FUNCTION(archive_write_free);
DLSYM_FUNCTION(archive_write_header);
DLSYM_FUNCTION(archive_write_new);
DLSYM_FUNCTION(archive_write_open_FILE);
DLSYM_FUNCTION(archive_write_open_fd);
DLSYM_FUNCTION(archive_write_set_format_filter_by_ext);
DLSYM_FUNCTION(archive_write_set_format_gnutar);
int dlopen_libarchive(void) {
return dlopen_many_sym_or_warn(
&libarchive_dl,
"libarchive.so.13",
LOG_DEBUG,
DLSYM_ARG(archive_entry_free),
DLSYM_ARG(archive_entry_new),
DLSYM_ARG(archive_entry_set_ctime),
DLSYM_ARG(archive_entry_set_filetype),
DLSYM_ARG(archive_entry_set_gid),
DLSYM_ARG(archive_entry_set_mtime),
DLSYM_ARG(archive_entry_set_pathname),
DLSYM_ARG(archive_entry_set_perm),
DLSYM_ARG(archive_entry_set_rdevmajor),
DLSYM_ARG(archive_entry_set_rdevminor),
DLSYM_ARG(archive_entry_set_size),
DLSYM_ARG(archive_entry_set_symlink),
DLSYM_ARG(archive_entry_set_uid),
DLSYM_ARG(archive_error_string),
DLSYM_ARG(archive_write_close),
DLSYM_ARG(archive_write_data),
DLSYM_ARG(archive_write_free),
DLSYM_ARG(archive_write_header),
DLSYM_ARG(archive_write_new),
DLSYM_ARG(archive_write_open_FILE),
DLSYM_ARG(archive_write_open_fd),
DLSYM_ARG(archive_write_set_format_filter_by_ext),
DLSYM_ARG(archive_write_set_format_gnutar));
}
#endif
+45
View File
@@ -0,0 +1,45 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "dlfcn-util.h"
#if HAVE_LIBARCHIVE
#include <archive.h>
#include <archive_entry.h>
DLSYM_PROTOTYPE(archive_entry_free);
DLSYM_PROTOTYPE(archive_entry_new);
DLSYM_PROTOTYPE(archive_entry_set_ctime);
DLSYM_PROTOTYPE(archive_entry_set_filetype);
DLSYM_PROTOTYPE(archive_entry_set_gid);
DLSYM_PROTOTYPE(archive_entry_set_mtime);
DLSYM_PROTOTYPE(archive_entry_set_pathname);
DLSYM_PROTOTYPE(archive_entry_set_perm);
DLSYM_PROTOTYPE(archive_entry_set_rdevmajor);
DLSYM_PROTOTYPE(archive_entry_set_rdevminor);
DLSYM_PROTOTYPE(archive_entry_set_symlink);
DLSYM_PROTOTYPE(archive_entry_set_size);
DLSYM_PROTOTYPE(archive_entry_set_uid);
DLSYM_PROTOTYPE(archive_error_string);
DLSYM_PROTOTYPE(archive_write_close);
DLSYM_PROTOTYPE(archive_write_data);
DLSYM_PROTOTYPE(archive_write_free);
DLSYM_PROTOTYPE(archive_write_header);
DLSYM_PROTOTYPE(archive_write_new);
DLSYM_PROTOTYPE(archive_write_open_FILE);
DLSYM_PROTOTYPE(archive_write_open_fd);
DLSYM_PROTOTYPE(archive_write_set_format_filter_by_ext);
DLSYM_PROTOTYPE(archive_write_set_format_gnutar);
int dlopen_libarchive(void);
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct archive_entry*, sym_archive_entry_free, NULL);
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct archive*, sym_archive_write_free, NULL);
#else
static inline int dlopen_libarchive(void) {
return -EOPNOTSUPP;
}
#endif
+1
View File
@@ -103,6 +103,7 @@ shared_sources = files(
'keyring-util.c',
'killall.c',
'label-util.c',
'libarchive-util.c',
'libcrypt-util.c',
'libfido2-util.c',
'libmount-util.c',