Enhance Raspbian with a mechanism by which any host system used to image an SD card can add a setup script to the SD card to initiate a process on first boot.
The mechanism will allow communities to form around Raspbian as the base for special purpose Raspberry Pi configuration without the need to build and host an entire OS. It should be possible to prepare SD cards that initiate a setup process the yields a system that does not need to be further configured by following lengthy explanations found on forums and wikis.
- Set up secured wifi on headless systems
- Add or remove packages
- Build and install drivers
- /etc/rcS.d/S01simple_boot_setup is symlinked to /etc/init.d/simple_boot_setup
- /etc/init.d/simple_boot_setup calls /boot/simple_boot_setup.sh 2.1. /boot/simple_boot_setup.sh calls /boot/files/simple_boot_setup_0.sh only once (the file gets renamed and not called again) 2.2. /boot/simple_boot_setup.sh calls /boot/files/simple_boot_setup_1.sh at every boot
- /boot is a FAT file system so that any OS can edit it.
- /etc/networks/interfaces for wifi and cable - if exists under /file
- /etc/resolve.conf for DNS (google and open dns) - if exists under /file
- ~/pi/.ssh/id_rsa and ~/pi/.ssh/known_hosts - if exists under /file
- prelimirary attach_devices.py script to auto mount usb and binding desired folders
- create another script to be run AFTER network
with both partitions mounted:
- run install_linux.sh
- copy files to sd card
- boot RPi
- run /boot/install_windows.sh
- edit files/interfaces with your desired IP or DHCP
- edit files/resolv.conf for DNS
- add files/id_rsa and files/id_rsa.pub if you want
- add files/authorized_keys with your public key inside to access without requiring password
- edit files/disks with the necessary information the disk id can be seen on linux on /dev/disk/by-id/
- rename any of the configuration or bash scripts in the files folder to disable it
## Remove unneeded packages
apt-get -y remove --purge xserver-common x11-common gnome-icon-theme gnome-themes-standard penguinspuzzle
apt-get -y remove --purge desktop-base desktop-file-utils hicolor-icon-theme raspberrypi-artwork omxplayer
apt-get -y autoremove
## Install a package that will automatically mount & unmount USB drives
apt-get install usbmount
## Setup wifi so you can connect to a secured network without a keyboard & monitor!
cp /etc/wpa_supplicant/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf.bak
wpa_passphrase "MyWiFi" "MyPassphrase" | tee -a /etc/wpa_supplicant/wpa_supplicant.conf
sed -i.bak 's/iface wlan0 inet manual/iface wlan0 inet dhcp/; s/wpa-roam/wpa-conf/; $i auto wlan0 eth0' /etc/network/interfaces
## Add your SSH pub key
(umask 077; mkdir -p ~/.ssh; touch ~/.ssh/authorized_keys)
chown -R $(id -u pi):$(id -g pi) ~/.ssh
curl -sL https://raw.github.com/RichardBronosky/dotfiles/master/.ssh/authorized_keys >> ~/.ssh/authorized_keys
## fake completing the raspi-config
sed '/do_finish()/,/^$/!d' /usr/bin/raspi-config | sed -e '1i ASK_TO_REBOOT=0;' -e '$a do_finish' | bash