From dc5d80a7d6d3f861d6de5d3705b391a91a7209d7 Mon Sep 17 00:00:00 2001 From: Jasper Lievisse Adriaanse Date: Thu, 16 Apr 2015 13:08:28 +0200 Subject: add a configure environment variable to select the cpio path on some systems (like OpenBSD), gcpio is prefered over the base cpio. origin commit: https://gitlab.gnome.org/GNOME/file-roller/commit/8a51165 --- configure.ac | 4 ++++ src/commands/rpm2cpio.c | 2 +- src/fr-command-cpio.c | 4 ++-- src/fr-command-rpm.c | 4 ++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 51c147e..680e2c0 100644 --- a/configure.ac +++ b/configure.ac @@ -165,6 +165,10 @@ fi AM_CONDITIONAL(ENABLE_MAGIC, test x"$enable_magic" != x"no") +AC_ARG_VAR([CPIO], [Path to the `cpio` command]) +AC_PATH_PROGS(CPIO, gcpio cpio) +AC_DEFINE_UNQUOTED(CPIO_PATH, "${CPIO}", [Path to cpio]) + dnl ****************************** YELP_HELP_INIT diff --git a/src/commands/rpm2cpio.c b/src/commands/rpm2cpio.c index 0dd3caf..bdadb3d 100644 --- a/src/commands/rpm2cpio.c +++ b/src/commands/rpm2cpio.c @@ -128,7 +128,7 @@ main (int argc, char **argv) archive_command = "bzip2 -dc"; fclose (stream); - command = g_strdup_printf ("sh -c \"dd if=%s ibs=%u skip=1 2>/dev/null | %s | cpio %s\"", g_shell_quote (filename), offset, archive_command, cpio_args->str); + command = g_strdup_printf ("sh -c \"dd if=%s ibs=%u skip=1 2>/dev/null | %s | " CPIO_PATH " %s\"", g_shell_quote (filename), offset, archive_command, cpio_args->str); return system (command); } diff --git a/src/fr-command-cpio.c b/src/fr-command-cpio.c index 19a3ed1..6cbe61d 100644 --- a/src/fr-command-cpio.c +++ b/src/fr-command-cpio.c @@ -176,7 +176,7 @@ fr_command_cpio_list (FrCommand *comm) fr_process_begin_command (comm->process, "sh"); fr_process_add_arg (comm->process, "-c"); - fr_process_add_arg_concat (comm->process, "cpio -itv < ", comm->e_filename, NULL); + fr_process_add_arg_concat (comm->process, CPIO_PATH " -itv < ", comm->e_filename, NULL); fr_process_end_command (comm->process); fr_process_start (comm->process); } @@ -240,7 +240,7 @@ fr_command_cpio_get_capabilities (FrCommand *comm, FrCommandCap capabilities; capabilities = FR_COMMAND_CAN_ARCHIVE_MANY_FILES; - if (is_program_available ("cpio", check_command)) + if (is_program_available (CPIO_PATH, check_command)) capabilities |= FR_COMMAND_CAN_READ; return capabilities; diff --git a/src/fr-command-rpm.c b/src/fr-command-rpm.c index d4aff5e..c05c317 100644 --- a/src/fr-command-rpm.c +++ b/src/fr-command-rpm.c @@ -241,7 +241,7 @@ fr_command_rpm_get_capabilities (FrCommand *comm, FrCommandCap capabilities; capabilities = FR_COMMAND_CAN_ARCHIVE_MANY_FILES; - if (is_program_available ("cpio", check_command)) + if (is_program_available (CPIO_PATH, check_command)) capabilities |= FR_COMMAND_CAN_READ; return capabilities; @@ -252,7 +252,7 @@ static const char * fr_command_rpm_get_packages (FrCommand *comm, const char *mime_type) { - return PACKAGES ("cpio,rpm"); + return PACKAGES (CPIO_PATH ",rpm"); } -- cgit v1.2.1