download_and_compile.sh: add safety net in _cleanup()
Make sure $INSTALL_DIR is really a harmless 'install' directory before calling 'rm -rf' on it.
This commit is contained in:
parent
3099633675
commit
9f710a8c84
1 changed files with 8 additions and 2 deletions
|
@ -218,8 +218,14 @@ function _cleanup(){
|
|||
fgdata_moved=1
|
||||
fi
|
||||
|
||||
_printLog "Deleting install directories ($INSTALL_DIR)..."
|
||||
rm -rf "$INSTALL_DIR"
|
||||
if [[ "$(basename "$INSTALL_DIR")" -eq "install" ]]; then
|
||||
_printLog "Deleting install directories ($INSTALL_DIR)..."
|
||||
rm -rf "$INSTALL_DIR"
|
||||
else
|
||||
_printLog "${PROGNAME}: unexpected value for \$INSTALL_DIR: '$INSTALL_DIR'."
|
||||
_printLog "Refusing to recursively delete it. Aborting; please report."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $fgdata_moved -eq 1 ]]; then
|
||||
mkdir -p "$INSTALL_DIR_FGFS"
|
||||
|
|
Loading…
Reference in a new issue