distribution/tools/foreach
fewtarius 38c5ad528f
* Adds better logging to autostart.
* Updates RK3326 documentation for amiberry.
* New dev tool - foreach.  Provides a mechanism to execute commands against all projects/devices/architectures to simplify iterating.
  * Usage: `./tools/foreach ./scripts/clean emulators`
2023-07-15 14:29:52 +00:00

26 lines
747 B
Bash
Executable file

#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2020-present Fewtarius
###
### A simple loop to allow running commands against all projects/devices/architectures.
###
COMMAND="$*"
for PROJECT in $(find projects/ -mindepth 1 -maxdepth 1 -type d)
do
export PROJECT="$(basename ${PROJECT})"
for DEVICE in $(find projects/${PROJECT}/devices/ -mindepth 1 -maxdepth 1 -type d)
do
export DEVICE="$(basename ${DEVICE})"
for ARCH in $(find projects/${PROJECT}/devices/${DEVICE}/linux -name linux* -type f)
do
export ARCH="$(basename ${ARCH} | awk 'BEGIN {FS="."} {print $2}')"
echo -e "\n${PROJECT}/${DEVICE}/${ARCH}: Run \`${COMMAND}\`"
${COMMAND}
done
done
done
unset PROJECT DEVICE ARCH