Feasibility check: programming Arduino MEGA 2560 with Arduino Uno, NO PC

That's my intent. I will have a second arduino with xbee wifi to

  1. Receive firmware update, store in SD card, check for integrity, and update main arduino when appropriate
  2. Power cycle wifi hotspot in case internet connection is lost for a predetermined amount of time
  3. xbee wifi can also be controlled by etherios device cloud so I can remotely power cycle main arduino data logger, camera, another device, except for the hotspot.

I'm just trying to learn how to programmatically flash sketch to arduino via ICSP when the second arduino has a new firmware. Any references you can suggest me read?