1 diff -u system-tools-backends-1.4.2/file.pl.in-orig1 system-tools-backends-1.4.2/file.pl.in
2 --- system-tools-backends-1.4.2/file.pl.in-orig1 2005-11-04 15:49:36.000000000 +0000
3 +++ system-tools-backends-1.4.2/file.pl.in 2006-10-26 11:51:42.154832000 +0100
8 +$gst_file_last_run_stderr_str = "";
10 # --- File operations --- #
13 sub gst_file_get_base_path
15 my $path = "/var/cache/setup-tool-backends";
16 + # Need to check using @build_os@ configure substution incase platform is not
18 + $path = "/var/spool/setup-tool-backends" if ($$tool{"platform"} =~ /solaris-.*/ || "@build_os@" =~ /solaris.*/);
19 + &gst_file_create_path($path) unless ( -d $path );
25 sub gst_file_get_tmp_path
27 + # Need to check using @build_os@ configure substution incase platform is not
29 + if ($$tool{"platform"} =~ /solaris-.*/ || "@build_os@" =~ /solaris.*/) {
30 + my $path = "/var/run/setup-tool-backends/tmp";
31 + &gst_file_create_path($path, 0700) unless ( -d $path );
32 + chmod (0700, $path);
35 return (&gst_file_get_base_path () . "/tmp");
39 sub gst_file_get_backup_path
41 return (&gst_file_get_base_path () . "/backup");
45 sub gst_file_get_debug_path
47 + # Need to check using @build_os@ configure substution incase platform is not
49 + if ($$tool{"platform"} =~ /solaris-.*/ || "@build_os@" =~ /solaris.*/) {
50 + my $path = "/var/run/setup-tool-backends/debug";
51 + &gst_file_create_path($path, 0700) unless ( -d $path );
53 + chmod (0700, $path);
56 return (&gst_file_get_base_path (). "/debug");
60 sub gst_file_get_data_path
62 my $path = &gst_file_get_base_path (). "/data";
63 + &gst_file_create_path($path) unless ( -d $path );
70 my $command = &get_cmd_path ($cmd);
71 - return ("LC_ALL=C PATH=\$PATH:/sbin:/usr/sbin $command 2> /dev/null");
72 + return ("LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/sbin:\$PATH $command 2> /dev/null");
75 # necessary for some programs that output info through stderr
79 my $command = &get_cmd_path ($cmd);
80 - return ("LC_ALL=C PATH=\$PATH:/sbin:/usr/sbin $command 2>&1");
81 + return ("LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/sbin:\$PATH $command 2>&1");
89 +sub gst_file_read_joined_lines
92 + my $buffer = &gst_file_buffer_load ($file);
93 + &gst_file_buffer_join_lines ($buffer);
94 + $$buffer[0] =~ s/\n//; $$buffer[0] =~ s/\\//;
98 # --- Command-line utilities --- #
101 +# Provide acces to the stderr of the last command that ran
103 +sub gst_file_get_error_str
105 + return $gst_file_last_run_stderr_str;
109 # &gst_file_run (<command line>)
111 @@ -789,20 +826,54 @@
114 my ($cmd, $background) = @_;
115 - my ($command, $tool_name, $tool_path, @argline);
116 + my ($command, $tool_name, $tool_path, @argline, $stderr_str);
118 &gst_report_enter ();
120 - $command = &gst_file_get_cmd_path ($cmd);
121 - return -1 if $command == -1;
122 - $command .= " > /dev/null";
123 - $command .= " &" if $background;
124 + if ( $background ) {
125 + $command = &gst_file_get_cmd_path ($cmd);
126 + return -1 if $command == -1;
128 + $command .= " > /dev/null";
129 + $command .= " &" if $background;
132 + $command = &gst_file_get_cmd_path_with_stderr ($cmd);
133 + return -1 if $command == -1;
135 + # Trap stderr, but not stdout - done using "2>&1 1>/dev/null"
136 + $command .= " 1> /dev/null";
140 &gst_report ("file_run", $command);
142 + # See if we can give more information rather than silently failing.
143 + if ( $background ) {
144 + $stderr_str = ""; # Can't get this if command is backgrounded
145 + my $retval = system ($command);
148 + $stderr_str = readpipe( $command );
151 + if ( $retval == -1 ) {
152 + &gst_report ("file_run_exec_failed", $! );
155 + # As documented in perlfunc, divide by 256.
156 + $retval = $retval / 256
157 + &gst_report ("file_run_exit_code", $retval );
158 + if ( $retval != 0 ) {
159 + $gst_file_last_run_stderr_str = $stderr_str; # Remember the stderr of the last run command.
160 + &gst_debug_print_indented_string( 2, "Command wrote the following to stderr: \n" );
161 + &gst_debug_print_indented_string( 4, $stderr_str . "\n" );
165 &gst_report_leave ();
167 - # As documented in perlfunc, divide by 256.
168 - return (system ($command) / 256);
177 + return "" if $tool eq undef;
179 # We don't search absolute paths. Arturo.
183 diff -ru /var/tmp/clean/system-tools-backends-1.4.2/partition.pl.in system-tools-backends-1.4.2/partition.pl.in
184 --- /var/tmp/clean/system-tools-backends-1.4.2/partition.pl.in 2004-11-05 17:03:26.000000000 +0000
185 +++ system-tools-backends-1.4.2/partition.pl.in 2006-03-13 10:14:56.152216000 +0000
190 +sub gst_partition_scan_sunos_info
196 + $hash{"partition"} = \@table;
201 sub gst_partition_scan_freebsd_info
206 return &gst_partition_scan_linux_info if ($plat eq "Linux");
207 return &gst_partition_scan_freebsd_info if ($plat eq "FreeBSD");
208 + return &gst_partition_scan_sunos_info if ($plat eq "SunOS");
212 diff -ru /var/tmp/clean/system-tools-backends-1.4.2/platform.pl.in system-tools-backends-1.4.2/platform.pl.in
213 --- /var/tmp/clean/system-tools-backends-1.4.2/platform.pl.in 2006-01-02 15:32:34.000000000 +0000
214 +++ system-tools-backends-1.4.2/platform.pl.in 2006-03-13 10:14:56.152576000 +0000
219 + "solaris-2.11" => "Solaris Nevada / Open Solaris",
220 + "nexenta-1.0" => "Nexenta GNU/Solaris 1.0 Ellate",
221 "debian-2.2" => "Debian GNU/Linux 2.2 Potato",
222 "debian-3.0" => "Debian GNU/Linux 3.0 Woody",
223 "debian-sarge" => "Debian GNU/Linux Sarge",
225 ("Debian" => "debian"),
226 ("Mandrake" => "mandrake"),
227 ("Conectiva" => "conectiva"),
228 - ("Blackpanther" => "blackpanther");
229 + ("Blackpanther" => "blackpanther"),
230 + ("gnu_solaris" => "nexenta");
232 # gst_prefix not required here: parse already does that for us.
233 $dist = lc (&gst_parse_sh ("/etc/lsb-release", "DISTRIB_ID"));
235 chomp ($dist = <$fd>);
236 &gst_file_close ($fd);
238 - if ($dist =~ /^5\.(\d)/) { return "solaris-2.$1" }
239 - else { if ($dist =~ /^([78])\.\d/) { return "solaris-$1.0" } }
241 + if (-f "$gst_prefix/etc/debian_version") { return check_lsb() }
243 + if ($dist =~ /^5\.(\d+)/) { return "solaris-2.$1" }
248 sub gst_platform_get_system
250 diff -u system-tools-backends-1.4.2/debug.pl.in-orig1 system-tools-backends-1.4.2/debug.pl.in
251 --- system-tools-backends-1.4.2/debug.pl.in-orig1 2003-09-14 22:51:49.000000000 +0100
252 +++ system-tools-backends-1.4.2/debug.pl.in 2006-10-25 15:50:50.847482000 +0100
254 @buff = split ("\n", $doc);
255 foreach $line (@buff)
257 - print $fd "$line\n";
258 + if ($line =~ /<password>/)
260 + print $fd "<!-- suppress line containing password -->\n";
264 + print $fd "$line\n";
270 diff -u system-tools-backends-1.4.2/xml.pl.in-orig system-tools-backends-1.4.2/xml.pl.in
271 --- system-tools-backends-1.4.2/xml.pl.in-orig 2005-06-28 18:47:27.000000000 +0100
272 +++ system-tools-backends-1.4.2/xml.pl.in 2006-09-06 10:10:25.634899000 +0100
278 + $doc = $file; # XXX - This results in the filename being output to in.xml, why would we want this?
284 diff -u system-tools-backends-1.4.2/report.pl.in-orig1 system-tools-backends-1.4.2/report.pl.in
285 --- system-tools-backends-1.4.2/report.pl.in-orig1 2004-04-21 18:26:10.000000000 +0100
286 +++ system-tools-backends-1.4.2/report.pl.in 2006-10-26 10:43:46.341952000 +0100
288 "file_run_pipe_failed" => ["warn", "Failed to pipe command [%s] for reading."],
289 "file_run_pipe_success" => ["info", "Piping command [%s] for reading."],
290 "file_run" => ["info", "Running command [%s]."],
291 + "file_run_exec_failed" => ["info", "Running command failed with reason %s."],
292 + "file_run_exit_code" => ["info", "Running command exited with %d exit code."],
293 "file_create_path" => ["info", "Directory [%s] created."],
294 "file_backup_rotate" => ["info", "Backup directory [%s] was rotated."],
295 "file_backup_success" => ["info", "Saved backup for [%s]."],