|
1 | 1 | Raspberry Pi OS |
2 | 2 | ================ |
3 | 3 |
|
4 | | -Literally just pure Raspberry Pi OS Lite, but with added the ability to run a script on the first boot by putting it onto `/boot/` as either: |
| 4 | +Official Raspberry Pi OS Lite minimally **modified** with the ability to run a script on the first boot. |
5 | 5 |
|
6 | | -* `/boot/firstboot.sh` - Run provided script directly |
7 | | -* `/boot/firstboot-script.sh` - Run via [`script(1)`][script] for complete session recording, that can be later played back using [`scriptreplay(1)`][replay] |
| 6 | +Supported script filenames: |
| 7 | + |
| 8 | +* `/boot/firstboot.sh` - Just run the script on the first boot |
| 9 | +* `/boot/firstboot-script.sh` - Same as above, **except** _script_ is run with [`script(1)`][script] for complete session recording, that can be later played back using [`scriptreplay(1)`][replay] |
8 | 10 |
|
9 | 11 | [script]: http://man7.org/linux/man-pages/man1/script.1.html |
10 | 12 | [replay]: http://man7.org/linux/man-pages/man1/scriptreplay.1.html |
11 | 13 |
|
12 | 14 | Repo is inspired by https://github.com/nmcclain/raspberian-firstboot, but has been automated, Dockerized, and fully scripted. |
13 | 15 |
|
14 | | -There are 4 ways to get the image: |
| 16 | +> **NOTE:** If `firstboot-script.sh` is used, recording of script run is saved as `/boot/firstboot-script-log.out` (timing file alongside as `firstboot-script-log.tm`) |
| 17 | +
|
| 18 | +## Usage |
| 19 | + |
| 20 | +1. Download [latest image][latest] |
| 21 | + <details><summary><b>Alternatives?</b></summary> |
| 22 | + |
| 23 | + If downloading images built by other people is not your thing, you can also: |
| 24 | + |
| 25 | + 1. Modify images yourself using provided scripts (in [Docker], or [not]), or even |
| 26 | + 1. [Manually] apply all necessary modifications |
| 27 | + </details> |
| 28 | + |
| 29 | + [latest]: #1-releases |
| 30 | + [docker]: #2-docker |
| 31 | + [not]: #3-script |
| 32 | + [manually]: #4-manual |
| 33 | +1. Burn it into a MicroSD Card |
| 34 | + <details><summary><b>How?</b></summary> |
| 35 | + |
| 36 | + 1. Probably the easiest is to use [Etcher] |
| 37 | + 1. Another way is [using `dd`][dd] on Linux: |
| 38 | + ```shell script |
| 39 | + dd bs=4M if=path/to/downloaded/file.img of=/dev/sdX conv=fsync |
| 40 | + ``` |
| 41 | + 1. Or MacOS: |
| 42 | + ```shell script |
| 43 | + dd bs=4M if=path/to/downloaded/file.img of=/dev/diskX conv=fsync |
| 44 | + ``` |
| 45 | + |
| 46 | + **NOTE:** `boot` partition will usually get mounted as `/Volumes/boot/` on MacOS, and _probably_ `/mnt/boot/` on Linux. |
| 47 | + </details> |
| 48 | + |
| 49 | + [Etcher]: https://www.balena.io/etcher/ |
| 50 | + [dd]: https://www.raspberrypi.org/documentation/installation/installing-images/linux.md |
| 51 | +1. Mount it |
| 52 | + <details><summary><b>How?</b></summary> |
| 53 | + |
| 54 | + 1. **\[MacOS\]** Simply re-inserting the card should do the trick, if not then `diskutil`, or `Disk Utility` should help |
| 55 | + 1. **\[Linux\]** Hard to say exactly, but sth like: |
| 56 | + ```sh |
| 57 | + mkdir -p /mnt/boot/ |
| 58 | + sudo mount /dev/sdX /mnt/boot/ |
| 59 | + ``` |
| 60 | + </details> |
| 61 | + |
| 62 | +1. Add your script & mark it as executable |
| 63 | + ```sh |
| 64 | + # MacOS example: |
| 65 | + cd /Volumes/boot/ |
| 66 | + |
| 67 | + cat <<EOF > firstboot-script.sh |
| 68 | + #!/bin/sh -e |
| 69 | + |
| 70 | + echo "Hello World!" |
| 71 | + EOF |
| 72 | + |
| 73 | + chmod +x firstboot-script.sh |
| 74 | + ``` |
| 75 | +1. Safely eject, move the card into Raspberry Pi, and power it on |
| 76 | +
|
| 77 | +## Download |
15 | 78 |
|
| 79 | +There are 4 possible ways, numbered from easiest to most manual. |
16 | 80 |
|
17 | 81 | ### 1. Releases |
18 | 82 |
|
|
0 commit comments