Skip to content

Commit

Permalink
Add check for run file download failure (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
vin01 authored Jan 30, 2023
1 parent 87718ca commit 5ce80e7
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions bitwarden.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,18 @@ function downloadRunFile() {
then
mkdir $SCRIPTS_DIR
fi
curl -L -s -o $SCRIPTS_DIR/run.sh $RUN_SCRIPT_URL
chmod u+x $SCRIPTS_DIR/run.sh
rm -f $SCRIPTS_DIR/install.sh
run_file_status_code=$(curl -s -L -w "%{http_code}" -o $SCRIPTS_DIR/run.sh $RUN_SCRIPT_URL)
if echo "$run_file_status_code" | grep -q "^20[0-9]"
then
chmod u+x $SCRIPTS_DIR/run.sh
rm -f $SCRIPTS_DIR/install.sh
else
echo "Unable to download run script from $RUN_SCRIPT_URL. Received status code: $run_file_status_code"
echo "http response:"
cat $SCRIPTS_DIR/run.sh
rm -f $SCRIPTS_DIR/run.sh
exit 1
fi
}

function checkOutputDirExists() {
Expand Down

0 comments on commit 5ce80e7

Please sign in to comment.