Revision fad4c1e7

View differences:

setup.sh
263 263
  return 0
264 264
}
265 265

  
266
### check whether commands are available #######################################
267
# Checks whether the specified commands are available and can be executed.
268
#
269
# usage:      checkCommand [<command> <command> ...]
270
# arguments:  <command>
271
#                 Name of the command to check.
272
# return:     0
273
#                 All requested commands are available.
274
#             >0
275
#                 Number of requested commands that were not found.
276
#             -1
277
#                 No argument given.
278
#
279
function checkCommands {
280
  local status=0
281

  
282
  # return if no argument was specified
283
  if [ $# -eq 0 ]; then
284
    return -1
285
  fi
286

  
287
  # check all specified commands
288
  while [ $# -gt 0 ]; do
289
    command -v $1 &>/dev/null
290
    if [ $? -ne 0 ]; then
291
      printWarning "Command '$1' not available.\n"
292
      status=$((status + 1))
293
    fi
294
    shift 1
295
  done
296

  
297
  return $status
298
}
299

  
266 300
################################################################################
267 301
# SPECIFIC FUNCTIONS                                                           #
268 302
################################################################################
......
333 367
#                 Warning: Setup aborted by user.
334 368
#             -1
335 369
#                 Error: Unexpected user input.
370
#             -2
371
#                 Error: Missing dependecny.
336 372
#
337 373
function stm32flashSetup {
338 374
  local amirobltdir=$(dirname $(realpath ${BASH_SOURCE[0]}))
339 375
  local stm32flashdir=${amirobltdir}/Host/Source/stm32flash
340 376
  local userdir=$(pwd)
341 377

  
378
  # check dependencies
379
  checkCommands git make gcc g++
380
  if [ $? -ne 0 ]; then
381
    printError "Missing dependencies detected.\n"
382
    return -2
383
  fi
384

  
342 385
  # if the stm32flash folder is not empty
343 386
  if [ ! -z "$(ls -A $stm32flashdir)" ]; then
344 387
    printWarning "$stm32flashdir is not empty. Delete and reinitialize? [y/n]\n"
......
423 466
  local serialbootdir=${amirobltdir}/Host/Source/SerialBoot
424 467
  local userdir=$(pwd)
425 468

  
469
  # check dependencies
470
  checkCommands make cmake gcc g++
471
  if [ $? -ne 0 ]; then
472
    printError "Missing dependencies detected.\n"
473
    return -2
474
  fi
475

  
426 476
  # if a build folder already exists
427 477
  if [ -d "${serialbootdir}/build/" ]; then
428 478
    printWarning "SerialBoot has been built before. Delete and rebuild? [y/n]\n"
tools/compiler/GCC/gccsetup.sh
263 263
  return 0
264 264
}
265 265

  
266
### check whether commands are available #######################################
267
# Checks whether the specified commands are available and can be executed.
268
#
269
# usage:      checkCommand [<command> <command> ...]
270
# arguments:  <command>
271
#                 Name of the command to check.
272
# return:     0
273
#                 All requested commands are available.
274
#             >0
275
#                 Number of requested commands that were not found.
276
#             -1
277
#                 No argument given.
278
#
279
function checkCommands {
280
  local status=0
281

  
282
  # return if no argument was specified
283
  if [ $# -eq 0 ]; then
284
    return -1
285
  fi
286

  
287
  # check all specified commands
288
  while [ $# -gt 0 ]; do
289
    command -v $1 &>/dev/null
290
    if [ $? -ne 0 ]; then
291
      printWarning "Command '$1' not available.\n"
292
      status=$((status + 1))
293
    fi
294
    shift 1
295
  done
296

  
297
  return $status
298
}
299

  
266 300
################################################################################
267 301
# SPECIFIC FUNCTIONS                                                           #
268 302
################################################################################
tools/compiler/compilersetup.sh
263 263
  return 0
264 264
}
265 265

  
266
### check whether commands are available #######################################
267
# Checks whether the specified commands are available and can be executed.
268
#
269
# usage:      checkCommand [<command> <command> ...]
270
# arguments:  <command>
271
#                 Name of the command to check.
272
# return:     0
273
#                 All requested commands are available.
274
#             >0
275
#                 Number of requested commands that were not found.
276
#             -1
277
#                 No argument given.
278
#
279
function checkCommands {
280
  local status=0
281

  
282
  # return if no argument was specified
283
  if [ $# -eq 0 ]; then
284
    return -1
285
  fi
286

  
287
  # check all specified commands
288
  while [ $# -gt 0 ]; do
289
    command -v $1 &>/dev/null
290
    if [ $? -ne 0 ]; then
291
      printWarning "Command '$1' not available.\n"
292
      status=$((status + 1))
293
    fi
294
    shift 1
295
  done
296

  
297
  return $status
298
}
299

  
266 300
################################################################################
267 301
# SPECIFIC FUNCTIONS                                                           #
268 302
################################################################################
tools/ide/QtCreator/QtCreatorSetup.sh
263 263
  return 0
264 264
}
265 265

  
266
### check whether commands are available #######################################
267
# Checks whether the specified commands are available and can be executed.
268
#
269
# usage:      checkCommand [<command> <command> ...]
270
# arguments:  <command>
271
#                 Name of the command to check.
272
# return:     0
273
#                 All requested commands are available.
274
#             >0
275
#                 Number of requested commands that were not found.
276
#             -1
277
#                 No argument given.
278
#
279
function checkCommands {
280
  local status=0
281

  
282
  # return if no argument was specified
283
  if [ $# -eq 0 ]; then
284
    return -1
285
  fi
286

  
287
  # check all specified commands
288
  while [ $# -gt 0 ]; do
289
    command -v $1 &>/dev/null
290
    if [ $? -ne 0 ]; then
291
      printWarning "Command '$1' not available.\n"
292
      status=$((status + 1))
293
    fi
294
    shift 1
295
  done
296

  
297
  return $status
298
}
299

  
266 300
################################################################################
267 301
# SPECIFIC FUNCTIONS                                                           #
268 302
################################################################################
tools/ide/idesetup.sh
263 263
  return 0
264 264
}
265 265

  
266
### check whether commands are available #######################################
267
# Checks whether the specified commands are available and can be executed.
268
#
269
# usage:      checkCommand [<command> <command> ...]
270
# arguments:  <command>
271
#                 Name of the command to check.
272
# return:     0
273
#                 All requested commands are available.
274
#             >0
275
#                 Number of requested commands that were not found.
276
#             -1
277
#                 No argument given.
278
#
279
function checkCommands {
280
  local status=0
281

  
282
  # return if no argument was specified
283
  if [ $# -eq 0 ]; then
284
    return -1
285
  fi
286

  
287
  # check all specified commands
288
  while [ $# -gt 0 ]; do
289
    command -v $1 &>/dev/null
290
    if [ $? -ne 0 ]; then
291
      printWarning "Command '$1' not available.\n"
292
      status=$((status + 1))
293
    fi
294
    shift 1
295
  done
296

  
297
  return $status
298
}
299

  
266 300
################################################################################
267 301
# SPECIFIC FUNCTIONS                                                           #
268 302
################################################################################

Also available in: Unified diff