1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
|
#!/usr/bin/env perl
#-*- Mode: perl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
# /* Functions for on-the-fly commentary on a tool's work. */
#
# Copyright (C) 2000-2001 Ximian, Inc.
#
# Authors: Hans Petter Jansson <hpj@ximian.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Library General Public License as published
# by the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
require "___scriptsdir___/general.pl";
require "___scriptsdir___/gettext.pl";
# --- Progress printing --- #
$xst_progress_current = 0; # Compat with old $progress_max use.
$xst_progress_last_percentage = 0;
sub xst_progress
{
my $prc = $_[0];
# /* Don't go backwards. */
$prc = $xst_progress_last_percentage if ($prc < $xst_progress_last_percentage);
# /* Don't go above 99%. */
$prc = 99 if ($prc >= 100);
if ($xst_progress && (int $prc > int $xst_progress_last_percentage))
{
&xst_report ("progress", $prc);
$xst_progress_last_percentage = $prc;
}
}
sub xst_progress_begin
{
&xst_progress (0);
}
sub xst_progress_end
{
&xst_progress (99);
}
sub xst_print_progress # Compat with old $progress_max use.
{
my $prc;
$xst_progress_current++;
&xst_progress (($xst_progress_current * 100) / $progress_max);
}
# --- Report printing --- #
sub xst_report_set_threshold
{
$xst_report_threshold = $_[0];
}
sub xst_report_enter
{
# This has been trivialized because it is not working
# correctly at the moment and is causing some trouble.
# /* We'll probably replace this with something smarter */
# (like a detail-level value in the report hash)
# when the report strings are used at the gui-level again.
# $xst_report_level ++;
$xst_report_level = 0;
}
sub xst_report_leave
{
# $xst_report_level --;
$xst_report_level = 0;
}
$xst_report_level = 0;
$xst_report_started = 0;
sub xst_report
{
my ($key, @args) = @_;
my ($mayor, $minor, $str, $format, $res);
&xst_debug_print_line ("Non-existing report key $key") if !exists $xst_report_message{$key};
($mayor, $str) = @{$xst_report_message{$key}};
$xst_report_started = 1 if !$xst_report_started && $key eq "begin" && $mayor eq "sys";
# Verbose (--verbose) output is human-readable only.
$format = "$str\n";
$res = sprintf ($format, @args);
print STDERR "$xst_name - ${key}::$res" if $xst_do_verbose || $mayor eq "error";
if ($key ne "progress")
{
return if ($xst_report_level >= $xst_report_threshold || !$xst_report_started);
}
# Report (--report) output is machine-readable.
if ($xst_do_report)
{
print STDOUT join ("::", $key, $str, @args) . "\n";
}
&xst_debug_print_indented_string ($xst_report_level, "report $key: $res");
}
# This disables reporting.
&xst_report_set_threshold (0);
&textdomain ("ximian-setup-tools");
%xst_report_message =
(
"begin" => ["sys", _("Start of work report.")],
"end" => ["sys", _("End of work report.")],
"progress" => ["sys", _("%d")],
"compat" => ["info", _("%s.")],
"directive_unsup" => ["error", _("Directive [%s] not supported.")],
"directive_invalid" => ["error", _("Directive [%s] structure has wrong format.")],
"directive_badargs" => ["error", _("Directive [%s] requires exactly [%s] args in [%s].")],
"directive_lowargs" => ["error", _("Directive [%s] requires at least [%s] args in [%s].")],
"platform_list" => ["sys", _("Supported: [%s]")],
"platform_unsup" => ["error", _("Your platform [%s] is not supported.")],
"platform_undet" => ["error", _("Unable to determine host platform.")],
"platform_success" => ["sys", _("Configuring for platform [%s].")],
"platform_no_table" => ["error", _("No parse/replace table for platform [%s].")],
"xml_unexp_tag" => ["error", _("Unexpected tag [%s].")],
"xml_unexp_arg" => ["error", _("Unexpected argument [%s] to tag [%s].")],
"file_open_read_failed" => ["warn", _("Could not open [%s] for reading.")],
"file_open_read_success" => ["info", _("Reading options from [%s].")],
"file_open_write_failed" => ["error", _("Failed to write to [%s].")],
"file_open_write_create" => ["warn", _("Could not find [%s] for writing. Creating [%s].")],
"file_open_write_success" => ["info", _("Writing to [%s].")],
"file_create_path" => ["info", _("Directory [%s] created.")],
"file_backup_rotate" => ["info", _("Backup directory [%s] was rotated.")],
"file_backup_success" => ["info", _("Saved backup for [%s].")],
"file_open_filter_failed" => ["warn", _("No file to patch: [%s].")],
"file_open_filter_create" => ["warn", _("Could not find [%s] for patching. Creating [%s].")],
"file_open_filter_success" => ["info", _("Found [%s]. Patching [%s].")],
"file_buffer_load" => ["info", _("Loading file [%s] to buffer.")],
"file_buffer_save" => ["info", _("Saving buffer to file [%s].")],
"file_run" => ["info", _("Running command [%s].")],
"file_remove" => ["info", _("Removing file [%s].")],
"file_locate_tool_success" => ["info", _("Found tool [%s].")],
"file_locate_tool_failed" => ["warn", _("Couldn't find tool [%s].")],
"parse_table" => ["info", _("Parsing option [%s].")],
"parse_trivial" => ["info", _("Trivialy passing [%s].")],
"parse_split" => ["info", _("Getting option [%s] from [%s].")],
"parse_split_hash" => ["info", _("Getting configuration from [%s].")],
"parse_split_hash_cont" => ["info", _("Getting configuration from [%s].")],
"parse_sh" => ["info", _("Getting shell option [%s] from [%s].")],
"parse_kw" => ["info", _("Getting keyword [%s] from [%s].")],
"parse_line_first" => ["info", _("Getting information from [%s].")],
"parse_chat" => ["info", _("Getting chat information from [%s].")],
"parse_ini" => ["info", _("Getting option [%s] from [%s], section [%s].")],
"parse_ifaces_str" => ["info", _("Getting option [%s] from interface [%s].")],
"parse_ifaces_kw" => ["info", _("Getting keyword [%s] from interface [%s].")],
"parse_ifaces_kw_strange" => ["warn", _("Keyword for interface [%s] in [%s] had unexpected value.")],
"replace_split" => ["info", _("Replacing key [%s] in [%s].")],
"replace_sh" => ["info", _("Replacing shell var [%s] in [%s].")],
"replace_kw" => ["info", _("Replacing keyword [%s] in [%s].")],
"replace_line_first" => ["info", _("Replacing contents of file [%s].")],
"replace_chat" => ["info", _("Replacing values in [%s].")],
"replace_ini" => ["info", _("Replacing variable [%s] in section [%s] of [%s].")],
"replace_del_ini_sect" => ["info", _("Removing section [%s] from [%s].")],
"replace_ifaces_str" => ["info", _("Replacing option [%s] from interface [%s].")],
"replace_ifaces_kw" => ["info", _("Replacing keyword [%s] from interface [%s].")],
"service_status_running" => ["info", _("Service [%s] is running.")],
"service_status_stopped" => ["info", _("Service [%s] is stopped.")],
"service_sysv_not_found" => ["warn", _("Could not find SystemV scripts for service [%s].")],
"service_sysv_no_runlevel" => ["warn", _("Could not find SystemV runlevel [%s] directory [%s].")],
"service_sysv_remove_link" => ["info", _("Removed SystemV link [%s].")],
"service_sysv_add_link" => ["info", _("Created SystemV link [%s].")],
"service_sysv_op_unk" => ["error", _("Unknown initd operation [%s].")],
"service_sysv_op_success" => ["info", _("Service [%s] %s.")],
"service_sysv_op_failed" => ["warn", _("Service [%s] cound not be %s.")],
"network_dialing_get" => ["info", _("Loading ISP configurations.")],
"network_iface_active_get" => ["info", _("Finding active interfaces.")],
"network_iface_is_active" => ["info", _("Checking if interface [%s] is active.")],
"network_hostname_set" => ["info", _("Setting hostname to [%s].")],
"network_dialing_set" => ["info", _("Saving ISP configurations.")],
"network_remove_pap" => ["info", _("Removing entry [%s] from [%s].")],
"network_iface_set" => ["info", _("Configuring interface [%s].")],
"network_iface_activate" => ["info", _("Activating interface [%s].")],
"network_iface_deactivate" => ["info", _("Deactivating interface [%s].")],
"network_ifaces_set" => ["info", _("Setting up interfaces.")],
"network_get_pap_passwd" => ["info", _("Getting PAP/CHAP password for [%s] from [%s].")],
"network_get_ppp_option" => ["info", _("Getting option [%s] from [%s].")],
"network_set_ppp_option" => ["info", _("Setting option [%s] in [%s].")],
"network_set_ppp_connect" => ["info", _("Setting connect option in [%s].")],
"network_get_ppp_unsup" => ["info", _("Getting additional options from [%s].")],
"network_set_ppp_unsup" => ["info", _("Setting additional options in [%s].")],
"network_bootproto_unsup" => ["warn", _("Boot method [%s] for interface [%s] not supported.")],
"network_get_remote" => ["info", _("Getting remote address for interface [%s].")],
"network_set_remote" => ["info", _("Setting remote address for interface [%s].")],
"network_ensure_lo" => ["info", _("Ensuring loopback interface configuration.")],
"boot_lilo_failed" => ["warn", _("Failed to run lilo.")],
"boot_lilo_success" => ["info", _("Succesfully executed lilo.")],
"disks_fstab_add" => ["info", _("Adding [%s] to fstab.")],
"disks_partition_probe" => ["info", _("Looking for partitions on [%s].")],
"disks_size_query" => ["info", _("Querying size of [%s].")],
"disks_mount" => ["info", _("Mounting [%s].")],
"disks_umount" => ["info", _("Unmounting [%s].")],
"disks_mount_error" => ["error", _("Could not find mount tools. No mounting done.")],
"memory_swap_found" => ["info", _("Found swap entry [%s].")],
"memory_swap_probe" => ["info", _("Looking for swap entries.")],
"print_no_printtool" => ["warn", _("No printtool setup in directory [%s].")],
"time_timezone_scan" => ["info", _("Scanning timezones.")],
"time_timezone_cmp" => ["info", _("Scanning timezones: [%s].")],
"time_timezone_set" => ["info", _("Setting timezone as [%s].")],
"time_localtime_set" => ["info", _("Setting local time as [%s].")],
"users_getting_db" => ["info", _("Getting user database.")]
);
1;
|