@@ -532,11 +532,28 @@ function install_package()
532532
533533 # If defined add the boards manager URL to preferences
534534 if [[ " $packageURL " != " " ]]; then
535+ # Get the current Additional Boards Manager URLs preference value so it won't be overwritten when the new URL is added
536+ local priorBoardsmanagerAdditionalURLs
537+ if [[ " $ARDUINO_CI_SCRIPT_VERBOSITY_LEVEL " -eq 0 ]]; then
538+ priorBoardsmanagerAdditionalURLs=$( " ${ARDUINO_CI_SCRIPT_APPLICATION_FOLDER} /${ARDUINO_CI_SCRIPT_IDE_INSTALLATION_FOLDER} /${ARDUINO_CI_SCRIPT_ARDUINO_COMMAND} " --get-pref boardsmanager.additional.urls 2> /dev/null | tail --lines=1)
539+ elif [[ " $ARDUINO_CI_SCRIPT_VERBOSITY_LEVEL " -eq 1 ]]; then
540+ priorBoardsmanagerAdditionalURLs=$( " ${ARDUINO_CI_SCRIPT_APPLICATION_FOLDER} /${ARDUINO_CI_SCRIPT_IDE_INSTALLATION_FOLDER} /${ARDUINO_CI_SCRIPT_ARDUINO_COMMAND} " --get-pref boardsmanager.additional.urls | tail --lines=1)
541+ else
542+ priorBoardsmanagerAdditionalURLs=$( " ${ARDUINO_CI_SCRIPT_APPLICATION_FOLDER} /${ARDUINO_CI_SCRIPT_IDE_INSTALLATION_FOLDER} /${ARDUINO_CI_SCRIPT_ARDUINO_COMMAND} " --get-pref boardsmanager.additional.urls | tee /dev/tty | tail --lines=1)
543+ fi
544+ local -r blankregex=" ^[ ]*$"
545+ if [[ " $priorBoardsmanagerAdditionalURLs " =~ $blankregex ]]; then
546+ # There is no previous Additional Boards Manager URLs preference value
547+ local boardsmanagerAdditionalURLs=" $packageURL "
548+ else
549+ # There is a previous Additional Boards Manager URLs preference value so append the new one to the end of it
550+ local boardsmanagerAdditionalURLs=" ${priorBoardsmanagerAdditionalURLs} ,${packageURL} "
551+ fi
535552
536553 # grep returns 1 when a line matches the regular expression so it's necessary to unset errexit
537554 set +o errexit
538555 # shellcheck disable=SC2086
539- eval \" ${ARDUINO_CI_SCRIPT_APPLICATION_FOLDER} /${ARDUINO_CI_SCRIPT_IDE_INSTALLATION_FOLDER} /${ARDUINO_CI_SCRIPT_ARDUINO_COMMAND} \" --pref boardsmanager.additional.urls=" $packageURL " --save-prefs " $ARDUINO_CI_SCRIPT_VERBOSITY_REDIRECT " | tr -Cd ' [:print:]\n\t' | grep --extended-regexp --invert-match " $ARDUINO_CI_SCRIPT_ARDUINO_OUTPUT_FILTER_REGEX " ; local -r arduinoPreferenceSettingExitStatus=" ${PIPESTATUS[0]} "
556+ eval \" ${ARDUINO_CI_SCRIPT_APPLICATION_FOLDER} /${ARDUINO_CI_SCRIPT_IDE_INSTALLATION_FOLDER} /${ARDUINO_CI_SCRIPT_ARDUINO_COMMAND} \" --pref boardsmanager.additional.urls=" $boardsmanagerAdditionalURLs " --save-prefs " $ARDUINO_CI_SCRIPT_VERBOSITY_REDIRECT " | tr -Cd ' [:print:]\n\t' | grep --extended-regexp --invert-match " $ARDUINO_CI_SCRIPT_ARDUINO_OUTPUT_FILTER_REGEX " ; local -r arduinoPreferenceSettingExitStatus=" ${PIPESTATUS[0]} "
540557 set -o errexit
541558 # this is required because otherwise the exit status of arduino is ignored
542559 if [[ " $arduinoPreferenceSettingExitStatus " != " $ARDUINO_CI_SCRIPT_SUCCESS_EXIT_STATUS " ]]; then
0 commit comments