To setup SSH and Wi-Fi connectivity before even booting up a Pi for the first time, one can put files into the boot partition on the SD card.

This has me curious. Suppose I have a particular setup I want to have on all of my new Raspberry Pis. Is there a way I can add scripts to this same boot partition that are run when the Pi boots up for the first them, but never again?

  • 1
    Yes. burn a fresh image. Prevent that image from expanding the filesystem on first boot. Add your logic for running this script (see how ssh/wifi is done and do something similar) - create an image from the sd card (after re-enabling the expand on first boot) – Jaromanda X Sep 17 '19 at 23:38
  • 4
    Possible duplicate of Use /boot/cmdline.txt for creating first-boot script. Look at the accepted answer pointing to github. – Ingo Sep 18 '19 at 8:29

Browse other questions tagged or ask your own question.