crops-yocto/run_crops.sh

33 lines
658 B
Bash
Raw Normal View History

2024-03-01 23:15:01 +01:00
#!/bin/sh
2024-03-22 01:42:58 +01:00
# source: https://gist.github.com/mickey-happygolucky/2b9671f062de558f3312f7378ed3c240
2024-03-01 23:15:01 +01:00
BUILD_DIR=build
usage_exit() {
echo "run_crops.sh [-b build] [commands]"
echo " -b: a build directory of poky"
exit 0
}
while getopts b:h OPT
do
case ${OPT} in
b) BUILD_DIR=${OPTARG}
;;
h) usage_exit
;;
\?) usage_exit
;;
esac
done
shift $((OPTIND - 1))
echo "BUILD_DIR =" "${BUILD_DIR}"
cmd="source $(pwd)/poky/oe-init-build-env ${BUILD_DIR}"
if [ $# -gt 0 ] ; then
cmd="${cmd} && $*"
fi
docker run --rm -it -v "$(pwd)":"$(pwd)" crops/poky --workdir="$(pwd)" bash -c "${cmd}"