- assigned_to: nobody --> pramath
In our project, I wrote a UserExit script to do some
configuration. When the script encounter some
exceptions, it returned a non-zero error code. I hope
systemconfig can handle the return code and enter into
SIS buybox shell. But I found systemconfigurator did
not handle the return code. It always return a zero
whatever UserExit script return.
I have probed into the source code
of /usr/bin/systemconfigurator
and /usr/lib/systemconfig/UserExit.pm:
In /usr/lib/systemconfig/UserExit.pm, the relative
lines are:
sub setup {
my $config = shift;
my %userexits = $config->varlist("^
(root|userexit)");
# compile the list of user exits
my @exitnames = ();
foreach my $key (sort keys %userexits) {
if($key =~ /^(userexit\d+)_cmd$/ and
$userexits{$key}) {
push @exitnames, $1;
}
}
foreach my $exit (@exitnames) {
if(!my_system($userexits{root}, $userexits
{"$exit" . "_cmd"}, $userexits{"$exit" . "_params"})) {
carp("Couldn't run " . $userexits
{"$exit" . "_cmd"} . " " . $userexits
{"$exit" . "_params"});
return 0;
}
return 1;
}
In /usr/bin/systemconfigurator, the relative lines are:
if($config->configuserexit()) {
UserExit::setup($config);
}
When post_script does NOT work properly, UserExit.pm
returns 0. Systemconfigurator gets this returned 0,
BUT it does NOT process this return value.