distribution/tools/foreach
fewtarius f3de7f8024
* Add make docs option to Makefile.
* Fix missing uae4arm.
2023-07-15 15:28:28 +00:00

31 lines
859 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}
if [ ! "$?" = "0" ]
then
echo "Command failed, aborting."
exit 1
fi
done
done
done
unset PROJECT DEVICE ARCH