Section: admin
Priority: required
Maintainer: Theodore Y. Ts'o <tytso@mit.edu>
-Build-Depends: dpkg-dev (>= 1.22.5), gettext, texinfo, pkgconf, libarchive-dev, libfuse3-dev [linux-any kfreebsd-any] <!pkg.e2fsprogs.no-fuse2fs>, debhelper-compat (= 12), dh-exec, libblkid-dev, uuid-dev, m4, udev [linux-any], systemd [linux-any], systemd-dev [linux-any], cron [linux-any], dh-sequence-movetousr
+Build-Depends: dpkg-dev (>= 1.22.5), gettext, texinfo, pkgconf, libarchive-dev <!nocheck>, libfuse3-dev [linux-any kfreebsd-any] <!pkg.e2fsprogs.no-fuse2fs>, debhelper-compat (= 12), dh-exec, libblkid-dev, uuid-dev, m4, udev [linux-any], systemd [linux-any], systemd-dev [linux-any], cron [linux-any], dh-sequence-movetousr
Rules-Requires-Root: no
Standards-Version: 4.7.0
Homepage: http://e2fsprogs.sourceforge.net
#define _GNU_SOURCE 1
#include "config.h"
-#include <ext2fs/ext2_types.h>
#include "create_inode.h"
#include "create_inode_libarchive.h"
#include "support/nls-enable.h"
-#ifdef HAVE_ARCHIVE_H
+#ifdef CONFIG_DISABLE_LIBARCHIVE
+
+/* If ./configure was run with --without-libarchive, then only
+ * __populate_fs_from_tar() remains in this file and will return an error. */
+errcode_t __populate_fs_from_tar(ext2_filsys, ext2_ino_t, const char *,
+ ext2_ino_t, struct hdlinks_s *,
+ struct file_info *,
+ struct fs_ops_callbacks *) {
+ com_err(__func__, 0,
+ _("you need to compile e2fsprogs without --without-libarchive"
+ "be able to process tarballs"));
+ return 1;
+}
+
+#else
+
+/* If ./configure was NOT run with --without-libarchive, then build with
+ * support for dlopen()-ing libarchive at runtime. This will also work even
+ * if archive.h is not available at compile-time. See the comment below. */
/* 64KiB is the minimum blksize to best minimize system call overhead. */
//#define COPY_FILE_BUFLEN 65536
//#define COPY_FILE_BUFLEN 1048576
#define COPY_FILE_BUFLEN 16777216
+/* If archive.h was found, include it as usual. To support easier
+ * bootstrapping, also allow compilation without archive.h present by
+ * declaring the necessary opaque structs and preprocessor definitions. */
+#ifdef HAVE_ARCHIVE_H
#include <archive.h>
#include <archive_entry.h>
+#else
+struct archive;
+struct archive_entry;
+#define ARCHIVE_EOF 1 /* Found end of archive. */
+#define ARCHIVE_OK 0 /* Operation was successful. */
+#include <unistd.h> /* ssize_t */
+typedef ssize_t la_ssize_t;
+#endif /* HAVE_ARCHIVE_H */
+
#include <libgen.h>
#include <locale.h>
return 1;
}
-#endif
+#endif /* CONFIG_DLOPEN_LIBARCHIVE */
static errcode_t __find_path(ext2_filsys fs, ext2_ino_t root, const char *name,
ext2_ino_t *inode)
}
return 0;
}
-#endif
errcode_t __populate_fs_from_tar(ext2_filsys fs, ext2_ino_t root_ino,
const char *source_tar, ext2_ino_t root,
struct file_info *target,
struct fs_ops_callbacks *fs_callbacks)
{
-#ifndef HAVE_ARCHIVE_H
- com_err(__func__, 0,
- _("you need to compile e2fsprogs with libarchive to "
- "be able to process tarballs"));
- return 1;
-#else
char *path2, *path3, *dir, *name;
unsigned int dir_exists;
struct archive *a;
uselocale(old_locale);
freelocale(archive_locale);
return retval;
-#endif
}
+
+#endif /* CONFIG_DISABLE_LIBARCHIVE */