Switch from locally defining a "DIR" for every bin, to setting a global Kaleidoscope bin directory var

pull/932/head
Jesse Vincent 4 years ago
parent 660747c916
commit e96902a9df
No known key found for this signature in database
GPG Key ID: CC228463465E40BC

@ -657,6 +657,11 @@ fi
## - if there is only one argument, that's a command ## - if there is only one argument, that's a command
KALEIDOSCOPE_DIR="$(cd "$(dirname "$0")"/..; pwd)" KALEIDOSCOPE_DIR="$(cd "$(dirname "$0")"/..; pwd)"
# shellcheck disable=SC2034
KALEIDOSCOPE_BIN_DIR="${KALEIDOSCOPE_DIR}/bin/"
# shellcheck disable=SC2155 # shellcheck disable=SC2155
export SOURCEDIR="$(pwd)" export SOURCEDIR="$(pwd)"

@ -80,8 +80,7 @@ dump_arduino_prefs() {
find_device_port() { find_device_port() {
find_device_vid_pid find_device_vid_pid
DIR=$(dirname "$(readlink -f "$0")") DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-linux-udev"
DEVICE_PORT_PROBER="${DIR}/find-device-port-linux-udev"
if [[ "${DEVICE_PORT}" = "" ]]; then if [[ "${DEVICE_PORT}" = "" ]]; then
DEVICE_PORT="$(perl ${DEVICE_PORT_PROBER} ${VID} ${SKETCH_PID})" DEVICE_PORT="$(perl ${DEVICE_PORT_PROBER} ${VID} ${SKETCH_PID})"
else else
@ -97,9 +96,8 @@ reset_device_cmd() {
find_bootloader_ports() { find_bootloader_ports() {
find_device_vid_pid find_device_vid_pid
DIR=$(dirname "$(readlink -f "$0")")
BOOTLOADER_VID="${BOOTLOADER_VID:-${VID}}" BOOTLOADER_VID="${BOOTLOADER_VID:-${VID}}"
DEVICE_PORT_PROBER="${DIR}/find-device-port-linux-udev" DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-linux-udev"
if [[ "${DEVICE_PORT_BOOTLOADER}" = "" ]]; then if [[ "${DEVICE_PORT_BOOTLOADER}" = "" ]]; then
DEVICE_PORT_BOOTLOADER="$(perl ${DEVICE_PORT_PROBER} ${BOOTLOADER_VID} ${BOOTLOADER_PID})" DEVICE_PORT_BOOTLOADER="$(perl ${DEVICE_PORT_PROBER} ${BOOTLOADER_VID} ${BOOTLOADER_PID})"
else else
@ -113,8 +111,7 @@ MD5="md5sum"
if [ "${uname_S}" = "Darwin" ]; then if [ "${uname_S}" = "Darwin" ]; then
find_device_port() { find_device_port() {
DIR=$(dirname "$0") DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-macos"
DEVICE_PORT_PROBER="${DIR}/find-device-port-macos"
DEVICE_PORT="$(perl ${DEVICE_PORT_PROBER} ${VID} ${SKETCH_PID})" DEVICE_PORT="$(perl ${DEVICE_PORT_PROBER} ${VID} ${SKETCH_PID})"
} }
@ -130,9 +127,8 @@ if [ "${uname_S}" = "Darwin" ]; then
find_bootloader_ports() { find_bootloader_ports() {
find_device_vid_pid find_device_vid_pid
DIR=$(dirname "$0")
BOOTLOADER_VID="${BOOTLOADER_VID:-${VID}}" BOOTLOADER_VID="${BOOTLOADER_VID:-${VID}}"
DEVICE_PORT_PROBER="${DIR}/find-device-port-macos" DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-macos"
if [[ "${DEVICE_PORT_BOOTLOADER}" = "" ]]; then if [[ "${DEVICE_PORT_BOOTLOADER}" = "" ]]; then
DEVICE_PORT_BOOTLOADER="$(perl ${DEVICE_PORT_PROBER} ${BOOTLOADER_VID} ${BOOTLOADER_PID})" DEVICE_PORT_BOOTLOADER="$(perl ${DEVICE_PORT_PROBER} ${BOOTLOADER_VID} ${BOOTLOADER_PID})"
else else
@ -143,8 +139,7 @@ if [ "${uname_S}" = "Darwin" ]; then
elif [ "${uname_S}" = "FreeBSD" ]; then elif [ "${uname_S}" = "FreeBSD" ]; then
find_device_port() { find_device_port() {
DIR=$(dirname "$0") DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-freebsd"
DEVICE_PORT_PROBER="${DIR}/find-device-port-freebsd"
DEVICE_PORT="$(perl ${DEVICE_PORT_PROBER})" DEVICE_PORT="$(perl ${DEVICE_PORT_PROBER})"
} }
@ -161,8 +156,7 @@ elif [ "${uname_S}" = "FreeBSD" ]; then
ARDUINO_BUILDER="${ARDUINO_BUILDER:-/usr/local/bin/arduino-builder}" ARDUINO_BUILDER="${ARDUINO_BUILDER:-/usr/local/bin/arduino-builder}"
find_bootloader_ports() { find_bootloader_ports() {
DIR=$(dirname "$0") DEVICE_PORT_PROBER="${KALEIDOSCPE_BIN_DIR}/find-device-port-freebsd"
DEVICE_PORT_PROBER="${DIR}/find-device-port-freebsd"
DEVICE_PORT_BOOTLOADER="$(perl ${DEVICE_PORT_PROBER})" DEVICE_PORT_BOOTLOADER="$(perl ${DEVICE_PORT_PROBER})"
} }
@ -202,8 +196,7 @@ elif [ "${uname_O}" = "Cygwin" ]; then
find_device_port() { find_device_port() {
find_device_vid_pid find_device_vid_pid
DIR=$(dirname "$0") DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-windows.ps1"
DEVICE_PORT_PROBER="${DIR}/find-device-port-windows.ps1"
DEVICE_PORT="$(powershell -noprofile -executionpolicy bypass ${DEVICE_PORT_PROBER} ${VID} ${SKETCH_PID} -Format Cygwin)" DEVICE_PORT="$(powershell -noprofile -executionpolicy bypass ${DEVICE_PORT_PROBER} ${VID} ${SKETCH_PID} -Format Cygwin)"
DEVICE_COM_PORT="$(powershell -noprofile -executionpolicy bypass ${DEVICE_PORT_PROBER} ${VID} ${SKETCH_PID} -Format COM)" DEVICE_COM_PORT="$(powershell -noprofile -executionpolicy bypass ${DEVICE_PORT_PROBER} ${VID} ${SKETCH_PID} -Format COM)"
} }
@ -214,9 +207,8 @@ elif [ "${uname_O}" = "Cygwin" ]; then
find_bootloader_ports() { find_bootloader_ports() {
find_device_vid_pid find_device_vid_pid
DIR=$(dirname "$0")
BOOTLOADER_VID="${BOOTLOADER_VID:-${VID}}" BOOTLOADER_VID="${BOOTLOADER_VID:-${VID}}"
DEVICE_PORT_PROBER="${DIR}/find-device-port-windows.ps1" DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-windows.ps1"
DEVICE_PORT_BOOTLOADER="$(powershell -noprofile -executionpolicy bypass ${DEVICE_PORT_PROBER} ${BOOTLOADER_VID} ${BOOTLOADER_PID} -Format COM)" DEVICE_PORT_BOOTLOADER="$(powershell -noprofile -executionpolicy bypass ${DEVICE_PORT_PROBER} ${BOOTLOADER_VID} ${BOOTLOADER_PID} -Format COM)"
} }

Loading…
Cancel
Save