Deploy Install Notes
===

There is a facility to update the buses deployed in the fleet with updates.
This is necessary as routes, drivers, etc. change.

As the system changes over to a newer version, there will be some legacy system
infrastructure to deal with making sure legacy systems aren't updated with new
code and the new systems aren't running legacy update scripts.

Legacy System Overview
---

The script `update_loop.sh` looks at the list of package checksums and sends them
to the server.
The server responds with updated packages, including the checksum, file size and server side
location.

If the DIU receives this information, `update_loop.sh` then proceeds to:

* Confirms the reported package is different from the local version
* Checks to make sure the process hasn't been flagged for being aborted (presence of a drop file)
* Generates expected information into temporary files
* `scp` the remote file locally
* Checks again for an abort drop file
* Runs `apply_update.sh` with the file, checksum, size, path and package version
* Cleans up

The `apply_update.sh` script

* Loads `common_values.sh`
* Confirms checksums are different, aborting install if they are the same
* Proceeds only if the reported checksum is the same as the actual checksum
* Extracts the `install.sh` script from the downloaded tar.gz package
* Runs `install.sh`
* `fix_pkg_perms.sh` as ssh will start to fail when keys or directories the keys are in
  don't have proper permissions or if executable bits on binaries aren't set properly
  will cause other processes to fail.

From what I can tell, the following is noteworthy:

* `install.sh` needs to return a proper value to indicate to `apply_update.sh` it's been successful
* `/tmp/reboot_flag` file will be touched if the system needs a reboot

Popufare Installation
---

Here's my suggestion on how to proceed:

* Popufare will ignore the `firmware.tgz` package updates
* Popufare will only extract config files (paddles, etc.) from the `config.tgz` packages and deposits
  them in the appropriate place
* Popufare will use a new package, `popufare_package.tgz`, that checks for a "magic" file (`/home/bus/config/popufare.witness`)
  and only proceeds if this file is present
