mirror of
https://github.com/bitwarden/self-host.git
synced 2026-06-29 06:45:46 +00:00
fix: only overwrite run.sh if successful response is received (#299)
This commit is contained in:
10
bitwarden.sh
10
bitwarden.sh
@@ -93,16 +93,20 @@ function downloadRunFile() {
|
||||
then
|
||||
mkdir $SCRIPTS_DIR
|
||||
fi
|
||||
run_file_status_code=$(curl -s -L -w "%{http_code}" -o $SCRIPTS_DIR/run.sh $RUN_SCRIPT_URL)
|
||||
|
||||
local tmp_script=$(mktemp)
|
||||
|
||||
run_file_status_code=$(curl -s -L -w "%{http_code}" -o $tmp_script $RUN_SCRIPT_URL)
|
||||
if echo "$run_file_status_code" | grep -q "^20[0-9]"
|
||||
then
|
||||
mv $tmp_script $SCRIPTS_DIR/run.sh
|
||||
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
|
||||
cat $tmp_script
|
||||
rm -f $tmp_script
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user