Skip to content

Commit

Permalink
Make the driver version a cmd line flag instead of config
Browse files Browse the repository at this point in the history
  • Loading branch information
ty-porter committed Nov 4, 2024
1 parent c973dc1 commit d897d46
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 38 deletions.
28 changes: 15 additions & 13 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. (Defaults to "$DRIVER")
-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 Expand Up @@ -258,7 +261,6 @@ A default `config.json.example` file is included for reference. Copy this file t
"pregame_weather" Bool If enabled, will display the weather for the game's location on the pregame screen.
"debug" Bool Game and other debug data is written to your console.
"demo_date" String A date in the format YYYY-MM-DD from which to pull data to demonstrate the scoreboard. A value of `false` will disable demo mode.
"driver_version" String A branch name or commit SHA for the installed rpi-rgb-led-matrix library. Falls back to "master" if not present.
```

### Delaying Board Update
Expand Down
3 changes: 1 addition & 2 deletions config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,5 @@
"pregame_weather": true,
"scrolling_speed": 2,
"debug": false,
"demo_date": false,
"driver_version": "14ab2ff"
"demo_date": false
}
53 changes: 30 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=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")
-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

0 comments on commit d897d46

Please sign in to comment.