download_and_compile.sh: no component and only --cleanup -> only do cleanup

If --cleanup is used and no component has been specified on the command
line, run the cleanup routine but don't process any component: no
download, no compilation, no installation. Previously(*), this used to
process the default set of components: SIMGEAR FGFS and DATA.

Therefore, if all you want to do is to remove compiled and installed
files, you can now run:

  download_and_compile.sh --cleanup

(*) During less than 24 hours, as --cleanup was added yesterday.
This commit is contained in:
Florent Rougon 2020-06-30 15:01:40 +02:00
parent aa563cb5cb
commit 25d9d717b5

View File

@ -838,7 +838,9 @@ function _usage() {
echo " -d y|n y=fetch programs from the Internet (Git, svn, etc.), n=don't default=y" echo " -d y|n y=fetch programs from the Internet (Git, svn, etc.), n=don't default=y"
echo " --cleanup Remove all build and installation directories. Try this if a" echo " --cleanup Remove all build and installation directories. Try this if a"
echo ' compilation fails and the "base directory" was not "fresh" when' echo ' compilation fails and the "base directory" was not "fresh" when'
echo " you started ${PROGNAME}." echo " you started ${PROGNAME}. If this option is given and no"
echo " component has been specified on the command line, then only the"
echo " cleanup routine is run."
echo " --git-clone-default-proto=PROTO default=https" echo " --git-clone-default-proto=PROTO default=https"
echo " default protocol to use for 'git clone' (https, git or ssh)" echo " default protocol to use for 'git clone' (https, git or ssh)"
echo " --git-clone-site-params=SITE=PROTOCOL[:USERNAME]" echo " --git-clone-site-params=SITE=PROTOCOL[:USERNAME]"
@ -1123,7 +1125,7 @@ done
declare -a WHATTOBUILD=() declare -a WHATTOBUILD=()
if [[ $# == 0 ]] || _elementIn ALL "$@"; then if [[ $# == 0 && "$CLEANUP" == "n" ]] || _elementIn ALL "$@"; then
WHATTOBUILD=( "${WHATTOBUILDALL[@]}" ) WHATTOBUILD=( "${WHATTOBUILDALL[@]}" )
else else
WHATTOBUILD=( "$@" ) WHATTOBUILD=( "$@" )
@ -1142,19 +1144,23 @@ if [ "$OPENRTI" = "OPENRTI" ]; then
WHATTOBUILD+=( "OPENRTI" ) WHATTOBUILD+=( "OPENRTI" )
fi fi
_determineProtocolAndUsernameForEachComponentRepository _startLog "$0 $*"
# The following is skipped when only running the “cleanup” routine.
if [[ ${#WHATTOBUILD[@]} -gt 0 ]]; then
# Warn about compilation time and size (idea from Jester); give a hint about # Warn about compilation time and size (idea from Jester); give a hint about
# the -j option. # the -j option.
_displayGeneralAdvice _displayGeneralAdvice
_startLog "$0 $*" _determineProtocolAndUsernameForEachComponentRepository
_maybe_add_intercomponent_deps # this may add elements to WHATTOBUILD _maybe_add_intercomponent_deps # this may add elements to WHATTOBUILD
# Among others, this asks "Are you sure you want to continue?" if the user # Among other things, this asks “Are you sure you want to continue?” if the
# chose 'next' and compilation_log.txt wasn't present when the script was # user chose 'next', $LOGFILE wasn't present when the script was started and
# started. # the --non-interactive option wasn't specified.
_describeSelectedSuite _describeSelectedSuite
_showBranchForEachComponent _showBranchForEachComponent
_logSep _logSep
_installOrUpdateDistroPackages _installOrUpdateDistroPackages
fi
####################################################### #######################################################
####################################################### #######################################################
@ -1824,9 +1830,12 @@ if [[ ${#UNMATCHED_OPTIONAL_PKG_ALTERNATIVES[@]} -gt 0 ]]; then
_printLog "This could explain missing optional features in FlightGear" \ _printLog "This could explain missing optional features in FlightGear" \
"or other software" "or other software"
_printLog "installed by $PROGNAME." _printLog "installed by $PROGNAME."
else elif [[ ${#WHATTOBUILD[@]} -gt 0 ]]; then
_printLog "All optional package alternatives have found a matching package." _printLog "All optional package alternatives have found a matching package."
# else we were only running the “cleanup” routine
fi fi
if [[ ${#WHATTOBUILD[@]} -gt 0 ]]; then
_printLog _printLog
fi
_printLog "$PROGNAME has finished to work." _printLog "$PROGNAME has finished to work."