Revision 1678f270 setup.sh
| setup.sh | ||
|---|---|---|
| 1 | 1 |
################################################################################ |
| 2 | 2 |
# AMiRo-OS is an operating system designed for the Autonomous Mini Robot # |
| 3 | 3 |
# (AMiRo) platform. # |
| 4 |
# Copyright (C) 2016..2018 Thomas Schöpping et al. #
|
|
| 4 |
# Copyright (C) 2016..2019 Thomas Schöpping et al. #
|
|
| 5 | 5 |
# # |
| 6 | 6 |
# This program is free software: you can redistribute it and/or modify # |
| 7 | 7 |
# it under the terms of the GNU General Public License as published by # |
| ... | ... | |
| 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 |
################################################################################ |
| ... | ... | |
| 281 | 315 |
printf "# #\n" |
| 282 | 316 |
printf "######################################################################\n" |
| 283 | 317 |
printf "# #\n" |
| 284 |
printf "# Copyright (c) 2016..2018 Thomas Schöpping #\n"
|
|
| 318 |
printf "# Copyright (c) 2016..2019 Thomas Schöpping #\n"
|
|
| 285 | 319 |
printf "# #\n" |
| 286 | 320 |
printf "# This is free software; see the source for copying conditions. #\n" |
| 287 | 321 |
printf "# There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR #\n" |
Also available in: Unified diff