The shell script buildImage.sh downloads a Raspberry Pi OS image and does the following modifications:
- enable SSH
- create default user "pi" (password: "raspberry")
- add a udev rule to trigger execution of the shell script usbScriptRunner.sh when an USB flash drive is connected/disconnected
- copy the shell script usbScriptRunner.sh to
/usr/local/bin
on the image
The modified image is provided as release with release number matching the release date and version of the original Raspberry Pi OS image (e.g. 2020.12.02-lite
).
The modified image enables fully unattended installation of software on top of a fresh Raspberry Pi OS image.
Once a USB flash drive is connected to the Raspberry Pi the udev
daemon executes the shell script usbScriptRunner.sh which:
- mounts the USB flash drive
- scans the files on the USB flash drive for files like
*.sh
, sorts them and copies the first to/tmp
- executes the shell script copied to
/tmp
- turns off the power led in order to signal the end of exectution
Once the USB flash drive is disconnected from the Raspberry Pi the shell script usbScriptRunner.sh triggers a reboot of the Raspberry Pi.
The project Smart Appliance Enabler uses the modified image for a two phase install. For the installation process the following files have to be placed on a USB flash drive:
- install.sh - the script to be executed by usbScriptRunner.sh. It
- copies
install2.sh
andinstall.config
to/tmp
for the second installation phase - moves
/etc/rc.local
away and creates a replacement in order to triggerinstall2.sh
after reboot - enable Wifi with SSID/PSK provided in
install.config
- copies
- install2.sh is executed from
/etc/rc.local
after Reboot and represents the second installation phase. It updates all packages, installs additional packages and downloads/installs/configures additional software. Finally it restores the original/etc/rc.local
and performs clean up. - install.config contains a few parameters users may change to configure the installation process
- automatic checking for new Raspberry Pi OS build and subsequent created of a corresponding modified image