2 # Create and output a wbm.gz file of selected modules
4 require './usermin-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(&twebmin::ext('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();
18 &get_usermin_miniserv_config(\%miniserv);
19 chdir($miniserv{'root'});
24 $cmd .= " | gzip -c >".quotemeta($temp);
25 $out = &backquote_logged("($cmd) 2>&1 </dev/null");
26 $? && &error("<pre>$out</pre>");
30 print "Content-type: application/octet-stream\n\n";
40 &ui_print_header(undef, $text{'export_title'}, "");
42 print &text('export_done', "<tt>$in{'file'}</tt>"),"<p>\n";
44 &ui_print_footer("/$module_name/edit_mods.cgi", $text{'mods_return'},
45 "", $text{'index_return'});