Skip to content

Commit f4d6dbf

Browse files
committed
Improved bootstrap run script.
Separate variable declaration from assignment to not mask exit status of subshell. Signed-off-by: kilo52 <[email protected]>
1 parent 3565761 commit f4d6dbf

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

bootstrap/install.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ function confirm_action() {
144144
#
145145
function is_installed() {
146146
# First, see if the corresponding command is available.
147-
local cmd_path="$(command -v $INSTALL_BIN_NAME)";
147+
local cmd_path;
148+
cmd_path="$(command -v $INSTALL_BIN_NAME)";
148149
if [ -n "$cmd_path" ]; then
149150
FOUND_INSTALLATION="$cmd_path";
150151
return 0;
@@ -213,7 +214,8 @@ function install_project_init() {
213214
return 1;
214215
fi
215216
# Sanity check: Downloaded file has shebang
216-
local first_line="$(head -n 1 $install_file_name_tmp)";
217+
local first_line;
218+
first_line="$(head -n 1 $install_file_name_tmp)";
217219
if [[ "$first_line" != "#!/bin/bash" ]]; then
218220
echo "ERROR: Failed to download resources. Unexpected shebang";
219221
rm "$install_file_name_tmp" &> /dev/null; # Cleanup
@@ -227,7 +229,8 @@ function install_project_init() {
227229
return 1;
228230
fi
229231
# Set owner and group
230-
local _user="$(whoami)";
232+
local _user;
233+
_user="$(whoami)";
231234
if ! chown "${_user}":"${_user}" "$install_resource"; then
232235
echo "ERROR: Failed to set owner of resource '${install_resource}'";
233236
if [[ $pi_updated == false ]]; then

0 commit comments

Comments
 (0)