Revision 57cbd1cd

View differences:

bootloader/bootloadersetup.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
################################################################################
......
329 363
#                 Warning: Arborted by user.
330 364
#             -1
331 365
#                 Error: Unexpected user input.
366
#             -2
367
#                 Error: Missing dependencies.
332 368
#
333 369
function initAmiroBlt {
334 370
  printInfo "initializing AMiRo-BLT submodule...\n"
......
354 390
    esac
355 391
  fi
356 392

  
393
  # check dependencies
394
  checkCommands git
395
  if [ $? -ne 0 ]; then
396
    printError "Missing dependencies detected.\n"
397
    return -2
398
  fi
399

  
357 400
  # initialize submodule to default branch
358 401
  cd $bootloaderdir
359 402
  git submodule update --init $amirobltdir 2>&1 | tee -a $LOG_FILE
......
412 455
#
413 456
# usage:      wipeAmiroBlt
414 457
# arguments:  n/a
415
# return:     n/a
458
# return:     0
459
#                 No error or warning occurred.
460
#             1
461
#                 Warning: AMiRo-BLT Git submodule already empty
462
#             2
463
#                 Warning: Aborted by user.
464
#             -1
465
#                 Error: Unexpected input occurred
466
#             -2
467
#                 Error: Missing dependencies.
468
#
416 469
function wipeAmiroBlt {
417 470
  printInfo "reset and wipe Git submodule $amirobltdir\n"
418 471
  local userdir=$(pwd)
419 472
  local bootloaderdir=$(dirname $(realpath ${BASH_SOURCE[0]}))
420 473
  local amirobltdir=${bootloaderdir}/AMiRo-BLT
421 474

  
475
  # check dependencies
476
  checkCommands git
477
  if [ $? -ne 0 ]; then
478
    printError "Missing dependencies detected.\n"
479
    return -2
480
  fi
481

  
422 482
  # if the AMiRo-BLT folder is empty
423 483
  if [ -z "$(ls -A $amirobltdir)" ]; then
424 484
    printWarning "$amirobltdir is already empty\n"
kernel/kernelsetup.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: Aborted by user.
334 368
#             -1
335 369
#                 Error: Unexpected user input.
370
#             -1
371
#                 Error: Missing dependency.
336 372
#
337 373
function initChibiOS {
338 374
  printInfo "initializing ChibiOS submodule...\n"
......
358 394
    esac
359 395
  fi
360 396

  
397
  # check dependencies
398
  checkCommands git
399
  if [ $? -ne 0 ]; then
400
    printError "Missing dependencies detected.\n"
401
    return -2
402
  fi
403

  
361 404
  # initialize submodule to default branch
362 405
  cd $kerneldir
363 406
  git submodule update --init $chibiosdir 2>&1 | tee -a $LOG_FILE
......
403 446
  local chibiosdir=${kerneldir}/ChibiOS
404 447
  local git_branch_patched="AMiRo-OS"
405 448

  
449
  # check dependencies
450
  checkCommands git
451
  if [ $? -ne 0 ]; then
452
    printError "Missing dependencies detected.\n"
453
    return -2
454
  fi
455

  
406 456
  # if the ChibiOS folder is empty
407 457
  if [ -z "$(ls -A $chibiosdir)" ]; then
408 458
    printWarning "$chibiosdir is empty. Please initialize first.\n"
......
615 665
  local chibiosdir=${kerneldir}/ChibiOS
616 666
  local git_branch_patched="AMiRo-OS"
617 667

  
668
  # check dependencies
669
  checkCommands git
670
  if [ $? -ne 0 ]; then
671
    printError "Missing dependencies detected.\n"
672
    return -2
673
  fi
674

  
618 675
  # if the ChibiOS folder is empty
619 676
  if [ -z "$(ls -A $chibiosdir)" ]; then
620 677
    printInfo "$chibiosdir is alread empty\n"
periphery-lld/peripherylldsetup.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
################################################################################
......
327 361
#                 Warning: Arborted by user.
328 362
#             -1
329 363
#                 Error: Unexpected user input.
364
#             -2
365
#                 Error: Missing dependencies.
330 366
#
331 367
function initAmiroLld {
332 368
  printInfo "initializing AMiRo-LLD submodule...\n"
......
352 388
    esac
353 389
  fi
354 390

  
391
  # check dependencies
392
  checkCommands git
393
  if [ $? -ne 0 ]; then
394
    printError "Missing dependencies detected.\n"
395
    return -2
396
  fi
397

  
355 398
  # initialize submodule to default branch
356 399
  cd $peripheryllddir
357 400
  git submodule update --init $amirollddir 2>&1 | tee -a $LOG_FILE
......
381 424
#
382 425
# usage:      wipeAmiroLld
383 426
# arguments:  n/a
384
# return:     n/a
427
# return:     0
428
#                 No error or warning occurred.
429
#             1
430
#                 Warning: AMiRo-LLD Git submodule already empty
431
#             2
432
#                 Warning: Aborted by user.
433
#             -1
434
#                 Error: Unexpected input occurred.
435
#             -2
436
#                 Error: Missing dependencies.
437
#
385 438
function wipeAmiroLld {
386 439
  printInfo "reset and wipe Git submodule $amirollddir\n"
387 440
  local userdir=$(pwd)
388 441
  local peripheryllddir=$(dirname $(realpath ${BASH_SOURCE[0]}))
389 442
  local amirollddir=${peripheryllddir}/AMiRo-LLD
390 443

  
444
  # check dependencies
445
  checkCommands git
446
  if [ $? -ne 0 ]; then
447
    printError "Missing dependencies detected.\n"
448
    return -2
449
  fi
450

  
391 451
  # if the AMiRo-LLD folder is empty
392 452
  if [ -z "$(ls -A $amirollddir)" ]; then
393 453
    printWarning "$amirollddir is already empty\n"
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
################################################################################
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
################################################################################
......
418 452
#                 The specified <module> could not be found.
419 453
#             -3
420 454
#                 Parsing the project for the specified module failed.
455
#             -4
456
#                 Missing dependencies.
421 457
#
422 458
function createModuleProject {
423 459
  local userdir=$(pwd)
......
430 466
  local outvar=""
431 467
  local gccoutvar=""
432 468

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

  
433 476
  # parse arguments
434 477
  local otherargs=()
435 478
  while [ $# -gt 0 ]; do
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