Пример #1
0
static void
fr_command_zoo_extract (FrCommand  *comm,
			const char  *from_file,
			GList      *file_list,
			const char *dest_dir,
			gboolean    overwrite,
			gboolean    skip_older,
			gboolean    junk_paths)
{
	GList *scan;

	fr_process_begin_command (comm->process, "zoo");

	if (overwrite)
		fr_process_add_arg (comm->process, "xO");
	else
		fr_process_add_arg (comm->process, "x");

	fr_process_add_arg (comm->process, comm->filename);

	if (dest_dir != NULL)
		fr_process_set_working_dir (comm->process, dest_dir);

	for (scan = file_list; scan; scan = scan->next)
		fr_process_add_arg (comm->process, scan->data);

	fr_process_end_command (comm->process);
}
static void
fr_command_dpkg_extract (FrCommand  *comm,
                         const char *from_file,
                         GList      *file_list,
                         const char *dest_dir,
                         gboolean    overwrite,
                         gboolean    skip_older,
                         gboolean    junk_paths)
{
        fr_process_begin_command (comm->process, "dpkg-deb");
        fr_process_add_arg (comm->process, "-x");
        fr_process_add_arg (comm->process, comm->filename);
        if (dest_dir != NULL) {
                fr_process_add_arg (comm->process, dest_dir);
        } else {
                fr_process_add_arg (comm->process, ".");
        }
        /* FIXME it is not possible to unpack only some files */
        fr_process_end_command (comm->process);

        /* Also extract metadata in DEBIAN/ */
        fr_process_begin_command (comm->process, "dpkg-deb");
        if (dest_dir != NULL) {
                fr_process_set_working_dir (comm->process, dest_dir);
        }
        fr_process_add_arg (comm->process, "-e");
        fr_process_add_arg (comm->process, comm->filename);
        fr_process_end_command (comm->process);

        fr_process_start (comm->process);
}
Пример #3
0
static void
fr_command_zoo_add (FrCommand     *comm,
		    const char    *from_file,
		    GList         *file_list,
		    const char    *base_dir,
		    gboolean       update,
		    gboolean       recursive)
{
	GList        *scan;

	/* Add files. */

	fr_process_begin_command (comm->process, "zoo");

	fr_process_set_working_dir (comm->process, base_dir);

	if (update)
		fr_process_add_arg (comm->process, "auP");
	else
		fr_process_add_arg (comm->process, "aP");

	fr_process_add_arg (comm->process, comm->filename);

	for (scan = file_list; scan; scan = scan->next)
		fr_process_add_arg (comm->process, scan->data);
	fr_process_end_command (comm->process);
}
Пример #4
0
static void
fr_command_lrzip_add (FrCommand  *comm,
		      const char *from_file,
		      GList      *file_list,
		      const char *base_dir,
		      gboolean    update,
		      gboolean    follow_links)
{
	fr_process_begin_command (comm->process, "lrzip");

	if (base_dir != NULL)
		fr_process_set_working_dir (comm->process, base_dir);

	/* preserve links. */

	switch (FR_ARCHIVE (comm)->compression) {
	case FR_COMPRESSION_VERY_FAST:
		fr_process_add_arg (comm->process, "-l"); break;
	case FR_COMPRESSION_FAST:
		fr_process_add_arg (comm->process, "-g"); break;
	case FR_COMPRESSION_NORMAL:
		fr_process_add_arg (comm->process, "-b"); break;
	case FR_COMPRESSION_MAXIMUM:
		fr_process_add_arg (comm->process, "-z"); break;
	}

	fr_process_add_arg (comm->process, "-o");
	fr_process_add_arg (comm->process, comm->filename);
	fr_process_add_arg (comm->process, (char *) file_list->data);

	fr_process_end_command (comm->process);
}
Пример #5
0
void
fr_process_set_working_dir_file (FrProcess *process,
				 GFile     *folder)
{
	char *path;

	path = g_file_get_path (folder);
	fr_process_set_working_dir (process, path);

	g_free (path);
}
Пример #6
0
static void
fr_command_zip_add (FrCommand     *comm,
		    const char    *from_file,
		    GList         *file_list,
		    const char    *base_dir,
		    gboolean       update,
		    gboolean       recursive)
{
	GList *scan;

	fr_process_set_out_line_func (FR_COMMAND (comm)->process,
				      process_line__common,
				      comm);

	fr_process_begin_command (comm->process, "zip");

	if (base_dir != NULL)
		fr_process_set_working_dir (comm->process, base_dir);

	/* preserve links. */
	fr_process_add_arg (comm->process, "-y");

	if (update)
		fr_process_add_arg (comm->process, "-u");

	add_password_arg (comm, comm->password);

	switch (comm->compression) {
	case FR_COMPRESSION_VERY_FAST:
		fr_process_add_arg (comm->process, "-1"); break;
	case FR_COMPRESSION_FAST:
		fr_process_add_arg (comm->process, "-3"); break;
	case FR_COMPRESSION_NORMAL:
		fr_process_add_arg (comm->process, "-6"); break;
	case FR_COMPRESSION_MAXIMUM:
		fr_process_add_arg (comm->process, "-9"); break;
	}

	fr_process_add_arg (comm->process, comm->filename);
	fr_process_add_arg (comm->process, "--");

	for (scan = file_list; scan; scan = scan->next)
		fr_process_add_arg (comm->process, scan->data);

	fr_process_end_command (comm->process);
}
Пример #7
0
static void
fr_command_arj_add (FrCommand     *comm,
		    const char    *from_file,
		    GList         *file_list,
		    const char    *base_dir,
		    gboolean       update,
		    gboolean       recursive)
{
	GList *scan;

	fr_process_begin_command (comm->process, "arj");

	fr_process_add_arg (comm->process, "a");

	if (base_dir != NULL)
		fr_process_set_working_dir (comm->process, base_dir);

	if (update)
		fr_process_add_arg (comm->process, "-u");

	if (comm->password != NULL)
		fr_process_add_arg_concat (comm->process, "-g/", comm->password, NULL);

	switch (comm->compression) {
	case FR_COMPRESSION_VERY_FAST:
		fr_process_add_arg (comm->process, "-m3"); break;
	case FR_COMPRESSION_FAST:
		fr_process_add_arg (comm->process, "-m2"); break;
	case FR_COMPRESSION_NORMAL:
		fr_process_add_arg (comm->process, "-m1"); break;
	case FR_COMPRESSION_MAXIMUM:
		fr_process_add_arg (comm->process, "-m1"); break;
	}

	fr_process_add_arg (comm->process, "-i");
	fr_process_add_arg (comm->process, "-y");
	fr_process_add_arg (comm->process, "-");

	fr_process_add_arg (comm->process, comm->filename);

	for (scan = file_list; scan; scan = scan->next)
		fr_process_add_arg (comm->process, (gchar*) scan->data);

	fr_process_end_command (comm->process);
}
Пример #8
0
static void
fr_command_iso_extract (FrCommand  *comm,
			const char *from_file,
			GList      *file_list,
			const char *dest_dir,
			gboolean    overwrite,
			gboolean    skip_older,
			gboolean    junk_paths)
{
	GList *scan;

	for (scan = file_list; scan; scan = scan->next) {
		char       *path = scan->data;
		const char *filename;
		char       *file_dir;
		char       *temp_dest_dir = NULL;

		filename = file_name_from_path (path);
		file_dir = remove_level_from_path (path);
		if ((file_dir != NULL) && (strcmp (file_dir, "/") != 0))
			temp_dest_dir = g_build_filename (dest_dir, file_dir, NULL);
		 else
			temp_dest_dir = g_strdup (dest_dir);
		g_free (file_dir);

		if (temp_dest_dir == NULL)
			continue;

		make_directory_tree_from_path (temp_dest_dir, 0700, NULL);

		fr_process_begin_command (comm->process, "sh");
		fr_process_set_working_dir (comm->process, temp_dest_dir);
		fr_process_add_arg (comm->process, SHDIR "isoinfo.sh");
		fr_process_add_arg (comm->process, "-i");
		fr_process_add_arg (comm->process, comm->filename);
		fr_process_add_arg (comm->process, "-x");
		fr_process_add_arg (comm->process, path);
		fr_process_add_arg (comm->process, filename);
		fr_process_end_command (comm->process);

		g_free (temp_dest_dir);
	}
}
Пример #9
0
static void
fr_command_cpio_extract (FrCommand *comm,
			const char *from_file,
			GList      *file_list,
			const char *dest_dir,
			gboolean    overwrite,
			gboolean    skip_older,
			gboolean    junk_paths)
{
	GList   *scan;
	GString *cmd;

	fr_process_begin_command (comm->process, "sh");
	if (dest_dir != NULL)
                fr_process_set_working_dir (comm->process, dest_dir);
	fr_process_add_arg (comm->process, "-c");

	cmd = g_string_new ("cpio -idu --no-absolute-filenames ");
	for (scan = file_list; scan; scan = scan->next) {
		char *filepath = scan->data;
		char *filename;

		if (filepath[0] == '/')
			filename = g_shell_quote (filepath + 1);
		else
			filename = g_shell_quote (filepath);
		g_string_append (cmd, filename);
		g_string_append (cmd, " ");

		g_free (filename);
	}
        g_string_append (cmd, " < ");
	g_string_append (cmd, comm->e_filename);
	fr_process_add_arg (comm->process, cmd->str);
	g_string_free (cmd, TRUE);

	fr_process_end_command (comm->process);
}
Пример #10
0
static void
fr_command_lha_extract (FrCommand  *comm,
			const char *from_file,
			GList      *file_list,
			const char *dest_dir,
			gboolean    overwrite,
			gboolean    skip_older,
			gboolean    junk_paths)
{
	GList *scan;
	char   options[5];
	int    i = 0;

	fr_process_begin_command (comm->process, "lha");

	if (dest_dir != NULL)
		fr_process_set_working_dir (comm->process, dest_dir);

	options[i++] = 'x';
	options[i++] = 'f'; /* Always overwrite.
			     * The overwrite option is handled in
			     * fr_archive_extract,
			     * this is because lha asks the user whether he
			     * wants to overwrite a file. */

	if (junk_paths)
		options[i++] = 'i';

	options[i++] = 0;
	fr_process_add_arg (comm->process, options);
	fr_process_add_arg (comm->process, comm->filename);

	for (scan = file_list; scan; scan = scan->next)
		fr_process_add_arg (comm->process, scan->data);

	fr_process_end_command (comm->process);
}
static void
fr_command_cfile_extract (FrCommand  *comm,
			  const char *from_file,
			  GList      *file_list,
			  const char *dest_dir,
			  gboolean    overwrite,
			  gboolean    skip_older,
			  gboolean    junk_paths)
{
	char *temp_dir;
	char *dest_file;
	char *temp_file;
	char *uncompr_file;
	char *compr_file;

	/* copy file to the temp dir, remove the already existing file first */

	temp_dir = get_temp_work_dir (NULL);
	temp_file = g_strconcat (temp_dir,
				 "/",
				 file_name_from_path (comm->filename),
				 NULL);

	fr_process_begin_command (comm->process, "cp");
	fr_process_add_arg (comm->process, "-f");
	fr_process_add_arg (comm->process, comm->filename);
	fr_process_add_arg (comm->process, temp_file);
	fr_process_end_command (comm->process);

	/* uncompress the file */

	if (is_mime_type (comm->mime_type, "application/x-gzip")) {
		fr_process_begin_command (comm->process, "gzip");
		fr_process_add_arg (comm->process, "-f");
		fr_process_add_arg (comm->process, "-d");
		fr_process_add_arg (comm->process, "-n");
		fr_process_add_arg (comm->process, temp_file);
		fr_process_end_command (comm->process);
	}
	else if (is_mime_type (comm->mime_type, "application/x-bzip")) {
		fr_process_begin_command (comm->process, "bzip2");
		fr_process_add_arg (comm->process, "-f");
		fr_process_add_arg (comm->process, "-d");
		fr_process_add_arg (comm->process, temp_file);
		fr_process_end_command (comm->process);
	}
	else if (is_mime_type (comm->mime_type, "application/x-compress")) {
		if (is_program_in_path ("gzip")) {
			fr_process_begin_command (comm->process, "gzip");
			fr_process_add_arg (comm->process, "-d");
			fr_process_add_arg (comm->process, "-n");
		}
		else
			fr_process_begin_command (comm->process, "uncompress");
		fr_process_add_arg (comm->process, "-f");
		fr_process_add_arg (comm->process, temp_file);
		fr_process_end_command (comm->process);
	}
	else if (is_mime_type (comm->mime_type, "application/x-lzip")) {
		fr_process_begin_command (comm->process, "lzip");
		fr_process_add_arg (comm->process, "-f");
		fr_process_add_arg (comm->process, "-d");
		fr_process_add_arg (comm->process, temp_file);
		fr_process_end_command (comm->process);
	}
	else if (is_mime_type (comm->mime_type, "application/x-lzma")) {
		fr_process_begin_command (comm->process, "lzma");
		fr_process_add_arg (comm->process, "-f");
		fr_process_add_arg (comm->process, "-d");
		fr_process_add_arg (comm->process, temp_file);
		fr_process_end_command (comm->process);
	}
	else if (is_mime_type (comm->mime_type, "application/x-xz")) {
		fr_process_begin_command (comm->process, "xz");
		fr_process_add_arg (comm->process, "-f");
		fr_process_add_arg (comm->process, "-d");
		fr_process_add_arg (comm->process, temp_file);
		fr_process_end_command (comm->process);
	}
	else if (is_mime_type (comm->mime_type, "application/x-lzop")) {
		fr_process_begin_command (comm->process, "lzop");
		fr_process_set_working_dir (comm->process, temp_dir);
		fr_process_add_arg (comm->process, "-d");
		fr_process_add_arg (comm->process, "-fU");
		fr_process_add_arg (comm->process, "--no-stdin");
		fr_process_add_arg (comm->process, temp_file);
		fr_process_end_command (comm->process);
	}
	else if (is_mime_type (comm->mime_type, "application/x-rzip")) {
		fr_process_begin_command (comm->process, "rzip");
		fr_process_add_arg (comm->process, "-f");
		fr_process_add_arg (comm->process, "-d");
		fr_process_add_arg (comm->process, temp_file);
		fr_process_end_command (comm->process);
	}

	/* copy uncompress file to the dest dir */

	uncompr_file = remove_extension_from_path (temp_file);

	compr_file = get_uncompressed_name_from_archive (comm, comm->filename);
	if (compr_file == NULL)
		compr_file = remove_extension_from_path (file_name_from_path (comm->filename));
	dest_file = g_strconcat (dest_dir,
				 "/",
				 compr_file,
				 NULL);

	fr_process_begin_command (comm->process, "cp");
	fr_process_add_arg (comm->process, "-f");
	fr_process_add_arg (comm->process, uncompr_file);
	fr_process_add_arg (comm->process, dest_file);
	fr_process_end_command (comm->process);

	/* remove the temp dir */

	fr_process_begin_command (comm->process, "rm");
	fr_process_set_sticky (comm->process, TRUE);
	fr_process_add_arg (comm->process, "-rf");
	fr_process_add_arg (comm->process, temp_dir);
	fr_process_end_command (comm->process);

	g_free (dest_file);
	g_free (compr_file);
	g_free (uncompr_file);
	g_free (temp_file);
	g_free (temp_dir);
}
static void
fr_command_cfile_add (FrCommand     *comm,
		      const char    *from_file,
		      GList         *file_list,
		      const char    *base_dir,
		      gboolean       update,
		      gboolean       recursive)
{
	const char *filename;
	char       *temp_dir;
	char       *temp_file;
	char       *compressed_filename;

	if ((file_list == NULL) || (file_list->data == NULL))
		return;

	/* copy file to the temp dir */

	temp_dir = get_temp_work_dir (NULL);
	filename = file_list->data;
	temp_file = g_strconcat (temp_dir, "/", filename, NULL);

	fr_process_begin_command (comm->process, "cp");
	fr_process_set_working_dir (comm->process, base_dir);
	fr_process_add_arg (comm->process, "-f");
	fr_process_add_arg (comm->process, "--");
	fr_process_add_arg (comm->process, filename);
	fr_process_add_arg (comm->process, temp_file);
	fr_process_end_command (comm->process);

	/**/

	if (is_mime_type (comm->mime_type, "application/x-gzip")) {
		fr_process_begin_command (comm->process, "gzip");
		fr_process_set_working_dir (comm->process, temp_dir);
		fr_process_add_arg (comm->process, "--");
		fr_process_add_arg (comm->process, filename);
		fr_process_end_command (comm->process);
		compressed_filename = g_strconcat (filename, ".gz", NULL);
	}
	else if (is_mime_type (comm->mime_type, "application/x-bzip")) {
		fr_process_begin_command (comm->process, "bzip2");
		fr_process_set_working_dir (comm->process, temp_dir);
		fr_process_add_arg (comm->process, "--");
		fr_process_add_arg (comm->process, filename);
		fr_process_end_command (comm->process);
		compressed_filename = g_strconcat (filename, ".bz2", NULL);
	}
	else if (is_mime_type (comm->mime_type, "application/x-compress")) {
		fr_process_begin_command (comm->process, "compress");
		fr_process_set_working_dir (comm->process, temp_dir);
		fr_process_add_arg (comm->process, "-f");
		fr_process_add_arg (comm->process, filename);
		fr_process_end_command (comm->process);
		compressed_filename = g_strconcat (filename, ".Z", NULL);
	}
	else if (is_mime_type (comm->mime_type, "application/x-lzip")) {
		fr_process_begin_command (comm->process, "lzip");
		fr_process_set_working_dir (comm->process, temp_dir);
		fr_process_add_arg (comm->process, "--");
		fr_process_add_arg (comm->process, filename);
		fr_process_end_command (comm->process);
		compressed_filename = g_strconcat (filename, ".lz", NULL);
	}
	else if (is_mime_type (comm->mime_type, "application/x-lzma")) {
		fr_process_begin_command (comm->process, "lzma");
		fr_process_set_working_dir (comm->process, temp_dir);
		fr_process_add_arg (comm->process, "--");
		fr_process_add_arg (comm->process, filename);
		fr_process_end_command (comm->process);
		compressed_filename = g_strconcat (filename, ".lzma", NULL);
	}
	else if (is_mime_type (comm->mime_type, "application/x-xz")) {
		fr_process_begin_command (comm->process, "xz");
		fr_process_set_working_dir (comm->process, temp_dir);
		fr_process_add_arg (comm->process, "--");
		fr_process_add_arg (comm->process, filename);
		fr_process_end_command (comm->process);
		compressed_filename = g_strconcat (filename, ".xz", NULL);
	}
	else if (is_mime_type (comm->mime_type, "application/x-lzop")) {
		fr_process_begin_command (comm->process, "lzop");
		fr_process_set_working_dir (comm->process, temp_dir);
		fr_process_add_arg (comm->process, "-fU");
		fr_process_add_arg (comm->process, "--no-stdin");
		fr_process_add_arg (comm->process, "--");
		fr_process_add_arg (comm->process, filename);
		fr_process_end_command (comm->process);
		compressed_filename = g_strconcat (filename, ".lzo", NULL);
	}
	else if (is_mime_type (comm->mime_type, "application/x-rzip")) {
		fr_process_begin_command (comm->process, "rzip");
		fr_process_set_working_dir (comm->process, temp_dir);
		fr_process_add_arg (comm->process, filename);
		fr_process_end_command (comm->process);
		compressed_filename = g_strconcat (filename, ".rz", NULL);
	}

      	/* copy compressed file to the dest dir */

	fr_process_begin_command (comm->process, "cp");
	fr_process_set_working_dir (comm->process, temp_dir);
	fr_process_add_arg (comm->process, "-f");
	fr_process_add_arg (comm->process, "--");
	fr_process_add_arg (comm->process, compressed_filename);
	fr_process_add_arg (comm->process, comm->filename);
	fr_process_end_command (comm->process);

	/* remove the temp dir */

	fr_process_begin_command (comm->process, "rm");
	fr_process_set_sticky (comm->process, TRUE);
	fr_process_add_arg (comm->process, "-rf");
	fr_process_add_arg (comm->process, "--");
	fr_process_add_arg (comm->process, temp_dir);
	fr_process_end_command (comm->process);

	g_free (compressed_filename);
	g_free (temp_file);
	g_free (temp_dir);
}
static void
fr_command_jar_add (FrCommand     *comm,
		    const char    *from_file,
		    GList         *file_list,
		    const char    *base_dir,
		    gboolean       update,
		    gboolean       recursive)
{
	FrProcess *proc = comm->process;
	GList     *zip_list = NULL, *jardata_list = NULL, *jar_list = NULL;
	GList     *scan;
	char      *tmp_dir;

	for (scan = file_list; scan; scan = scan->next) {
		char *filename = scan->data;
		char *path = build_uri (base_dir, filename, NULL);
		char *package = NULL;

		if (file_extension_is (filename, ".java"))
			package = get_package_name_from_java_file (path);
		else if (file_extension_is (filename, ".class"))
			package = get_package_name_from_class_file (path);

		if ((package == NULL) || (strlen (package) == 0))
			zip_list = g_list_append (zip_list, g_strdup (filename));
		else {
			JarData *newdata = g_new0 (JarData, 1);

			newdata->package_minus_one_level = remove_level_from_path (package);
			newdata->link_name = g_strdup (file_name_from_path (package));
			newdata->rel_path = remove_level_from_path (filename);
			newdata->filename = g_strdup (file_name_from_path (filename));
			jardata_list = g_list_append (jardata_list, newdata);
		}

		g_free (package);
		g_free (path);
	}

	tmp_dir = get_temp_work_dir (NULL);
	for (scan = jardata_list; scan ; scan = scan->next) {
		JarData *jdata = scan->data;
		char    *pack_path;
		char    *old_link;
		char    *link_name;
		int      retval;

		pack_path = build_uri (tmp_dir, jdata->package_minus_one_level, NULL);
		if (! make_directory_tree_from_path (pack_path, 0755, NULL)) {
			g_free (pack_path);
			continue;
		}

		old_link = build_uri (base_dir, jdata->rel_path, NULL);
		link_name = g_build_filename (pack_path, jdata->link_name, NULL);

		retval = symlink (old_link, link_name);
		if ((retval != -1) || (errno == EEXIST))
			jar_list = g_list_append (jar_list,
						  g_build_filename (jdata->package_minus_one_level,
							            jdata->link_name,
						      	            jdata->filename,
						      	            NULL));

		g_free (link_name);
		g_free (old_link);
		g_free (pack_path);
	}

	if (zip_list != NULL)
		parent_class->add (comm, NULL, zip_list, base_dir, update, FALSE);

	if (jar_list != NULL)
		parent_class->add (comm, NULL, jar_list, tmp_dir, update, FALSE);

	fr_process_begin_command (proc, "rm");
	fr_process_set_working_dir (proc, "/");
	fr_process_add_arg (proc, "-r");
	fr_process_add_arg (proc, "-f");
	fr_process_add_arg (proc, tmp_dir);
	fr_process_end_command (proc);
	fr_process_set_sticky (proc, TRUE);

	for (scan = jardata_list; scan ; scan = scan->next) {
		JarData *jdata = scan->data;
		g_free (jdata->filename);
		g_free (jdata->package_minus_one_level);
		g_free (jdata->link_name);
		g_free (jdata->rel_path);
	}

	path_list_free (jardata_list);
	path_list_free (jar_list);
	path_list_free (zip_list);
	g_free (tmp_dir);
}
Пример #14
0
static void
fr_command_7z_add (FrCommand  *command,
		   const char *from_file,
		   GList      *file_list,
		   const char *base_dir,
		   gboolean    update,
		   gboolean    follow_links)
{
	FrArchive *archive = FR_ARCHIVE (command);
	GList     *scan;

	fr_process_use_standard_locale (command->process, TRUE);
	fr_process_set_out_line_func (command->process,
				      process_line__add,
				      command);

	fr_command_7z_begin_command (command);

	if (update)
		fr_process_add_arg (command->process, "u");
	else
		fr_process_add_arg (command->process, "a");

	if (base_dir != NULL)
		fr_process_set_working_dir (command->process, base_dir);

	if (_g_mime_type_matches (archive->mime_type, "application/zip")
	    || _g_mime_type_matches (archive->mime_type, "application/x-cbz"))
	{
		fr_process_add_arg (command->process, "-tzip");
		fr_process_add_arg (command->process, "-mem=AES128");
	}

	fr_process_add_arg (command->process, "-bd");
	fr_process_add_arg (command->process, "-y");
	if (follow_links)
		fr_process_add_arg (command->process, "-l");
	add_password_arg (command, archive->password, FALSE);
	if ((archive->password != NULL)
	    && (*archive->password != 0)
	    && archive->encrypt_header
	    && fr_archive_is_capable_of (archive, FR_ARCHIVE_CAN_ENCRYPT_HEADER))
	{
		fr_process_add_arg (command->process, "-mhe=on");
	}

	/* fr_process_add_arg (command->process, "-ms=off"); FIXME: solid mode off? */

	switch (archive->compression) {
	case FR_COMPRESSION_VERY_FAST:
		fr_process_add_arg (command->process, "-mx=1");
		break;
	case FR_COMPRESSION_FAST:
		fr_process_add_arg (command->process, "-mx=5");
		break;
	case FR_COMPRESSION_NORMAL:
		fr_process_add_arg (command->process, "-mx=7");
		break;
	case FR_COMPRESSION_MAXIMUM:
		fr_process_add_arg (command->process, "-mx=9");
		if (! _g_mime_type_matches (archive->mime_type, "application/zip")
		    && ! _g_mime_type_matches (archive->mime_type, "application/x-cbz"))
		{
			fr_process_add_arg (command->process, "-m0=lzma2");;
		}
		break;
	}

	if (_g_mime_type_matches (archive->mime_type, "application/x-ms-dos-executable"))
		fr_process_add_arg (command->process, "-sfx");

	if (archive->volume_size > 0)
		fr_process_add_arg_printf (command->process, "-v%ub", archive->volume_size);

	if (from_file != NULL)
		fr_process_add_arg_concat (command->process, "-i@", from_file, NULL);

	if (from_file == NULL)
		for (scan = file_list; scan; scan = scan->next)
			/* Files prefixed with '@' need to be handled specially */
			if (g_str_has_prefix (scan->data, "@"))
				fr_process_add_arg_concat (command->process, "-i!", scan->data, NULL);

	fr_process_add_arg (command->process, "--");
	fr_process_add_arg (command->process, command->filename);

	if (from_file == NULL)
		for (scan = file_list; scan; scan = scan->next)
			/* Skip files prefixed with '@', already added */
			if (!g_str_has_prefix (scan->data, "@"))
				fr_process_add_arg (command->process, scan->data);

	fr_process_end_command (command->process);
}