This project provides a Command Line Interface (CLI) that automates the configuration and flashing of the following devices for immediate use:
This allows you to spend more time enjoying your devices rather than configuring them.
Features
-
Supports Orange PI and Raspberry Pi devices.
-
Uses the XDG so you can configure and manage multiple device profiles, networks, scripts, and much more.
Requirements
-
Orange PI or Raspberry Pi hardware.
-
e2tools: For flashing Orange Pi devices.
-
OpenSSL: For encryption.
-
curl: For image downloads.
💡 Use Homebrew and/or the macOS Configuration project to ensure you are using the latest versions.
Setup
To install, run:
git clone https://github.com/bkuhlmann/pi.git
cd pi
git checkout 0.5.0
Usage
To run, use:
bin/run
You’ll then be greeted with the following options:
Usage: run OPTION Script Options: s: Setup drive op: Create Orange profile configuration rp: Create Raspberry profile configuration rn: Create Raspberry network configuration c: Create configuration e: Edit configuration l: List configurations o: Open configurations d: Delete configuration E: Eject drive q: Quit/Exit Enter selection:
The above breaks down as follows:
-
Setup drive: Provides a wizard that allows you to format and configure your micro SSD card for immediate use of your device. Start here, especially if you want to get up and running quickly with the default configuration.
-
Create Orange profile configuration: Create a, per device, reusable Orange PI XDG profile and network configuration using your default editor.
-
Create Raspberry profile configuration: Create a, per device, reusable Raspberry Pi XDG profile using your default editor.
-
Create Raspberry network configuration: Create a common and reusable Raspberry Pi XDG network configuration that can be shared amongst all profiles using your default editor.
-
Create configuration: Create any XDG configuration in your default editor.
-
Edit configuration: Edit an existing XDG configuration in your default editor.
-
List configuration: List your entire XDG configuration via your console.
-
Open configuration: Open and view your entire XDG configuration in your default editor.
-
Delete configuration: Delete an existing XDG configuration.
-
Eject drive: Eject (unmount) any micro SSD drive.
-
Quit/Exit: Quits the CLI.
If you know which option you want to run, like setup, you can skip the interactive options shown above. Example:
bin/run s
SSH
Once flashed and configured, you can insert your micro SSD card into your device and connect power. Then you can look for your device to show up on your local network with whatever host name you gave it.
To streamline this process further, edit your SSH configuration (i.e. $HOME/.ssh/config) to add your new host. Example:
Host demo.local HostName 192.168.0.123 User demo IdentityFile ~/.ssh/demo
With SSH configured, you can SSH into your device as follows:
ssh demo@demo.local
Scripts
After SSH’ing into your device, you’ll want to run the all script to install all software, finish the setup, and immediately start using your device. The location differs by operating system as shown below:
cd /installers
./all
cd /boot/firmware/installers
./all
Example
The following is an example of what the output can look like when running the setup wizard (i.e. bin/run s):
Output (example)
bin/run s
Please select your operating system:
o: Orange Pi
r: Raspberry Pi
q: Quit/Exit
Enter selection: o
Downloading and decompressing image...
################################################################################################################################################################################### 100.0%
Checking operating system integrity...
Armbian_26.8.1_Orangepizero3w_trixie_vendor_6.6.98_minimal.img.xz: OK
Found the following external disks:
/dev/disk4 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *32.0 GB disk4
1: Linux 31.6 GB disk4s1
(free space) 335.5 MB -
Enter your disk number (i.e. 1, 2, 3) for /dev/disk to format: 4
Formatting Disk 4...
Unmount of all volumes on disk4 was successful
Password:
1853882368 bytes (1854 MB, 1768 MiB) transferred 84.019s, 22 MB/s
446+0 records in
446+0 records out
1870659584 bytes transferred in 84.590644 secs (22114261 bytes/sec)
Select a profile to add to your image:
1) /Users/demo/.config/pi/profiles/o-zero.txt
2) /Users/demo/.config/pi/profiles/r-five.yml
3) /Users/demo/.config/pi/profiles/r-zero.yml
#? 1
Applying configuration...
Copied /Users/demo/.config/pi/profiles/o-zero.txt to /dev/disk4s1:/root/.not_logged_in_yet
Copied /Users/demo/Engineering/OSS/pi/lib/scripts/booters/orange.sh to /dev/disk4s1:/root/provisioning.sh
Created directory /dev/disk4s1:/etc/skel/installers
Copied /Users/demo/Engineering/OSS/pi/lib/scripts/installers/all to /dev/disk4s1:/etc/skel/installers/all
Copied /Users/demo/Engineering/OSS/pi/lib/scripts/installers/defaults to /dev/disk4s1:/etc/skel/installers/defaults
Copied /Users/demo/Engineering/OSS/pi/lib/scripts/installers/docker to /dev/disk4s1:/etc/skel/installers/docker
Copied /Users/demo/Engineering/OSS/pi/lib/scripts/installers/kit.sh to /dev/disk4s1:/etc/skel/installers/kit.sh
Copied /Users/demo/Engineering/OSS/pi/lib/scripts/installers/sensors to /dev/disk4s1:/etc/skel/installers/sensors
Copied /Users/demo/Engineering/OSS/pi/lib/scripts/installers/settings.sh to /dev/disk4s1:/etc/skel/installers/settings.sh
Copied /Users/demo/Engineering/OSS/pi/lib/scripts/installers/system to /dev/disk4s1:/etc/skel/installers/system
Copied /Users/demo/Engineering/OSS/pi/lib/scripts/installers/terminus to /dev/disk4s1:/etc/skel/installers/terminus
Copied /Users/demo/Engineering/OSS/pi/tmp/hostname.txt to /dev/disk4s1:/etc/hostname
Select your public key ('q' to quit):
1) /Users/demo/.ssh/demo-a.pub
2) /Users/demo/.ssh/demo-b.pub
3) /Users/demo/.ssh/demo-c.pub
#? 3
Created directory /dev/disk4s1:/etc/skel/.ssh
Copied /Users/demo/.ssh/vilya.pub to /dev/disk4s1:/etc/skel/.ssh/authorized_keys
Profile installed: o-zero
Disk /dev/disk4 ejected
Setup Complete! You can remove your SSD drive.
Configuration
A default configuration is provided for you but you can override the defaults by setting the following environment variables (see lib/configuration.sh for details):
-
EDITOR: This has no default but assumes you have this configured to run your favorite text editor. For example, if using Sublime Text, the value would be:sublime. -
PI_TEMPLATES_ROOT: Where all default templates are located for configuring your devices. You should not need to change this. -
PI_TEMP_ROOT: The temporary directory used when downloading temporary files for flashing to your devices. -
XDG_CONFIG_ROOT: The namespaced XDG configuration directory root. You should not need to change this.
Templates
All templates can be found in the lib/templates directory. They are organized by device and provide the correct structure for creating profile and network configurations.
These can’t be configured, at the moment, but will be possible in the future.
Scripts
All scripts can be found in the lib/scripts directory. They are fully configurable via your XDG configuration. Here’s the breakdown:
-
booters: For automatically booting your device. Currently, only used by Orange PI devices.-
orange.sh: Provides a Orange First Boot Configuration which, at the moment, is benign and does nothing.
-
-
installers: For installing any/all software. Here’s what each does:-
system(enabled): Ensures your system is up-to-date. -
defaults(enabled): Installs default programs such as DNS/Bonjour discovery, curl, and Git. -
docker(enabled): Install rootless Docker so you can then install as many containers as you wish. -
sensors(disabled): Installs libraries for reading temperature, CO2, humidity, and more. -
terminus(disabled): Installs the Terminus ePaper server which can read and render the above sensor data on your ePaper devices. -
all: Runs all of the above in the order listed so you have only have a single script to run once logged in. -
settings.sh(optional): Provides common settings for the installers. -
kit.sh(optional): Provides common functions for the installers.
-
You can customize all of the above by creating an identical directory and file structure within your $XDG_CONFIG_HOME/pi configuration. This allows you to quickly enable/disable scripts and/or add your own scripts as anything in your XDG configuration takes precedence over what is provided by this project. 🎉
Development
To contribute, run:
git clone https://github.com/bkuhlmann/pi.git
cd pi
Credits
-
Build with Bashsmith.
-
Engineered by Brooke Kuhlmann.