Revert "remove tsol from xorg-server"
[unleashed-userland.git] / components / system-tools-backends / patches / system-tools-backends-02-common.patch
blob4fa588c19cab5172eb61817aeff73d8b03679b29
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
4 @@ -43,6 +43,7 @@
5 $GST_FILE_READ = 1;
6 $GST_FILE_WRITE = 2;
8 +$gst_file_last_run_stderr_str = "";
10 # --- File operations --- #
12 @@ -50,6 +51,10 @@
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
17 + # yet determined.
18 + $path = "/var/spool/setup-tool-backends" if ($$tool{"platform"} =~ /solaris-.*/ || "@build_os@" =~ /solaris.*/);
19 + &gst_file_create_path($path) unless ( -d $path );
20 chmod (0755, $path);
21 return $path;
23 @@ -57,18 +62,33 @@
25 sub gst_file_get_tmp_path
27 + # Need to check using @build_os@ configure substution incase platform is not
28 + # yet determined.
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);
33 + return ($path);
34 + }
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
48 + # yet determined.
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);
54 + return ($path);
55 + }
56 return (&gst_file_get_base_path (). "/debug");
59 @@ -76,6 +96,7 @@
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 );
64 chmod (0755, $path);
65 return $path;
67 @@ -105,7 +126,7 @@
68 my ($cmd) = @_;
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
76 @@ -114,7 +135,7 @@
77 my ($cmd) = @_;
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");
85 @@ -772,9 +793,25 @@
89 +sub gst_file_read_joined_lines
91 + my ($file) = @_;
92 + my $buffer = &gst_file_buffer_load ($file);
93 + &gst_file_buffer_join_lines ($buffer);
94 + $$buffer[0] =~ s/\n//; $$buffer[0] =~ s/\\//;
95 + return $$buffer[0];
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 @@
112 sub gst_file_run
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;
131 + else {
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);
147 + else {
148 + $stderr_str = readpipe( $command );
149 + $retval = $?;
151 + if ( $retval == -1 ) {
152 + &gst_report ("file_run_exec_failed", $! );
154 + else {
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" );
163 + }
165 &gst_report_leave ();
167 - # As documented in perlfunc, divide by 256.
168 - return (system ($command) / 256);
169 + return ($retval);
172 sub gst_file_run_bg
173 @@ -829,6 +900,8 @@
174 my $found = "";
175 my @user_paths;
177 + return "" if $tool eq undef;
179 # We don't search absolute paths. Arturo.
180 if ($tool =~ /^\//)
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
186 @@ -86,6 +86,17 @@
190 +sub gst_partition_scan_sunos_info
192 + my ($fd, $line);
193 + my (%hash);
194 + my (@table);
196 + $hash{"partition"} = \@table;
198 + return \%hash;
201 sub gst_partition_scan_freebsd_info
203 my ($fd, $line);
204 @@ -192,6 +203,7 @@
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");
211 %GST_FILESYS_TYPES =
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
215 @@ -38,6 +38,8 @@
218 $PLATFORM_INFO = {
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",
224 @@ -110,7 +112,8 @@
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"));
234 @@ -528,9 +531,11 @@
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" } }
240 - return -1;
241 + if (-f "$gst_prefix/etc/debian_version") { return check_lsb() }
242 + else {
243 + if ($dist =~ /^5\.(\d+)/) { return "solaris-2.$1" }
244 + else { return -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
253 @@ -83,7 +83,14 @@
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";
262 + else
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
273 @@ -542,7 +542,7 @@
275 elsif ($file)
277 - $doc = $file;
278 + $doc = $file; # XXX - This results in the filename being output to in.xml, why would we want this?
280 else
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
287 @@ -265,6 +265,8 @@
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]."],