I'm currently exploring whether it is possible to create a piece of software which can (ideally) install and configure itself automatically - with no interaction from the user - the first time the Raspberry Pi is booted.
Inspired by how the Wi-Fi and SSH are automatically configured on Jessie, I'm wondering if this would be possible by storing a binary or a script on the boot partition of the SD card (boot partition so that it will also work for Windows users without third-party software). The user shouldn't have to do anything other than image the SD card, possibly drop some files into the boot partition, and then connect it to power/the internet.
My question is, then: what piece of code (in Raspbian? In the kernel?) currently handles the Wi-Fi and SSH setup? Additionally, are there any other facilities for doing what I'm trying to do - i.e., am I going down the wrong path with this?