2 # Create and output a wbm.gz file of selected modules
4 require './webmin-lib.pl';
6 &error_setup($text{'export_err'});
7 @mods = split(/\0/, $in{'mod'});
8 @mods || &error($text{'delete_enone'});
10 # Make sure we have the needed commands
11 &has_command("tar") || &error(&text('export_ecmd', "<tt>tar</tt>"));
12 &has_command("gzip") || &error(&text('export_ecmd', "<tt>gzip</tt>"));
13 $in{'to'} == 0 || $in{'file'} =~ /^\// || &error($text{'export_efile'});
15 # Make the tar.gz file
16 $temp = $in{'to'} ? $in{'file'} : &transname();
17 chdir(&module_root_directory($mods[0])."/..");
22 $cmd .= " | gzip -c >".quotemeta($temp);
23 $out = &backquote_logged("($cmd) 2>&1 </dev/null");
24 $? && &error("<pre>$out</pre>");
28 print "Content-type: application/octet-stream\n\n";
38 &ui_print_header(undef, $text{'export_title'}, "");
40 print &text('export_done', "<tt>$in{'file'}</tt>"),"<p>\n";
42 &ui_print_footer("/$module_name/edit_mods.cgi", $text{'mods_return'},
43 "", $text{'index_return'});