Skip to main content

setup-pi

Tweak the operating system ready for copying it over to an sd card for a raspberry pi. Only works with linux

Uses mounts, docker, chroot and qemu emulation to tweak your raspberry pi OS producing an image.

AI-generated and unreviewed. However... I have used to the create five pi images.

Motivation

I got bored with mounting and settng up a device to get networking via rj-45 working after I had to upgrade a PI. So I decided to automate parts of this.

Part of my motivation was a particularly nasty issue where the Pi would die immeidatley ater boot producing no logs with a certain wifi adaptor. The response from r/raspberrypi on reddit was of course "this is off topic and documented", it was not oftopic or documented.

Alternatives and prior work

Raspios has an image builder. An LLM tells me that this works with a first bookt script. I do not like first book scripts because it can be difficult to debug (you need to reflash, insert into a pi, reboot, wait long enough for a boot, switch off the pi, remove the sd card, then mount)

Installation

Install qemu and docker. Then install

pipx install setup-pi

Usage

Create a toml file describing the image you want to generator.

You can use --sudoers to generate a sudoers rules to run without root.

hostname  = "electric-pi"
persistent_logging = true
backdoor = true

first_boot_cmd = "/listen"

# Ethernet - set eth_dhcp = false for static
eth_dhcp  = true
# eth_ip      = "192.168.0.2"
# eth_netmask = "255.255.255.0"
# eth_gateway = "192.168.0.1"  # optional even for static

# WiFi - set wifi = true to configure
wifi      = true
wifi_ssid   = "wif"
wifi_pass   = "XXXXXXXXXX" 
# wifi_dhcp   = true
# wlan0_ip    = "192.168.3.200"
# wifi_netmask = "255.255.255.0"
# wifi_gateway = "192.168.3.1"

packages = ["ncat"]


[[users]]
name = "bruger"
sudo = true
ssh_keys = ["~/.ssh/id_rsa.pub"]

[[files]]
src = "listen"
dst = "/listen"
mode = "0755"

# [[users]]
# name = "guest"
# sudo = false
# password = "letmein"

Then run:

setup-raspios intial.img output.img --config config.toml

Metadata

Release files for setup-pi 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for setup-pi 0.1.3
File Size Uploaded
setup_pi-0.1.3.tar.gz 10.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for setup-pi 0.1.3
File Interpreter ABI Platform
setup_pi-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 21.0 kB

Release files / setup_pi-0.1.3.tar.gz

Download URL setup_pi-0.1.3.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
03265a9d2e47b3e7d40f91d4434380a802a8ea49d8f3a8fe0cd621257cd90b55
BLAKE2b-256 checksum
How to use checksums
a74e52d37028d6eb4fe9bdc16bffadb3fb2a1f25357eee7372aae00770aad6db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / setup_pi-0.1.3-py3-none-any.whl

Download URL setup_pi-0.1.3-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
de2f5880e83654a622b19db03b7d8fecd73b2b2008bc722ed0de495dd6eae6c7
BLAKE2b-256 checksum
How to use checksums
dc9b5ed9ad6e8bf2c17b31f402a8210bcc7f74dad7bc58552d54d5d5749a4e86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page