download_and_compile.sh: minor changes

Consistent indentation for _printLog() vs. other functions, safety
measures for arguments possibly containing spaces, etc.
This commit is contained in:
Florent Rougon 2018-10-11 12:45:01 +02:00
parent 141bb7dec4
commit d424cdaad3

View File

@ -61,6 +61,10 @@ function _log(){
echo "$@" >> "$LOGFILE" echo "$@" >> "$LOGFILE"
} }
function _logSep(){
_log "***********************************"
}
function _printLog(){ function _printLog(){
# Possible special case for the terminal: echo "${PROGNAME}: $@" # Possible special case for the terminal: echo "${PROGNAME}: $@"
# That would be more precise but rather verbose, and not all output uses # That would be more precise but rather verbose, and not all output uses
@ -84,10 +88,6 @@ function _logOutput(){
esac esac
} }
function _logSep(){
echo "***********************************" >> $LOGFILE
}
function _aptUpdate(){ function _aptUpdate(){
echo "Asking password for 'apt-get update'..." echo "Asking password for 'apt-get update'..."
sudo apt-get update sudo apt-get update
@ -540,7 +540,7 @@ echo "**************************************"
####################################################### #######################################################
####################################################### #######################################################
echo $0 $* > $LOGFILE echo "$0 $*" > "$LOGFILE"
_log "VERSION=$VERSION" _log "VERSION=$VERSION"
_log "APT_GET_UPDATE=$APT_GET_UPDATE" _log "APT_GET_UPDATE=$APT_GET_UPDATE"
_log "DOWNLOAD_PACKAGES=$DOWNLOAD_PACKAGES" _log "DOWNLOAD_PACKAGES=$DOWNLOAD_PACKAGES"
@ -619,12 +619,12 @@ fi
####################################################### #######################################################
CBD=$(pwd) CBD=$(pwd)
LOGFILE=$CBD/$LOGFILE LOGFILE="$CBD/$LOGFILE"
_log "DIRECTORY=$CBD" _log "DIRECTORY=$CBD"
_logSep _logSep
mkdir -p install mkdir -p install
SUB_INSTALL_DIR=install SUB_INSTALL_DIR=install
INSTALL_DIR=$CBD/$SUB_INSTALL_DIR INSTALL_DIR="$CBD/$SUB_INSTALL_DIR"
cd "$CBD" cd "$CBD"
mkdir -p build mkdir -p build