From be2bb2b27d61a39bff6efd890c3d519c39db321e Mon Sep 17 00:00:00 2001 From: J Pipkin Date: Sat, 12 Jan 2013 04:14:03 -0600 Subject: implement failure-dependent exit statuses, ask to proceed if a failure is encountered during the process --- sboinstall | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'sboinstall') diff --git a/sboinstall b/sboinstall index 56e682e..454489c 100755 --- a/sboinstall +++ b/sboinstall @@ -64,7 +64,7 @@ GetOptions( show_usage and exit 0 if $help; show_version and exit 0 if $vers; -show_usage and exit 0 unless exists $ARGV[0]; +show_usage and exit 1 unless exists $ARGV[0]; $noclean = $noclean eq 'TRUE' ? 1 : 0; $distclean = $distclean eq 'TRUE' ? 1 : 0; @@ -162,7 +162,7 @@ unless ($non_int) { exit 0 unless =~ /^[Yy\n]/; } -my $failures = process_sbos( +my ($failures, $exit) = process_sbos( TODO => $build_queue, CMDS => \%commands, OPTS => \%options, @@ -171,7 +171,12 @@ my $failures = process_sbos( NOINSTALL => $no_install, NOCLEAN => $noclean, DISTCLEAN => $distclean, + NON_INT => $non_int, ); print_failures($failures); -exit keys %$failures > 0 ? 1 : 0; +if ($exit) { + exit $exit; +} else { + exit 0; +} -- cgit v1.2.3 From e95685f4330b20cc660c69b803c3ce90f33bc430 Mon Sep 17 00:00:00 2001 From: J Pipkin Date: Sat, 12 Jan 2013 04:58:23 -0600 Subject: resolve items marked TODO --- sboinstall | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'sboinstall') diff --git a/sboinstall b/sboinstall index 454489c..6bff012 100755 --- a/sboinstall +++ b/sboinstall @@ -130,7 +130,11 @@ FIRST: for my $sbo (@$build_queue) { if ($compat32) { unless ($sbo ~~ @$inst_names) { say "$name requires $sbo."; - my ($cmds, $opts) = user_prompt($sbo, $locations{$sbo}); + my ($cmds, $opts, $exit) = user_prompt($sbo, $locations{$sbo}); + if ($exit) { + warn "Unable to open README for $sbo.\n"; + exit $exit; + } if ($cmds) { next FIRST if $cmds eq 'N'; } @@ -140,7 +144,11 @@ FIRST: for my $sbo (@$build_queue) { say "$sbo$added"; } } - my ($cmds, $opts) = user_prompt($name, $locations{$name}); + my ($cmds, $opts, $exit) = user_prompt($name, $locations{$name}); + if ($exit) { + warn "Unable to open README for $name.\n"; + exit $exit; + } if ($cmds) { next FIRST if $cmds eq 'N'; } -- cgit v1.2.3