From fb95345a70a89592b63e9a97a9ab74f14454a227 Mon Sep 17 00:00:00 2001 From: petrnovota Date: Mon, 15 Jul 2024 11:17:03 +0200 Subject: [PATCH 1/7] Install Homebrew and Git only if not installed already --- docs/source/_static/install_dependencies.sh | 30 ++++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/docs/source/_static/install_dependencies.sh b/docs/source/_static/install_dependencies.sh index 7298def5f..d635153b8 100755 --- a/docs/source/_static/install_dependencies.sh +++ b/docs/source/_static/install_dependencies.sh @@ -155,16 +155,26 @@ lookup_debian_version_number() { } if [[ $(uname) == "Darwin" ]]; then - echo "During Homebrew install, certain commands need 'sudo'. Requesting access..." - sudo true - homebrew_install_url="https://raw.githubusercontent.com/Homebrew/install/master/install.sh" - print_action "Installing Homebrew from $homebrew_install_url" - # CI=1 will skip some interactive prompts - CI=1 /bin/bash -c "$(curl -fsSL $homebrew_install_url)" - print_and_exec brew install git - echo - echo "=== Installed successfully! IMPORTANT: For changes to take effect," - echo "please close and reopen the terminal window, or run: exec \$SHELL" + if ! command -v brew &> /dev/null; then + echo "During Homebrew install, certain commands need 'sudo'. Requesting access..." + sudo true + homebrew_install_url="https://raw.githubusercontent.com/Homebrew/install/master/install.sh" + print_action "Installing Homebrew from $homebrew_install_url" + # CI=1 will skip some interactive prompts + CI=1 /bin/bash -c "$(curl -fsSL $homebrew_install_url)" + echo + echo "=== Installed successfully! IMPORTANT: For changes to take effect," + echo "please close and reopen the terminal window, or run: exec \$SHELL" + else + echo "Homebrew is already installed." + fi + + if ! command -v git &> /dev/null; then + echo "Git not found, installing using Homebrew..." + print_and_exec brew install git + else + echo "Git Already installed.." + fi elif [ -f /etc/os-release ]; then source /etc/os-release From b932a8796f4bb094f9487b4f87e2af0ea79e92e7 Mon Sep 17 00:00:00 2001 From: petrnovota Date: Mon, 15 Jul 2024 11:19:09 +0200 Subject: [PATCH 2/7] Don't just update the Brew --- docs/source/_static/install_depthai.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/source/_static/install_depthai.sh b/docs/source/_static/install_depthai.sh index e36ee888a..f470c77d0 100755 --- a/docs/source/_static/install_depthai.sh +++ b/docs/source/_static/install_depthai.sh @@ -127,9 +127,6 @@ if [[ $(uname -s) == "Darwin" ]]; then echo "Installing global dependencies." bash -c "$(curl -fL https://docs.luxonis.com/install_dependencies.sh)" - echo "Upgrading brew." - brew update - # clone depthai form git if [ -d "$DEPTHAI_DIR" ]; then echo "Demo app already downloaded. Checking out main and updating." From e4da54a3115497e2b92bbdae8cb0e3045da20691 Mon Sep 17 00:00:00 2001 From: petrnovota Date: Mon, 15 Jul 2024 11:19:42 +0200 Subject: [PATCH 3/7] Don't just update the Brew --- docs/source/_static/install_depthai.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/source/_static/install_depthai.sh b/docs/source/_static/install_depthai.sh index f470c77d0..a7a50bc17 100755 --- a/docs/source/_static/install_depthai.sh +++ b/docs/source/_static/install_depthai.sh @@ -139,8 +139,6 @@ if [[ $(uname -s) == "Darwin" ]]; then git checkout main git pull - # install python 3.10 and python dependencies - brew update if [ "$install_python" == "true" ]; then echo "installing python 3.10" From a390cbd61ce6fc1b7bee60b3fa9dae029f07f0bc Mon Sep 17 00:00:00 2001 From: petrnovota Date: Mon, 15 Jul 2024 11:20:57 +0200 Subject: [PATCH 4/7] PyQt5 is already available for m1, no need for woraround --- docs/source/_static/install_depthai.sh | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/docs/source/_static/install_depthai.sh b/docs/source/_static/install_depthai.sh index a7a50bc17..9698d5e00 100755 --- a/docs/source/_static/install_depthai.sh +++ b/docs/source/_static/install_depthai.sh @@ -146,11 +146,6 @@ if [[ $(uname -s) == "Darwin" ]]; then python_executable=$(which python3.10) fi - # pip does not have pyqt5 for arm - if [[ $(uname -m) == 'arm64' ]]; then - echo "Installing pyqt5 with homebrew." - brew install pyqt@5 - fi # create python virtual environment echo "Creating python virtual environment in $VENV_DIR" @@ -161,18 +156,7 @@ if [[ $(uname -s) == "Darwin" ]]; then python -m pip install --upgrade pip # install launcher dependencies - # only on mac silicon point PYTHONPATH to pyqt5 installation via homebrew, otherwise install pyqt5 with pip - if [[ $(uname -m) == 'arm64' ]]; then - if [[ ":$PYTHONPATH:" == *":/opt/homebrew/lib/python3.10/site-packages:"* ]]; then - echo "/opt/homebrew/lib/python$nr_1.$nr_2/site-packages already in PYTHONPATH" - else - export "PYTHONPATH=/opt/homebrew/lib/python$nr_1.$nr_2/site-packages:"$PYTHONPATH - echo "/opt/homebrew/lib/pythonv$nr_1.$nr_2/site-packages added to PYTHONPATH" - fi - else - pip install pyqt5 - fi - + pip install pyqt5 pip install packaging elif [[ $(uname -s) == "Linux" ]]; then From 24ba6f3f34d9f15a7035fc2ccb340c27ea335e8e Mon Sep 17 00:00:00 2001 From: petrnovota Date: Mon, 15 Jul 2024 11:26:30 +0200 Subject: [PATCH 5/7] improve the error message to find out easier which script failed --- docs/source/_static/install_depthai.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/_static/install_depthai.sh b/docs/source/_static/install_depthai.sh index 9698d5e00..f38c67749 100755 --- a/docs/source/_static/install_depthai.sh +++ b/docs/source/_static/install_depthai.sh @@ -7,7 +7,7 @@ mkdir "$WORKING_DIR" install_path="" path_correct="false" -trap 'RET=$? ; echo -e >&2 "\n\x1b[31mFailed installing dependencies. Could be a bug in the installer or unsupported platform. Open a bug report over at https://github.com/luxonis/depthai - exited with status $RET at line $LINENO \x1b[0m\n" ; exit $RET' ERR +trap 'RET=$? ; echo -e >&2 "\n\x1b[31mFailed installing depthai. Could be a bug in the installer or unsupported platform. Open a bug report over at https://github.com/luxonis/depthai - exited with status $RET at line $LINENO \x1b[0m\n" ; exit $RET' ERR while [ "$path_correct" = "false" ] do From b9c465e4d8f905ee31d95d4e5dfb993ee4e612a1 Mon Sep 17 00:00:00 2001 From: Han Bui Date: Thu, 22 Aug 2024 14:59:12 +0200 Subject: [PATCH 6/7] Add user consent prompt for crash reporting --- docs/source/_static/install_depthai.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/docs/source/_static/install_depthai.sh b/docs/source/_static/install_depthai.sh index f38c67749..76480bec1 100755 --- a/docs/source/_static/install_depthai.sh +++ b/docs/source/_static/install_depthai.sh @@ -109,6 +109,32 @@ BASHRC="$HOME/.bashrc" ZSHRC="$HOME/.zshrc" ADD_ENTRYPOINT_TO_PATH='export PATH=$PATH'":$ENTRYPOINT_DIR" +# Function to set crash reporting environment variable in shell configuration files +set_crash_reporting_env() { + local consent_value="$1" + local env_line="export DEPTHAI_ENABLE_FEEDBACK_CRASHDUMP=$consent_value" + + write_in_file "$env_line" "$BASHRC" + if [ -f "$ZSHRC" ]; then + write_in_file "$env_line" "$ZSHRC" + fi +} + +# Prompt for user consent to enable crash reporting +echo "" +echo "DepthAI can collect anonymous crash reports to help improve the software." +echo "Do you agree to enable crash reporting? (y/n)" +read -n 1 crash_report_consent < /dev/tty +echo "" + +if [[ "$crash_report_consent" == "y" || "$crash_report_consent" == "Y" ]]; then + echo "Crash reporting enabled." + set_crash_reporting_env "1" +else + echo "Crash reporting disabled." + set_crash_reporting_env "0" +fi + # add to .bashrc only if it is not in there already write_in_file "$COMMENT" "$BASHRC" write_in_file "$ADD_ENTRYPOINT_TO_PATH" "$BASHRC" From 648e056ffdfe4da74dfbbb50a97ddacf35b6dbac Mon Sep 17 00:00:00 2001 From: Han Bui Date: Thu, 22 Aug 2024 18:34:08 +0200 Subject: [PATCH 7/7] updated env vars --- docs/source/_static/install_depthai.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/_static/install_depthai.sh b/docs/source/_static/install_depthai.sh index 76480bec1..4dab117bd 100755 --- a/docs/source/_static/install_depthai.sh +++ b/docs/source/_static/install_depthai.sh @@ -112,7 +112,7 @@ ADD_ENTRYPOINT_TO_PATH='export PATH=$PATH'":$ENTRYPOINT_DIR" # Function to set crash reporting environment variable in shell configuration files set_crash_reporting_env() { local consent_value="$1" - local env_line="export DEPTHAI_ENABLE_FEEDBACK_CRASHDUMP=$consent_value" + local env_line="export DEPTHAI_ENABLE_ANALYTICS_COLLECTION=$consent_value" write_in_file "$env_line" "$BASHRC" if [ -f "$ZSHRC" ]; then