{"id":20673390,"url":"https://github.com/meedamian/raspios","last_synced_at":"2025-10-19T15:19:38.035Z","repository":{"id":141680111,"uuid":"264381633","full_name":"meeDamian/raspios","owner":"meeDamian","description":"[unofficial] Add first boot script to Raspberry Pi OS Lite (Raspbian)","archived":false,"fork":false,"pushed_at":"2022-03-09T16:03:31.000Z","size":88,"stargazers_count":19,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T12:22:28.405Z","etag":null,"topics":["firstboot","minimal","raspberry-pi","raspbian"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/meeDamian.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-16T07:18:26.000Z","updated_at":"2024-11-06T21:19:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"3c040d2f-06e9-4eb7-ae48-92b56b64d416","html_url":"https://github.com/meeDamian/raspios","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meeDamian%2Fraspios","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meeDamian%2Fraspios/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meeDamian%2Fraspios/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meeDamian%2Fraspios/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meeDamian","download_url":"https://codeload.github.com/meeDamian/raspios/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249782535,"owners_count":21324959,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["firstboot","minimal","raspberry-pi","raspbian"],"created_at":"2024-11-16T20:41:13.816Z","updated_at":"2025-10-19T15:19:33.011Z","avatar_url":"https://github.com/meeDamian.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"Raspberry Pi OS\n================\n\nOfficial Raspberry Pi OS Lite minimally **modified** with the ability to run a script on the first boot.\n\nSupported script filenames:\n\n* `/boot/firstboot.sh` - Just run the script on the first boot\n* `/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]\n\n[script]: http://man7.org/linux/man-pages/man1/script.1.html\n[replay]: http://man7.org/linux/man-pages/man1/scriptreplay.1.html\n\nRepo is inspired by https://github.com/nmcclain/raspberian-firstboot, but has been automated, Dockerized, and fully scripted.\n\n\u003e **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`)\n\n## Usage\n\n1. Download [latest image][latest]\n    \u003cdetails\u003e\u003csummary\u003e\u003cb\u003eAlternatives?\u003c/b\u003e\u003c/summary\u003e\n\n    If downloading images built by other people is not your thing, you can also:\n    \n    1. Modify images yourself using provided scripts (in [Docker], or [not]), or even\n    1. [Manually] apply all necessary modifications\n    \u003c/details\u003e\n    \n    [latest]: #1-releases\n    [docker]: #2-docker\n    [not]: #3-script\n    [manually]: #4-manual\n1. Burn it into a MicroSD Card\n    \u003cdetails\u003e\u003csummary\u003e\u003cb\u003eHow?\u003c/b\u003e\u003c/summary\u003e\n    \n    1. Probably the easiest is to use [Etcher]\n    1. Another way is [using `dd`][dd] on Linux:\n        ```shell script\n        dd bs=4M if=path/to/downloaded/file.img of=/dev/sdX conv=fsync\n        ```\n    1. Or MacOS:\n        ```shell script\n        dd bs=4M if=path/to/downloaded/file.img of=/dev/diskX conv=fsync\n        ```\n        \n    **NOTE:** `boot` partition will usually get mounted as `/Volumes/boot/` on MacOS, and _probably_ `/mnt/boot/` on Linux.\n    \u003c/details\u003e\n    \n    [Etcher]: https://www.balena.io/etcher/\n    [dd]: https://www.raspberrypi.org/documentation/installation/installing-images/linux.md\n1. Mount it\n    \u003cdetails\u003e\u003csummary\u003e\u003cb\u003eHow?\u003c/b\u003e\u003c/summary\u003e\n    \n    1. **\\[MacOS\\]** Simply re-inserting the card should do the trick, if not then `diskutil`, or `Disk Utility` should help\n    1. **\\[Linux\\]** Hard to say exactly, but sth like:\n    ```sh\n    mkdir -p /mnt/boot/\n    sudo mount /dev/sdX /mnt/boot/\n    ```\n    \u003c/details\u003e\n\n1. Add your script \u0026 mark it as executable\n    ```sh\n    # MacOS example:\n    cd /Volumes/boot/\n    \n    cat \u003c\u003cEOF \u003e firstboot-script.sh\n    #!/bin/sh -e\n    \n    echo \"Hello World!\"\n    EOF\n    \n    chmod +x firstboot-script.sh\n    ```\n1. Safely eject, move the card into Raspberry Pi, and power it on\n\n## Download\n\nThere are 4 possible ways, numbered from easiest to most manual.\n\n### 1. Releases\n\nThe easiest way is going to [Releases], and downloading the latest one.\n\nReleases are created automatically upon each new Raspberry Pi OS release, you can see their build log either directly in [Actions tab][actions], or by searching for [`release-pending-approval`][issues] issues. \n\n[Releases]: https://github.com/meeDamian/raspios/releases\n[actions]: https://github.com/meeDamian/raspios/actions\n[issues]: https://github.com/meeDamian/raspios/issues?q=is%3Aissue+sort%3Aupdated-desc+label%3Arelease-pending-approval+\n\n\n### 2. Docker\n\nSecond easiest path is (after cloning this repo) running:\n\n1. [`docker build -t builder .`][docker-build]\n1. [`docker run --rm --privileged -v=\"$(pwd)/images/:/raspios/\" builder`][docker-run]\n\n[docker-build]: https://github.com/meeDamian/raspios/blob/731a1681e0f9dd9ba8b02b810bb473c286b405e7/.github/workflows/release.yml#L34\n[docker-run]: https://github.com/meeDamian/raspios/blob/731a1681e0f9dd9ba8b02b810bb473c286b405e7/.github/workflows/release.yml#L40\n\n\u003e **NOTE:** `--privileged` flag is required because [`mount`]ing a filesystem requires root.\n\u003e\n\u003e**NOTE_2:** Alternatively [`./run-in-docker.sh`][run] can be run to achieve the same effect.\n\n[run]: /run-in-docker.sh\n\n\n### 3. Script\n\nIf you're on a Linux box, you can (after cloning this repo) run:\n\n```shell script\n./modify-image.sh create images/\n```\n\n\u003e **NOTE:** `sudo` might be required because [`mount`]ing a filesystem requires root.\n\n[`mount`]: https://github.com/meeDamian/raspios/blob/d3af7a29ee4c9cd09aae68badec95725c58c7010/modify-image.sh#L199\n\n\n### 4. Manual\n\nYou can also completely ignore all contents of this repo, download Raspberry Pi OS Lite, and (assuming you have the ability to mount `ext4` on your OS):\n\n\u003e **NOTE: For `firstboot-script.service` see [here].**\n\n[here]: /firstboot-script.service\n\n1. Mount second partition\n1. Install the service, by creating `$MOUNT_PATH/etc/systemd/system/firstboot.service` file, with the following contents:\n    ```unit file (systemd)\n    [Unit]\n    Description=FirstBoot\n    After=network.target\n    Before=rc-local.service\n    ConditionFileNotEmpty=/boot/firstboot.sh\n    \n    [Service]\n    Type=oneshot\n    ExecStart=/boot/firstboot.sh\n    ExecStartPost=/bin/mv /boot/firstboot.sh /boot/firstboot.sh.done\n    RemainAfterExit=no\n    \n    [Install]\n    WantedBy=multi-user.target\n    ```\n1. Enable the service by running:\n    ```shell script\n    cd $MOUNT_PATH/etc/systemd/system/multi-user.target.wants/ \u0026\u0026 \\\n        ln -s /etc/systemd/system/firstboot.service . # No $MOUNT_PATH(!)\n    ```\n1. `umount` the image\n1. Burn it to a card\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeedamian%2Fraspios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeedamian%2Fraspios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeedamian%2Fraspios/lists"}