Skip to content

Commit

Permalink
Merge pull request #561 from MLB-LED-Scoreboard/driver-versioning
Browse files Browse the repository at this point in the history
Allow selection of driver version and set 14ab2ff as current default
  • Loading branch information
ty-porter authored Nov 4, 2024
2 parents 3c48ce0 + 04339a9 commit 5dcedac
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 35 deletions.
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,26 +135,29 @@ It will also install the following python libraries that are required for certai
* [MLB-StatsAPI](https://pypi.org/project/MLB-StatsAPI/): The main library that fetches and parses all of the actual MLB data being displayed
* [RGBMatrixEmulator](https://github.com/ty-porter/RGBMatrixEmulator): The emulation library for the matrix display. Useful for running on MacOS or Linux, or for development.

#### Installation on Non-Raspberry Pi Hardware
#### Customizing the Installation

The installation script is designed for physical hardware. When attempting to install it on other platforms, you should not use `sudo` to install the dependencies. In addition, you can pass the `--emulator-only` argument to skip installation steps that aren't required.
Additional flags are available for customizing your install:

```
sh install.sh --emulator-only
```
-a, --skip-all Skip all dependencies and config installation (equivalent to -c -p -m).
-c, --skip-config Skip updating JSON configuration files.
-m, --skip-matrix Skip building matrix driver dependency. Video display will default to emulator mode.
-p, --skip-python Skip Python 3 installation. Requires manual Python 3 setup if not already installed.
Additional flags are available for customizing your install:
-v, --no-venv Do not create a virtual environment for the dependencies.
-e, --emulator-only Do not install dependencies under sudo. Skips building matrix dependencies (equivalent to -m)
-d, --driver Specify a branch name or commit SHA for the rpi-rgb-led-matrix library. (Optional. Defaults may change.)
-h, --help Display this help message
```
-p, --skip-python Skips Python 3 installation. You will need to install it via your platform's appropriate package manager.
-m, --skip-matrix Skips RPI-specific matrix driver installation and build.
-c, --skip-config Skips default config overwrite without prompting.

-a, --skip-all Performs all above skips.
--no-venv Do not create a virtual environment for the dependencies.
--emulator-only Do not install dependencies under sudo. Skips building matrix dependencies.
#### Installation on Non-Raspberry Pi Hardware

The installation script is designed for physical hardware. When attempting to install it on other platforms, you should not use `sudo` to install the dependencies. In addition, you can pass the `--emulator-only` argument to skip installation steps that aren't required.

-h, --help Displays help
```
sh install.sh --emulator-only
```

#### Updating
Expand Down
55 changes: 32 additions & 23 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,58 +1,65 @@
#!/bin/bash

SKIP_PYTHON=false
SKIP_CONFIG=false
SKIP_MATRIX=false
NO_SUDO=false
SKIP_VENV=false
DRIVER_SHA=14ab2ff

usage() {
cat <<USAGE
Usage: $0 [-a] [-c] [-m] [-p]
Usage: $0 [-acmpve] [-d / --driver string]
Options:
-c, --skip-config: Skip updating JSON configuration files.
-m, --skip-matrix: Skip building matrix driver dependency. Video display will default to emulator mode.
-p, --skip-python: Skip Python 3 installation. Requires manual Python 3 setup if not already installed.
-a, --skip-all Skip all dependencies and config installation (equivalent to -c -p -m).
-c, --skip-config Skip updating JSON configuration files.
-m, --skip-matrix Skip building matrix driver dependency. Video display will default to emulator mode.
-p, --skip-python Skip Python 3 installation. Requires manual Python 3 setup if not already installed.
-a, --skip-all: Skip all dependencies and config installation (equivalent to -c -p -m).
--no-venv Do not create a virtual environment for the dependencies.
--emulator-only: Do not install dependencies under sudo. Skips building matrix dependencies (equivalent to -m)
-v, --no-venv Do not create a virtual environment for the dependencies.
-e, --emulator-only Do not install dependencies under sudo. Skips building matrix dependencies (equivalent to -m)
-d, --driver Specify a branch name or commit SHA for the rpi-rgb-led-matrix library. (Defaults to "$DRIVER_SHA")
-h, --help Display this help message
USAGE
exit 1
}

SKIP_PYTHON=false
SKIP_CONFIG=false
SKIP_MATRIX=false
NO_SUDO=false
SKIP_VENV=false

for arg in "$@"; do
case $arg in
while [ $# -gt 0 ]; do
case "$1" in
-p | --skip-python)
SKIP_PYTHON=true
shift # Remove -p / --skip-python from `$@`
shift
;;
-c | --skip-config)
SKIP_CONFIG=true
shift # Remove -c / --skip-config from `$@`
shift
;;
-m | --skip-matrix)
SKIP_MATRIX=true
shift # Remove -m / --skip-matrix from `$@`
shift
;;
-a | --skip-all)
SKIP_CONFIG=true
SKIP_MATRIX=true
SKIP_PYTHON=true
SKIP_VENV=true
shift # Remove -a / --skip-all from `$@`
shift
;;
--emulator-only)
-e | --emulator-only)
SKIP_MATRIX=true
NO_SUDO=true
shift # remove --emulator-only from `$@`
shift
;;
--no-venv)
-v | --no-venv)
SKIP_VENV=true
shift # remove --no-venv from `$@`
shift
;;
-d | --driver)
DRIVER="$2"
shift 2
;;
-h | --help)
usage # run usage function on help
Expand Down Expand Up @@ -134,6 +141,8 @@ if [ "$SKIP_MATRIX" = false ]; then
cd submodules
git clone https://github.com/hzeller/rpi-rgb-led-matrix.git matrix
cd matrix
# Checkout the branch or commit specified for rpi-rgb-led-matrix
git checkout $DRIVER_SHA
git pull
make build-python PYTHON="$PYTHON"
sudo make install-python PYTHON="$PYTHON"
Expand Down

0 comments on commit 5dcedac

Please sign in to comment.