From e763790464563755d176ba798d40cb7c74f0d094 Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Mon, 15 Jun 2020 01:42:10 +0100 Subject: Configure script now accounts for non-interactive shells The project configuration requires a build-directory at configuration time, two other directories can optionally be given to avoid downloading the project's necessary data and software. It is possible to give these three directories as command-line options, or by interactively giving them after running the configure script. Until now, when these directories weren't given as command-line options, and the running shell was non-interactive, the configure script would crash on the line trying to interactively read the user's given directories (the 'read' command). With this commit, all the 'read' commands for these three directories are now put within an 'if' statement. Therefore, when 'read' fails (the shell is non-interactive), instead of a quiet crash, a descriptive message is printed, telling the user that cause of the problem, and suggesting a fix. This bug was found by Michael R. Crusoe. --- reproduce/software/shell/configure.sh | 39 +++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) (limited to 'reproduce/software') diff --git a/reproduce/software/shell/configure.sh b/reproduce/software/shell/configure.sh index d9509ca..b71ea96 100755 --- a/reproduce/software/shell/configure.sh +++ b/reproduce/software/shell/configure.sh @@ -712,7 +712,14 @@ EOF do # Ask the user (if not already set on the command-line). if [ x"$build_dir" = x ]; then - read -p"Please enter the top build directory: " build_dir + if read -p"Please enter the top build directory: " build_dir; then + just_a_place_holder_to_avoid_not_equal_test=1; + else + echo "ERROR: shell is in non-interactive-mode and no build directory specified." + echo "The build directory (described above) is mandatory, configuration can't continue." + echo "Please use '--build-dir' to specify a build directory non-interactively." + exit 1 + fi fi # If it exists, see if we can write in it. If not, try making it. @@ -782,6 +789,7 @@ if [ x"$input_dir" = x ]; then else indir=$input_dir fi +noninteractive_sleep=2 if [ $rewritepconfig = yes ] && [ x"$input_dir" = x ]; then cat <