From 570bbc3f8a65d30e46cc5b22d94a7db4b96c399f Mon Sep 17 00:00:00 2001 From: Danny Staple Date: Sat, 25 Jan 2025 23:18:34 +0000 Subject: [PATCH 1/6] Try install on bookworm --- .github/workflows/python-test.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index b173595..8fff161 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -38,3 +38,15 @@ jobs: # - name: Test with pytest # run: | # pytest + + test_pi_installer_script: + runs-on: ubuntu-latest + # specify an debian bookworm container + container: + image: debian:bookworm + + steps: + - uses: actions/checkout@v2 + - name: Run installer + run: | + source ./install.sh From f4145c41ecc0ac98df1fecedff7bdb2044224af0 Mon Sep 17 00:00:00 2001 From: Danny Staple Date: Sat, 25 Jan 2025 23:26:55 +0000 Subject: [PATCH 2/6] Reproduce the case. Renaming the install --- README.md | 4 ++-- setup_arm.sh => install.sh | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename setup_arm.sh => install.sh (100%) diff --git a/README.md b/README.md index 48cfce7..40be547 100755 --- a/README.md +++ b/README.md @@ -14,9 +14,9 @@ If you already have this kit, then I hope you find this library and it's informa On a terminal at the Raspberry Pi enter these commands: - curl https://raw.githubusercontent.com/orionrobots/python_usb_robot_arm/main/setup_arm.sh | sudo bash + curl https://raw.githubusercontent.com/orionrobots/python_usb_robot_arm/main/install.sh | sudo bash -I suggest review the setup_arm.sh script above to see what it does. +I suggest review the install.sh script above to see what it does. ## Requirements for Other OS diff --git a/setup_arm.sh b/install.sh similarity index 100% rename from setup_arm.sh rename to install.sh From 5ec1321a16c3c64cb803c972d0c035e55d045975 Mon Sep 17 00:00:00 2001 From: Danny Staple Date: Sat, 25 Jan 2025 23:33:28 +0000 Subject: [PATCH 3/6] We mean bash --- .github/workflows/python-test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index 8fff161..f6b8dd3 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -44,7 +44,9 @@ jobs: # specify an debian bookworm container container: image: debian:bookworm - + defaults: + run: + shell: /usr/bin/bash steps: - uses: actions/checkout@v2 - name: Run installer From 5c4b710cf778aefd5e6b4ebf9184ffe4ffb295a7 Mon Sep 17 00:00:00 2001 From: Danny Staple Date: Sat, 25 Jan 2025 23:34:19 +0000 Subject: [PATCH 4/6] Ok --- .github/workflows/python-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index f6b8dd3..cbc1077 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -46,7 +46,7 @@ jobs: image: debian:bookworm defaults: run: - shell: /usr/bin/bash + shell: bash steps: - uses: actions/checkout@v2 - name: Run installer From 003327261f469d3d2a66ebeba8e90f24adb41a6f Mon Sep 17 00:00:00 2001 From: Danny Staple Date: Sat, 25 Jan 2025 23:50:14 +0000 Subject: [PATCH 5/6] Try an implicit venv --- .gitignore | 1 + install.sh | 48 +++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 5d2aa39..b273ca9 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ __pycache__ *.pyc .idea *.dll +.vscode diff --git a/install.sh b/install.sh index 9385f37..d2f858f 100644 --- a/install.sh +++ b/install.sh @@ -1,8 +1,42 @@ -#!/bin/env bash -e -# Raspbian setup -apt-get update -y -apt-get install -y python3-libusb1 python3-pip git +#!/bin/env bash +# Raspbian/Debian setup +# Usage +# source ./install.sh [-v ] +# Will activate/create a venv for the installation +# +# -v : Optional, specify a virtual environment folder to install into +# If not specified, uses .venv in the current folder +set -e + +# Doesn't run with sudo, uses sudo for specific commands +sudo apt-get update -y +sudo apt-get install -y python3-libusb1 python3-pip git + +venv_folder=".venv" +# check for the -v flag +while getopts "v:" opt; do + case ${opt} in + v ) + venv_folder=$OPTARG + ;; + \? ) + echo "Usage: source ./install.sh [-v ]" + return 1 + ;; + esac +done + +if [ ! -d "$venv_folder" ]; then + python3 -m venv "$venv_folder" +fi +source "$venv_folder/bin/activate" + pip3 install git+https://github.com/orionrobots/python_usb_robot_arm -cat </etc/udev/rules.d/42-usb-arm-permissions.rules -SUBSYSTEM=="usb", ATTR{idVendor}=="1267", ATTR{idProduct}=="0000", MODE:="0666" -END + +# cat </etc/udev/rules.d/42-usb-arm-permissions.rules +# SUBSYSTEM=="usb", ATTR{idVendor}=="1267", ATTR{idProduct}=="0000", MODE:="0666" +# END + +# echo "Please reboot for the udev rules to take effect" +echo "To use the library, source the virtual environment with:" +echo " source $venv_folder/bin/activate" From 4d94a77d29272ac7aa25ca383b56b951b217f00c Mon Sep 17 00:00:00 2001 From: Danny Staple Date: Sat, 25 Jan 2025 23:53:10 +0000 Subject: [PATCH 6/6] info please --- .github/workflows/python-test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index cbc1077..d4eca99 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -51,4 +51,6 @@ jobs: - uses: actions/checkout@v2 - name: Run installer run: | + # Don't expect this to be root + whoami source ./install.sh