Loading sdk/run.sh +15 −8 Original line number Diff line number Diff line #!/bin/bash set -euo pipefail sources="hello.cpp" headers="" outfile="hello" outfile="miphoto-exec" usage=$(echo -e "Usage: run.sh [OPTIONS] \n\t-b\tbuild \n\t-r\tcopy to camera and run \n\t-d DIR\tdirectory with .cpp and .h files") build=false run=false usage=$(echo -e "Usage: run.sh [OPTIONS] \n\t-b build \n\t-r copy to camera and run") dir="." if [ $# -eq 0 ]; then echo "$usage" exit 1 fi while getopts "br" opt; do while getopts "brd:" opt; do case ${opt} in b ) build=true ;; r ) run=true ;; \? ) echo "$usage" d ) dir="$OPTARG" ;; \? ) echo "$usage"; exit 1; ;; esac done [ "$build" = true -o "$run" = true ] || (echo "You must specify one of the '-rb' options" && exit 1) if [ "$build" = true ] ; then sources=$(ls "$dir/"*.cpp 2>/dev/null) || (echo "No .cpp files found" && exit 1) headers=$(ls "$dir/"*.h 2>/dev/null) || true sudo docker build -t mi_camera_sdk . sudo docker run -it --rm -v "$PWD":/workdir mi_camera_sdk bash -c "cp $sources $headers /tmp && arm-linux-gnueabihf-c++ -o /workdir/$outfile $sources" sudo docker run -it --rm -v "$PWD":/workdir mi_camera_sdk bash -c "arm-linux-gnueabihf-c++ -o /workdir/$outfile $sources" echo -e "\n" fi Loading Loading
sdk/run.sh +15 −8 Original line number Diff line number Diff line #!/bin/bash set -euo pipefail sources="hello.cpp" headers="" outfile="hello" outfile="miphoto-exec" usage=$(echo -e "Usage: run.sh [OPTIONS] \n\t-b\tbuild \n\t-r\tcopy to camera and run \n\t-d DIR\tdirectory with .cpp and .h files") build=false run=false usage=$(echo -e "Usage: run.sh [OPTIONS] \n\t-b build \n\t-r copy to camera and run") dir="." if [ $# -eq 0 ]; then echo "$usage" exit 1 fi while getopts "br" opt; do while getopts "brd:" opt; do case ${opt} in b ) build=true ;; r ) run=true ;; \? ) echo "$usage" d ) dir="$OPTARG" ;; \? ) echo "$usage"; exit 1; ;; esac done [ "$build" = true -o "$run" = true ] || (echo "You must specify one of the '-rb' options" && exit 1) if [ "$build" = true ] ; then sources=$(ls "$dir/"*.cpp 2>/dev/null) || (echo "No .cpp files found" && exit 1) headers=$(ls "$dir/"*.h 2>/dev/null) || true sudo docker build -t mi_camera_sdk . sudo docker run -it --rm -v "$PWD":/workdir mi_camera_sdk bash -c "cp $sources $headers /tmp && arm-linux-gnueabihf-c++ -o /workdir/$outfile $sources" sudo docker run -it --rm -v "$PWD":/workdir mi_camera_sdk bash -c "arm-linux-gnueabihf-c++ -o /workdir/$outfile $sources" echo -e "\n" fi Loading