Merge pull request #234 from makermelissa/main

Update readme, move scripts, bug fixes
This commit is contained in:
Melissa LeBlanc-Williams 2022-11-11 17:11:36 -08:00 committed by GitHub
commit 2ebeece160
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 38 additions and 12 deletions

View file

@ -2,6 +2,35 @@
Some scripts for helping install Adafruit HATs, bonnets, add-on's, & friends!
Based heavily on get.pimoroni.com scripts!
Many scripts are based heavily on get.pimoroni.com scripts!
* Install i2s amplifier with: curl -sS https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/i2samp.sh | bash
## Python Scripts
We are in the process of converting our Shell Scripts to Python. Instructions for running specific scripts are available in the [Adafruit Learning System](https://learn.adafruit.com/). Here are the general setup instructions.
### Dependencies
- Python 3
- [Adafruit_Python_Shell](https://github.com/adafruit/Adafruit_Python_Shell)
- [Click](https://pypi.org/project/click/)
### Prepare your system
To install the dependencies for the python scripts, run the following commands:
```bash
sudo apt-get install python3-pip click
sudo pip3 install --upgrade setuptools
sudo pip3 install --upgrade adafruit-python-shell
```
Then to run the python script, type the following replacing "scriptname.py" with the actual script name:
```bash
sudo python3 scriptname.py
```
## Old Shell Scripts
If you were directed here from an external site and the script you were looking for appears to be missing, you can either use the newer python script or check the [converted_shell_scripts](https://github.com/adafruit/Raspberry-Pi-Installer-Scripts/tree/main/converted_shell_scripts) folder to use the old shell scripts.

View file

@ -7,12 +7,11 @@ try:
from adafruit_shell import Shell
except ImportError:
raise RuntimeError("The library 'adafruit_shell' was not found. To install, try typing: sudo pip3 install adafruit-python-shell")
import os
shell = Shell()
shell.group="Blinka"
default_python = 3
blinka_minimum_python_version = 3.6
blinka_minimum_python_version = 3.7
def default_python_version(numeric=True):
version = shell.run_command("python -c 'import platform; print(platform.python_version())'", suppress_message=True, return_output=True)

View file

@ -7,7 +7,6 @@ try:
from adafruit_shell import Shell
except ImportError:
raise RuntimeError("The library 'adafruit_shell' was not found. To install, try typing: sudo pip3 install adafruit-python-shell")
import os
shell = Shell()
shell.group = 'PINNING'
@ -39,19 +38,18 @@ def main():
]
new_packages = []
for package in packagelist:
filename = "{}_{}_armhf.deb".format(package, version)
filename = f"{package}_{version}_armhf.deb"
new_packages.append(filename)
shell.run_command("wget --continue -O {} {}".format(filename, base + filename))
shell.run_command("dpkg -i " + " ".join(new_packages))
for package in packagelist:
write_text_file("/etc/apt/preferences.d/99-adafruit-pin-kernel",
"""Package: {}
Pin: version {}
Pin-Priority:999
""".format(package, version))
shell.write_text_file("/etc/apt/preferences.d/99-adafruit-pin-kernel", (
f"Package: {package}\n"
f"Pin: version {version}\n"
f"Pin-Priority:999\n\n"
))
shell.prompt_reboot()
# Main function