63 lines
2.1 KiB
Bash
Executable file
63 lines
2.1 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#
|
|
# Copyright (c) 2024 Scott Duensing, scott@kangaroopunch.com
|
|
#
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
# of this software and associated documentation files (the "Software"), to deal
|
|
# in the Software without restriction, including without limitation the rights
|
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
# copies of the Software, and to permit persons to whom the Software is
|
|
# furnished to do so, subject to the following conditions:
|
|
#
|
|
# The above copyright notice and this permission notice shall be included in
|
|
# all copies or substantial portions of the Software.
|
|
#
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
# SOFTWARE.
|
|
#
|
|
|
|
#
|
|
# This script is intended for use on Linux and MacOS.
|
|
#
|
|
|
|
|
|
SCRIPT_PATH="${BASH_SOURCE}"
|
|
while [ -L "${SCRIPT_PATH}" ]; do
|
|
SCRIPT_DIR="$(cd -P "$(dirname "${SCRIPT_PATH}")" >/dev/null 2>&1 && pwd)"
|
|
SCRIPT_PATH="$(readlink "${SCRIPT_PATH}")"
|
|
[[ ${SCRIPT_PATH} != /* ]] && SCRIPT_PATH="${SCRIPT_DIR}/${SCRIPT_PATH}"
|
|
done
|
|
SCRIPT_PATH="$(readlink -f "${SCRIPT_PATH}")"
|
|
SCRIPT_DIR="$(cd -P "$(dirname -- "${SCRIPT_PATH}")" >/dev/null 2>&1 && pwd)"
|
|
|
|
ROOT=${SCRIPT_DIR}
|
|
|
|
if [[ -z ${1} ]]; then
|
|
echo "No project folder provided."
|
|
exit 1
|
|
fi
|
|
|
|
PYTHON=$(which python)
|
|
if [[ $? == 1 ]]; then
|
|
PYTHON=$(which python3)
|
|
if [[ $? == 1 ]]; then
|
|
echo "Unable to find Python 3.x. Exiting."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
PROJECT="$(cd "$(dirname "$1")"; pwd)/$(basename "$1")"
|
|
NAME=$(basename ${PROJECT})
|
|
if [[ ! -f "${PROJECT}/${NAME}.pgz" ]]; then
|
|
echo "No PGZ found."
|
|
exit 1
|
|
fi
|
|
|
|
${PYTHON} "${ROOT}/FoenixMgr/FoenixMgr/fnxmgr.py" --boot FLASH
|
|
${PYTHON} "${ROOT}/FoenixMgr/FoenixMgr/fnxmgr.py" --run-pgz "${PROJECT}/${NAME}.pgz"
|