Add Bug report template to reduce asking for additional details
This commit is contained in:
parent
2ebeece160
commit
de02991724
14 changed files with 501 additions and 7 deletions
67
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
67
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
name: 🐞 Bug Report
|
||||
description: Create a bug report to help us improve
|
||||
labels:
|
||||
- bug
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: >-
|
||||
Thanks! for using the installer scripts. Now that you have encountered a
|
||||
bug... you can file a report for it.
|
||||
- type: textarea
|
||||
id: script
|
||||
attributes:
|
||||
label: Script Command
|
||||
description: >-
|
||||
Include the exact command you're running with any parameters. There are quite
|
||||
a handful of scripts and knowing which one is helpful. :)
|
||||
placeholder: sudo python3 adafruit-pitft.py --display=28r --rotation=90 --install-type=console
|
||||
render: shell
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: os
|
||||
attributes:
|
||||
label: Operating System
|
||||
description: Which OS was the script running under? Include details such as if it
|
||||
was 32 or 64-bit, Whether it was the Lite of Full Desktop version. If it's on an older or newer
|
||||
kernel, include that as well.
|
||||
placeholder: |
|
||||
64-bit Raspberry Pi OS Lite with Bullseye
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: hardware
|
||||
attributes:
|
||||
label: Hardware
|
||||
description: This is the board or computer you are running the script on.
|
||||
placeholder: |
|
||||
Raspberry Pi 4B
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: behavior
|
||||
attributes:
|
||||
label: Behavior
|
||||
description: What happens when you run the script above? Include error messages (if any).
|
||||
placeholder: |
|
||||
An error occurs at line 459 with this message...
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Description
|
||||
description: Optionally, describe the bug in more detail.
|
||||
placeholder: |
|
||||
- I selected options 1, then 3, then 4...
|
||||
- Only happens when...
|
||||
- might be related to #123...
|
||||
- type: textarea
|
||||
id: more-info
|
||||
attributes:
|
||||
label: Additional information
|
||||
description: >-
|
||||
Optionally, add any other information like hardware connection, scope
|
||||
output etc. If you have already done some debugging, mention it here.
|
||||
placeholder: Removing [this](url) line resolves the issue.
|
||||
7
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
7
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
contact_links:
|
||||
- name: 🔗 Adafruit Forum
|
||||
url: https://forums.adafruit.com/
|
||||
about: Official Adafruit technical support forum. Good for getting help on getting a project working.
|
||||
- name: 🔗 Adafruit Discord
|
||||
url: https://adafru.it/discord
|
||||
about: Unofficial chat with many helpful folks and normally prompt replies.
|
||||
11
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
11
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
name: 🚀 Feature Request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: 'enhancement'
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!-- If you have an idea for any new features and enhancements to any of our scripts 🚀
|
||||
and would love ❤ to see what ideas you have for us... 🙂 -->
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
"""
|
||||
Adafruit PiTFT Installer Script
|
||||
Adafruit PiTFT MIPI Display Installer Script
|
||||
(C) Adafruit Industries, Creative Commons 3.0 - Attribution Share Alike
|
||||
|
||||
Written by Melissa LeBlanc-Williams for Adafruit Industries
|
||||
"""
|
||||
|
||||
import time
|
||||
|
|
@ -8,7 +10,7 @@ import os
|
|||
try:
|
||||
import click
|
||||
except ImportError:
|
||||
raise RuntimeError("The library 'Click' was not found. To install, try typing: sudo pip3 install Click")
|
||||
raise RuntimeError("The library 'Click' was not found. To install, try typing: sudo pip3 install --upgrade click")
|
||||
try:
|
||||
from adafruit_shell import Shell
|
||||
except ImportError:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
"""
|
||||
Adafruit PiTFT Installer Script
|
||||
(C) Adafruit Industries, Creative Commons 3.0 - Attribution Share Alike
|
||||
|
||||
Written in Python by Melissa LeBlanc-Williams for Adafruit Industries
|
||||
"""
|
||||
|
||||
import time
|
||||
|
|
|
|||
|
|
@ -1,3 +1,10 @@
|
|||
"""
|
||||
Adafruit Raspberry Pi Fan Service Setup Script
|
||||
(C) Adafruit Industries, Creative Commons 3.0 - Attribution Share Alike
|
||||
|
||||
Converted to Python by Melissa LeBlanc-Williams for Adafruit Industries
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -1,3 +1,10 @@
|
|||
"""
|
||||
Adafruit Raspberry Pi Joy Bonnet Setup Script
|
||||
(C) Adafruit Industries, Creative Commons 3.0 - Attribution Share Alike
|
||||
|
||||
Converted to Python by Melissa LeBlanc-Williams for Adafruit Industries
|
||||
"""
|
||||
|
||||
try:
|
||||
from adafruit_shell import Shell
|
||||
except ImportError:
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
try:
|
||||
import click
|
||||
except ImportError:
|
||||
raise RuntimeError("The library 'Click' was not found. To install, try typing: sudo pip3 install Click==7.0")
|
||||
raise RuntimeError("The library 'Click' was not found. To install, try typing: sudo pip3 install --upgrade click")
|
||||
try:
|
||||
from adafruit_shell import Shell
|
||||
except ImportError:
|
||||
|
|
|
|||
127
pi-touch-cam.py
Executable file
127
pi-touch-cam.py
Executable file
|
|
@ -0,0 +1,127 @@
|
|||
"""
|
||||
Adafruit Pi Touch Cam Setup Script
|
||||
(C) Adafruit Industries, Creative Commons 3.0 - Attribution Share Alike
|
||||
|
||||
Converted to Python by Melissa LeBlanc-Williams for Adafruit Industries
|
||||
|
||||
Note: Currently Untested
|
||||
"""
|
||||
|
||||
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="Retrogame"
|
||||
|
||||
def main():
|
||||
shell.clear()
|
||||
print("""This script will install and/or modify
|
||||
packages needed for the Adafruit Pi
|
||||
Camera project. It requires that the
|
||||
adafruit-pitft.sh installer script (for
|
||||
PiTFT display support) was run first.
|
||||
|
||||
Operations performed include:
|
||||
- In /boot/config.txt, enable camera
|
||||
- apt-get update
|
||||
- Install Python libraries:
|
||||
picamera, pygame, PIL
|
||||
- Downgrade SDL library for pygame
|
||||
touch compatibility
|
||||
- Download Dropbox Updater and
|
||||
Adafruit Pi Cam software
|
||||
|
||||
Run time 5+ minutes. Reboot required.
|
||||
""")
|
||||
|
||||
if not shell.prompt("CONTINUE?", default='n'):
|
||||
print("Canceled.")
|
||||
shell.exit()
|
||||
print("Continuing...")
|
||||
|
||||
|
||||
if shell.grep("dtoverlay=pitft", "/boot/config.txt"):
|
||||
shell.bail("PiTFT overlay not in /boot/config.txt.\n"
|
||||
"Download & run adafruit-pitft.py first.\n"
|
||||
"Canceling.")
|
||||
|
||||
print("Configuring camera + PiTFT settings...")
|
||||
|
||||
# Set PiTFT speed to 80 MHz, 60 Hz
|
||||
shell.pattern_replace("/boot/config.txt", "speed=.*,fps=.*", "speed=80000000,fps=60")
|
||||
|
||||
# Check if Pi camera is enabled. If not, add it...
|
||||
shell.reconfig("/boot/config.txt", "^start_x=.*", "start_x=1")
|
||||
|
||||
# gpu_mem must be >= 128 MB for camera to work
|
||||
result = shell.pattern_search("/boot/config.txt", "^gpu_mem=", return_match=True)
|
||||
if not result:
|
||||
# gpu_mem isn't set. Add to config
|
||||
shell.write_text_file("/boot/config.txt", "\ngpu_mem=128", append=True)
|
||||
elif result.group(1) < 128:
|
||||
# gpu_mem present but too small; increase to 128MB
|
||||
shell.reconfig("/boot/config.txt", "^gpu_mem=.*", "gpu_mem=128")
|
||||
|
||||
print("Installing prerequisite packages...")
|
||||
|
||||
# Enable Wheezy package sources (for SDL downgrade)
|
||||
shell.write_text_file("/etc/apt/sources.list.d/wheezy.list", "deb http://archive.raspbian.org/raspbian wheezy main\n", append=True)
|
||||
|
||||
# Set 'stable' as default package source (current OS)
|
||||
shell.write_text_file("/etc/apt/apt.conf.d/10defaultRelease", "APT::Default-release \"stable\";\n", append=True)
|
||||
|
||||
# Set priority for libsdl from Wheezy higher than current package
|
||||
shell.write_text_file("/etc/apt/preferences.d/libsdl", (
|
||||
"Package: libsdl1.2debian\n"
|
||||
"Pin: release n=stretch\n"
|
||||
"Pin-Priority: -10\n"
|
||||
"Pin: release n=jessie\n"
|
||||
"Pin-Priority: -10\n"
|
||||
"Package: libsdl1.2debian\n"
|
||||
"Pin: release n=wheezy\n"
|
||||
"Pin-Priority:900\n"
|
||||
))
|
||||
|
||||
# Update the APT package index files, install Python libraries
|
||||
print("Updating System Packages")
|
||||
if not shell.run_command("sudo apt-get update"):
|
||||
shell.bail("Apt failed to update indexes!")
|
||||
print("Installing packages...")
|
||||
if not shell.run_command("sudo apt-get -y --force-yes install python-picamera python-pygame python-imaging"):
|
||||
shell.bail("Apt failed to install software!")
|
||||
|
||||
print("Downgrading SDL library...")
|
||||
|
||||
if not shell.run_command("apt-get -y --force-yes install libsdl1.2debian/wheezy"):
|
||||
shell.bail("Apt failed to downgrade SDL library!")
|
||||
|
||||
print("Downloading Dropbox uploader and")
|
||||
print("Adafruit Pi Cam to home directory...")
|
||||
|
||||
shell.chdir("~pi")
|
||||
shell.run_command("wget https://github.com/andreafabrizi/Dropbox-Uploader/archive/master.zip")
|
||||
shell.run_command("unzip master.zip")
|
||||
shell.remove("master.zip")
|
||||
shell.move("Dropbox-Uploader-master", "Dropbox-Uploader")
|
||||
|
||||
shell.run_command("wget https://github.com/adafruit/adafruit-pi-cam/archive/master.zip")
|
||||
shell.run_command("unzip master.zip")
|
||||
shell.remove("master.zip")
|
||||
shell.chown("Dropbox-Uploader", "pi", recursive=True)
|
||||
shell.chown("adafruit-pi-cam-master", "pi", recursive=True)
|
||||
|
||||
# Add lines to /etc/rc.local (commented out by default):
|
||||
shell.pattern_replace("/etc/rc.local", "^exit 0", "# Enable this line to run camera at startup:\n# cd /home/pi/adafruit-pi-cam-master ; sudo python cam.py\n\nexit 0")
|
||||
|
||||
# Prompt to reboot!
|
||||
print("\nCamera and PiTFT settings won't take")
|
||||
print("effect until next boot.")
|
||||
shell.prompt_reboot()
|
||||
|
||||
# Main function
|
||||
if __name__ == "__main__":
|
||||
shell.require_root()
|
||||
main()
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
"""
|
||||
Adafruit Raspberry Pi Blinka Setup Script
|
||||
(C) Adafruit Industries, Creative Commons 3.0 - Attribution Share Alike
|
||||
|
||||
Written by Melissa LeBlanc-Williams for Adafruit Industries
|
||||
"""
|
||||
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -6,12 +6,11 @@ Adafruit Raspberry Pi SPI Chip Enable Reassignment Script
|
|||
try:
|
||||
import click
|
||||
except ImportError:
|
||||
raise RuntimeError("The library 'Click' was not found. To install, try typing: sudo pip3 install Click")
|
||||
raise RuntimeError("The library 'Click' was not found. To install, try typing: sudo pip3 install --upgrade click")
|
||||
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="SPI Reassign"
|
||||
|
|
|
|||
98
retrogame.py
Executable file
98
retrogame.py
Executable file
|
|
@ -0,0 +1,98 @@
|
|||
"""
|
||||
Adafruit Retrogame Setup Script
|
||||
(C) Adafruit Industries, Creative Commons 3.0 - Attribution Share Alike
|
||||
|
||||
Converted to Python by Melissa LeBlanc-Williams for Adafruit Industries
|
||||
|
||||
Note: Currently Untested
|
||||
"""
|
||||
|
||||
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="Retrogame"
|
||||
|
||||
def main():
|
||||
shell.clear()
|
||||
print("""This script downloads and installs
|
||||
retrogame, a GPIO-to-keypress utility
|
||||
for adding buttons and joysticks, plus
|
||||
one of several configuration files.
|
||||
Run time <1 minute. Reboot recommended.
|
||||
""")
|
||||
|
||||
# Grouped by config name and menu label
|
||||
config = {
|
||||
"pigrrl2": "PiGRRL 2 controls",
|
||||
"pocket": "Pocket PiGRRL",
|
||||
"zero": "PiGRRL Zero",
|
||||
"super": "Super Game Pi",
|
||||
"2button": "Two buttons + joystick",
|
||||
"6button": "Six buttons + joystick",
|
||||
"bonnet": "Adafruit Arcade Bonnet",
|
||||
"cupcade-orig": "Cupcade (gen 1 & 2 only)"
|
||||
}
|
||||
|
||||
RETROGAME_SELECT = shell.select_n(
|
||||
"Select configuration:", list(config.values()) + ["Quit without installing"]
|
||||
)
|
||||
|
||||
if RETROGAME_SELECT <= len(config):
|
||||
CONFIG_NAME = list(config.keys())[RETROGAME_SELECT-1]
|
||||
|
||||
if shell.exists("/boot/retrogame.cfg"):
|
||||
print("/boot/retrogame.cfg already exists.\n"
|
||||
"Continuing will overwrite file.\n")
|
||||
if not shell.prompt("CONTINUE?", default='n'):
|
||||
print("Canceled.")
|
||||
shell.exit()
|
||||
|
||||
print("Downloading, installing retrogame...", end="")
|
||||
# Download to tmpfile because might already be running
|
||||
if shell.run_command("curl -f -s -o /tmp/retrogame https://raw.githubusercontent.com/adafruit/Adafruit-Retrogame/master/retrogame"):
|
||||
shell.move("/tmp/retrogame", "/usr/local/bin/")
|
||||
os.chmod("/usr/local/bin/retrogame", 0o755)
|
||||
print("OK")
|
||||
else:
|
||||
print("ERROR")
|
||||
|
||||
print("Downloading, installing retrogame.cfg...", end="")
|
||||
if shell.run_command(f"curl -f -s -o /boot/retrogame.cfg https://raw.githubusercontent.com/adafruit/Adafruit-Retrogame/master/configs/retrogame.cfg.{CONFIG_NAME}"):
|
||||
print("OK")
|
||||
else:
|
||||
print("ERROR")
|
||||
|
||||
print("Performing other system configuration...", end="")
|
||||
|
||||
# Add udev rule (will overwrite if present)
|
||||
shell.write_text_file("/etc/udev/rules.d/10-retrogame.rules", (
|
||||
r"SUBSYSTEM==\"input\", ATTRS{name}==\"retrogame\", "
|
||||
r"ENV{ID_INPUT_KEYBOARD}=\"1\""
|
||||
))
|
||||
|
||||
if CONFIG_NAME == "bonnet":
|
||||
# If Bonnet, make sure I2C is enabled. Call the I2C
|
||||
# setup function in raspi-config (noninteractive):
|
||||
shell.run_command("raspi-config nonint do_i2c 0")
|
||||
|
||||
# Start on boot
|
||||
if shell.run_command("grep retrogame /etc/rc.local", suppress_message=True):
|
||||
# retrogame already in rc.local, but make sure correct:
|
||||
shell.pattern_replace("/etc/rc.local", "^.*retrogame.*$", "/usr/local/bin/retrogame &")
|
||||
else:
|
||||
# Insert retrogame into rc.local before final 'exit 0'
|
||||
shell.pattern_replace("/etc/rc.local", "^exit 0", "/usr/local/bin/retrogame &\nexit 0")
|
||||
|
||||
print("OK")
|
||||
|
||||
shell.prompt_reboot()
|
||||
print("Done")
|
||||
|
||||
# Main function
|
||||
if __name__ == "__main__":
|
||||
shell.require_root()
|
||||
main()
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
"""
|
||||
Adafruit Raspberry Pi Script to Pin a specific version of the rpi kernel and firmware
|
||||
(C) Adafruit Industries, Creative Commons 3.0 - Attribution Share Alike
|
||||
|
||||
Converted to Python by Melissa LeBlanc-Williams for Adafruit Industries
|
||||
"""
|
||||
|
||||
try:
|
||||
|
|
|
|||
163
rtc.py
Executable file
163
rtc.py
Executable file
|
|
@ -0,0 +1,163 @@
|
|||
"""
|
||||
Adafruit Raspberry Pi Real Time Clock Setup Script
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
This script is licensed under the terms of the MIT license.
|
||||
Unless otherwise noted, code reproduced herein
|
||||
was written for this script.
|
||||
|
||||
Originally written by the - The Pimoroni Crew -
|
||||
|
||||
Converted to Python by Melissa LeBlanc-Williams for Adafruit Industries
|
||||
|
||||
|
||||
Note: Currently Untested
|
||||
"""
|
||||
|
||||
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")
|
||||
|
||||
shell = Shell()
|
||||
|
||||
productname = "Real Time Clock module" # the name of the product to install
|
||||
rtcsubtype = "ds1307"
|
||||
baseurl = "http://www.adafru.it"
|
||||
scriptname = "rtc.py" # the name of this script
|
||||
|
||||
spacereq = 1 # minimum size required on root partition in MB
|
||||
debugmode = False # whether the script should use debug routines
|
||||
debuguser = None # optional test git user to use in debug mode
|
||||
debugpoint = None # optional git repo branch or tag to checkout
|
||||
forcesudo = True # whether the script requires to be ran with root privileges
|
||||
promptreboot = False # whether the script should always prompt user to reboot
|
||||
customcmd = True # whether to execute commands specified before exit
|
||||
i2creq = True # whether the i2c interface is required
|
||||
i2sreq = False # whether the i2s interface is required
|
||||
spireq = False # whether the spi interface is required
|
||||
uartreq = False # whether uart communication is required
|
||||
armhfonly = True # whether the script is allowed to run on other arch
|
||||
armv6 = True # whether armv6 processors are supported
|
||||
armv7 = True # whether armv7 processors are supported
|
||||
armv8 = True # whether armv8 processors are supported
|
||||
raspbianonly = True # whether the script is allowed to run on other OSes
|
||||
macosxsupport = False # whether Mac OS X is supported by the script
|
||||
osreleases = ( "Raspbian" ) # list os-releases supported
|
||||
oswarning = ( "Debian", "Ubuntu", "Mate" ) # list experimental os-releases
|
||||
squeezesupport = False # whether Squeeze is supported
|
||||
wheezysupport = False # whether Wheezy is supported
|
||||
jessiesupport = True # whether Jessie is supported
|
||||
|
||||
DEVICE_TREE = True
|
||||
ASK_TO_REBOOT = False
|
||||
CURRENT_SETTING = False
|
||||
UPDATED_DB = False
|
||||
|
||||
BOOTCMD = "/boot/cmdline.txt"
|
||||
CONFIG = "/boot/config.txt"
|
||||
APTSRC = "/etc/apt/sources.list"
|
||||
INITABCONF = "/etc/inittab"
|
||||
BLACKLIST = "/etc/modprobe.d/raspi-blacklist.conf"
|
||||
LOADMOD = "/etc/modules"
|
||||
DTBODIR = "/boot/overlays"
|
||||
|
||||
def raspbian_old():
|
||||
return shell.get_raspbian_version() in ("wheezy", "squeeze")
|
||||
|
||||
def dt_check():
|
||||
# Check if /boot/config.txt exists and de
|
||||
return shell.exists(CONFIG) and not shell.pattern_search(CONFIG, "^device_tree=$")
|
||||
|
||||
#Perform all global variables declarations as well as function definition
|
||||
#above this section for clarity, thanks!
|
||||
|
||||
def main():
|
||||
os_release = shell.get_raspbian_version()
|
||||
IS_SUPPORTED = os_release in osreleases
|
||||
IS_EXPERIMENTAL = os_release in oswarning
|
||||
|
||||
if not shell.is_armhf() or shell.is_arm64():
|
||||
shell.bail("This hardware is not supported, sorry!\n"
|
||||
"Config files have been left untouched")
|
||||
|
||||
if shell.is_raspberry_pi_os():
|
||||
if not wheezysupport and raspbian_old():
|
||||
shell.bail(
|
||||
"\n--- Warning ---\n"
|
||||
f"The {productname} installer\n"
|
||||
"does not work on this version of Raspbian.\n"
|
||||
r"Check https://github.com/{gitusername}/{gitreponame}"
|
||||
"\nfor additional information and support")
|
||||
elif raspbianonly:
|
||||
shell.bail("This script is intended for Raspbian on a Raspberry Pi!")
|
||||
else:
|
||||
if not IS_SUPPORTED and not IS_EXPERIMENTAL:
|
||||
shell.bail(
|
||||
"Your operating system is not supported, sorry!\n"
|
||||
"Config files have been left untouched")
|
||||
|
||||
if forcesudo:
|
||||
shell.require_root()
|
||||
|
||||
print(f"\nThis script will install everything needed to use {productname}\n")
|
||||
shell.warn(
|
||||
"--- Warning ---\n"
|
||||
"Always be careful when running scripts and commands\n"
|
||||
"copied from the internet. Ensure they are from a\n"
|
||||
"trusted source.\n"
|
||||
"\n"
|
||||
"If you want to see what this script does before\n"
|
||||
"running it, you should run:\n"
|
||||
" \curl -sS $baseurl/$scriptname\n"
|
||||
"\n"
|
||||
)
|
||||
|
||||
if shell.prompt("Do you wish to continue?", force_arg="y", default="n"):
|
||||
print("\nChecking hardware requirements...")
|
||||
|
||||
if i2creq == "yes":
|
||||
print()
|
||||
if shell.prompt("Hardware requires I2C, enable now?", force_arg="y", default="n"):
|
||||
shell.run_command("sudo raspi-config nonint do_i2c 0")
|
||||
|
||||
if not dt_check():
|
||||
shell.bail(
|
||||
"Device Tree support required!\n"
|
||||
"Config files have been left untouched\n"
|
||||
)
|
||||
|
||||
rtc_values = ("ds1307", "ds3231", "pcf8523")
|
||||
rtcsubtype = rtc_values[shell.select_n("What RTC would you like to install?", rtc_values) - 1]
|
||||
|
||||
print("Disabling any current RTC")
|
||||
shell.run_command(f"sudo sed --in-place '/dtoverlay[[:space:]]*=[[:space:]]*i2c-rtc/d' {CONFIG}")
|
||||
|
||||
print(f"Adding DT overlay for {rtcsubtype}")
|
||||
shell.write_text_file(CONFIG, f"dtoverlay=i2c-rtc,{rtcsubtype}", append=True)
|
||||
|
||||
print("Removing fake-hwclock")
|
||||
shell.run_command("sudo apt-get -y remove fake-hwclock")
|
||||
shell.run_command("sudo update-rc.d -f fake-hwclock remove")
|
||||
|
||||
if not shell.exists("/lib/udev/hwclock-set"):
|
||||
shell.bail("Couldn't find /lib/udev/hwclock-set")
|
||||
|
||||
shell.warn("Configuring HW Clock")
|
||||
shell.run_command("sudo sed --in-place '/if \[ -e \/run\/systemd\/system \] ; then/,+2 s/^#*/#/' /lib/udev/hwclock-set")
|
||||
shell.prompt_reboot()
|
||||
|
||||
else:
|
||||
shell.warn("\nAborting...")
|
||||
|
||||
# Main function
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
Reference in a new issue