Jessie Full Unattended New Image Setup Script

Here is a script that I use when wiping/re-imaging my test Pi with Jessie Full. It automates all the config changes I like to make, as well as installs Cayenne. Total time for the script to execute with apt-get upgrade enabled is ~30 minutes with a class 4 SD card (should be much faster with class 10). I have built in a bunch of error checks but if you find something that breaks or have any suggestions to add something to it just send me a message.

A list of functions:

  • Set a temp file to run on next boot
  • Change time zone
  • Change keyboard layout
  • Change over scan setting
  • Download the Cayenne install script
  • Create temp script to run on next boot
  • Temporarily enable wait for network on boot
  • Boot to console instead of desktop for the next boot to see progress of script
  • Resize the root partition

After reboot

  • Finish partition resize
  • Run apt-get update/upgrade (comment out line 277 to disable upgrade for faster setup time)
  • Change boot option to boot to desktop again
  • Remove script to run on boot
  • Remove wait for network on boot
  • Delete the temp script
  • Run the Cayenne installer which will reboot at the end

After the Pi is booted back up the the desktop everything is ready to go.

WARNING
I do not recommend running this script on any Pi that does not have a fresh image of Jessie Full installed. It should work fine but note this script assumes the following:

  • /etc/rc.local has not been modified
  • There are no Cayenne installers in /home/pi at the time of execution

To use the script: Download the file here https://github.com/ats1080/cayenne_install/blob/master/cayenne_setup.sh and run it. There are some default values defined at the top of the file. You can change them to whatever you want if you do not want the default values I have selected, or just specify your options as parameters as below.

Here is the usage:

-t timezone
-timezone timezone
Sets time zone. See List of tz database time zones - Wikipedia for valid time zones.

-do true/false
-disableoverscan true/false
Enable/disable over scan. Disable to get rid of black bars around computer monitor.

-kl keyboard layout code
-keyboardlayout keyboard layout code
Sets keyboard layout. Default on fresh install is set to gb which sets @ to ", etc. on American keyboard. See Keyboard Layouts - Pastebin.com for a list of valid layouts (use 2 digit code only).

Add installer file name at the end of the command.

Example:
cayenne_setup.sh -t America/New_York -do true -kl us rpi_xxxxxxxxxx.sh

I’ve uploaded it to github so you can run it this way as well:

curl https://raw.githubusercontent.com/ats1080/cayenne_install/master/cayenne_setup.sh -o cayenne_setup.sh && bash cayenne_setup.sh -t America/New_York -do true -kl us rpi_xxxxxxxxxx.sh

3 Likes

This is great!