I had these modules listed as being owned by me, but they are really owned by
wangke, correcting.
diff -u system-tools-backends-1.4.2/file.pl.in-orig1 system-tools-backends-1.4.2/file.pl.in
--- system-tools-backends-1.4.2/file.pl.in-orig1 2005-11-04 15:49:36.000000000 +0000
+++ system-tools-backends-1.4.2/file.pl.in 2006-10-26 11:51:42.154832000 +0100
@@ -43,6 +43,7 @@
$GST_FILE_READ = 1;
$GST_FILE_WRITE = 2;
+$gst_file_last_run_stderr_str = "";
# --- File operations --- #
@@ -50,6 +51,10 @@
sub gst_file_get_base_path
{
my $path = "/var/cache/setup-tool-backends";
+ # Need to check using @build_os@ configure substution incase platform is not
+ # yet determined.
+ $path = "/var/spool/setup-tool-backends" if ($$tool{"platform"} =~ /solaris-.*/ || "@build_os@" =~ /solaris.*/);
+ &gst_file_create_path($path) unless ( -d $path );
chmod (0755, $path);
return $path;
}
@@ -57,18 +62,33 @@
sub gst_file_get_tmp_path
{
+ # Need to check using @build_os@ configure substution incase platform is not
+ # yet determined.
+ if ($$tool{"platform"} =~ /solaris-.*/ || "@build_os@" =~ /solaris.*/) {
+ my $path = "/var/run/setup-tool-backends/tmp";
+ &gst_file_create_path($path, 0700) unless ( -d $path );
+ chmod (0700, $path);
+ return ($path);
+ }
return (&gst_file_get_base_path () . "/tmp");
}
-
sub gst_file_get_backup_path
{
return (&gst_file_get_base_path () . "/backup");
}
-
sub gst_file_get_debug_path
{
+ # Need to check using @build_os@ configure substution incase platform is not
+ # yet determined.
+ if ($$tool{"platform"} =~ /solaris-.*/ || "@build_os@" =~ /solaris.*/) {
+ my $path = "/var/run/setup-tool-backends/debug";
+ &gst_file_create_path($path, 0700) unless ( -d $path );
+
+ chmod (0700, $path);
+ return ($path);
+ }
return (&gst_file_get_base_path (). "/debug");
}
@@ -76,6 +96,7 @@
sub gst_file_get_data_path
{
my $path = &gst_file_get_base_path (). "/data";
+ &gst_file_create_path($path) unless ( -d $path );
chmod (0755, $path);
return $path;
}
@@ -105,7 +126,7 @@
my ($cmd) = @_;
my $command = &get_cmd_path ($cmd);
- return ("LC_ALL=C PATH=\$PATH:/sbin:/usr/sbin $command 2> /dev/null");
+ return ("LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/sbin:\$PATH $command 2> /dev/null");
}
# necessary for some programs that output info through stderr
@@ -114,7 +135,7 @@
my ($cmd) = @_;
my $command = &get_cmd_path ($cmd);
- return ("LC_ALL=C PATH=\$PATH:/sbin:/usr/sbin $command 2>&1");
+ return ("LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/sbin:\$PATH $command 2>&1");
}
@@ -772,9 +793,25 @@
}
}
+sub gst_file_read_joined_lines
+{
+ my ($file) = @_;
+ my $buffer = &gst_file_buffer_load ($file);
+ &gst_file_buffer_join_lines ($buffer);
+ $$buffer[0] =~ s/\n//; $$buffer[0] =~ s/\\//;
+ return $$buffer[0];
+}
# --- Command-line utilities --- #
+#
+# Provide acces to the stderr of the last command that ran
+#
+sub gst_file_get_error_str
+{
+ return $gst_file_last_run_stderr_str;
+}
+
# &gst_file_run (<command line>)
#
@@ -789,20 +826,54 @@
sub gst_file_run
{
my ($cmd, $background) = @_;
- my ($command, $tool_name, $tool_path, @argline);
+ my ($command, $tool_name, $tool_path, @argline, $stderr_str);
&gst_report_enter ();
- $command = &gst_file_get_cmd_path ($cmd);
- return -1 if $command == -1;
- $command .= " > /dev/null";
- $command .= " &" if $background;
+ if ( $background ) {
+ $command = &gst_file_get_cmd_path ($cmd);
+ return -1 if $command == -1;
+
+ $command .= " > /dev/null";
+ $command .= " &" if $background;
+ }
+ else {
+ $command = &gst_file_get_cmd_path_with_stderr ($cmd);
+ return -1 if $command == -1;
+
+ # Trap stderr, but not stdout - done using "2>&1 1>/dev/null"
+ $command .= " 1> /dev/null";
+ }
+
&gst_report ("file_run", $command);
+
+ # See if we can give more information rather than silently failing.
+ if ( $background ) {
+ $stderr_str = ""; # Can't get this if command is backgrounded
+ my $retval = system ($command);
+ }
+ else {
+ $stderr_str = readpipe( $command );
+ $retval = $?;
+ }
+ if ( $retval == -1 ) {
+ &gst_report ("file_run_exec_failed", $! );
+ }
+ else {
+ # As documented in perlfunc, divide by 256.
+ $retval = $retval / 256
+ &gst_report ("file_run_exit_code", $retval );
+ if ( $retval != 0 ) {
+ $gst_file_last_run_stderr_str = $stderr_str; # Remember the stderr of the last run command.
+ &gst_debug_print_indented_string( 2, "Command wrote the following to stderr: \n" );
+ &gst_debug_print_indented_string( 4, $stderr_str . "\n" );
+ }
+ }
+
&gst_report_leave ();
- # As documented in perlfunc, divide by 256.
- return (system ($command) / 256);
+ return ($retval);
}
sub gst_file_run_bg
@@ -829,6 +900,8 @@
my $found = "";
my @user_paths;
+ return "" if $tool eq undef;
+
# We don't search absolute paths. Arturo.
if ($tool =~ /^\//)
{
diff -ru /var/tmp/clean/system-tools-backends-1.4.2/partition.pl.in system-tools-backends-1.4.2/partition.pl.in
--- /var/tmp/clean/system-tools-backends-1.4.2/partition.pl.in 2004-11-05 17:03:26.000000000 +0000
+++ system-tools-backends-1.4.2/partition.pl.in 2006-03-13 10:14:56.152216000 +0000
@@ -86,6 +86,17 @@
},
);
+sub gst_partition_scan_sunos_info
+{
+ my ($fd, $line);
+ my (%hash);
+ my (@table);
+
+ $hash{"partition"} = \@table;
+
+ return \%hash;
+}
+
sub gst_partition_scan_freebsd_info
{
my ($fd, $line);
@@ -192,6 +203,7 @@
return &gst_partition_scan_linux_info if ($plat eq "Linux");
return &gst_partition_scan_freebsd_info if ($plat eq "FreeBSD");
+ return &gst_partition_scan_sunos_info if ($plat eq "SunOS");
}
%GST_FILESYS_TYPES =
diff -ru /var/tmp/clean/system-tools-backends-1.4.2/platform.pl.in system-tools-backends-1.4.2/platform.pl.in
--- /var/tmp/clean/system-tools-backends-1.4.2/platform.pl.in 2006-01-02 15:32:34.000000000 +0000
+++ system-tools-backends-1.4.2/platform.pl.in 2006-03-13 10:14:56.152576000 +0000
@@ -38,6 +38,8 @@
$PLATFORM_INFO = {
+ "solaris-2.11" => "Solaris Nevada / Open Solaris",
+ "nexenta-1.0" => "Nexenta GNU/Solaris 1.0 Ellate",
"debian-2.2" => "Debian GNU/Linux 2.2 Potato",
"debian-3.0" => "Debian GNU/Linux 3.0 Woody",
"debian-sarge" => "Debian GNU/Linux Sarge",
@@ -110,7 +112,8 @@
("Debian" => "debian"),
("Mandrake" => "mandrake"),
("Conectiva" => "conectiva"),
- ("Blackpanther" => "blackpanther");
+ ("Blackpanther" => "blackpanther"),
+ ("gnu_solaris" => "nexenta");
# gst_prefix not required here: parse already does that for us.
$dist = lc (&gst_parse_sh ("/etc/lsb-release", "DISTRIB_ID"));
@@ -528,9 +531,11 @@
chomp ($dist = <$fd>);
&gst_file_close ($fd);
- if ($dist =~ /^5\.(\d)/) { return "solaris-2.$1" }
- else { if ($dist =~ /^([78])\.\d/) { return "solaris-$1.0" } }
- return -1;
+ if (-f "$gst_prefix/etc/debian_version") { return check_lsb() }
+ else {
+ if ($dist =~ /^5\.(\d+)/) { return "solaris-2.$1" }
+ else { return -1 }
+ }
}
sub gst_platform_get_system
diff -u system-tools-backends-1.4.2/debug.pl.in-orig1 system-tools-backends-1.4.2/debug.pl.in
--- system-tools-backends-1.4.2/debug.pl.in-orig1 2003-09-14 22:51:49.000000000 +0100
+++ system-tools-backends-1.4.2/debug.pl.in 2006-10-25 15:50:50.847482000 +0100
@@ -83,7 +83,14 @@
@buff = split ("\n", $doc);
foreach $line (@buff)
{
- print $fd "$line\n";
+ if ($line =~ /<password>/)
+ {
+ print $fd "<!-- suppress line containing password -->\n";
+ }
+ else
+ {
+ print $fd "$line\n";
+ }
}
}
diff -u system-tools-backends-1.4.2/xml.pl.in-orig system-tools-backends-1.4.2/xml.pl.in
--- system-tools-backends-1.4.2/xml.pl.in-orig 2005-06-28 18:47:27.000000000 +0100
+++ system-tools-backends-1.4.2/xml.pl.in 2006-09-06 10:10:25.634899000 +0100
@@ -542,7 +542,7 @@
}
elsif ($file)
{
- $doc = $file;
+ $doc = $file; # XXX - This results in the filename being output to in.xml, why would we want this?
}
else
{
diff -u system-tools-backends-1.4.2/report.pl.in-orig1 system-tools-backends-1.4.2/report.pl.in
--- system-tools-backends-1.4.2/report.pl.in-orig1 2004-04-21 18:26:10.000000000 +0100
+++ system-tools-backends-1.4.2/report.pl.in 2006-10-26 10:43:46.341952000 +0100
@@ -265,6 +265,8 @@
"file_run_pipe_failed" => ["warn", "Failed to pipe command [%s] for reading."],
"file_run_pipe_success" => ["info", "Piping command [%s] for reading."],
"file_run" => ["info", "Running command [%s]."],
+ "file_run_exec_failed" => ["info", "Running command failed with reason %s."],
+ "file_run_exit_code" => ["info", "Running command exited with %d exit code."],
"file_create_path" => ["info", "Directory [%s] created."],
"file_backup_rotate" => ["info", "Backup directory [%s] was rotated."],
"file_backup_success" => ["info", "Saved backup for [%s]."],