Sending changes to an MBARI LRAUV during deployment
===================================================
Sometimes it becomes necessary to send code changes to a LRAUV when it is 
already deployed on a mission at sea. This document outlines how to do that
safely.

steps
-----
0.  update your SVN repo
1.  make changes to mission script or configuration file on a shoreside machine
2.  examine the differences to the SVN repo -- make sure you only send what you 
    intend to send
3.  generate `md5` checksums for each of the modified files
4.  encode the differences as `sbd` attachments to send over Iridium
5.  send the attachments to Iridium via email (and cc tethys operators); include
    the diff and checksums in the body of the email
6.  wait for Iridium receipts for each attachment, record MTMSM numbers
7.  post `md5` checksums and MTMSM numbers as a Log Entry on [TethysDash](TethysDash)
8.  confirm receipt of `sbd` attachements by LRAUV, log on [TethysDash](TethysDash)
9.  confirm `md5` checksum of modified file on vehicle, log on [TethysDash](TethysDash)
10. copy modified file(s) into tagdiffs folder in deployment directory
11. check in change to SVN repo, log revision number on [TethysDash](TethysDash)
12. update svn in tethys@tellum:workspace/LRAUV
13. continue deployment as required

update SVN repo
---------------
On your machine (or your account on tellum), go to the SVN repository and 
update it:
    ~/Repos/lrauv.svn/LRAUV$ svn up

make changes
------------
In a text editor, chang the configuration files or mission scripts to do what 
is needed.

examine differences
-------------------
    ~/Repos/lrauv.svn/LRAUV$ svn diff
You can also redirect to save ths diff to a file:
    ~/Repos/lrauv.svn/LRAUV$ svn diff > /path/to/my-cool-diffs.txt

generate `md5` checksums
------------------------
    ~/Repos/lrauv.svn/LRAUV$ md5sum Missions/Science/science_to_67_70.xml 
    70d47f00d3577c68efd3f1a2c22112dd  Missions/Science/science_to_67_70.xml

encode differences as `sbd` attachments
---------------------------------------
    ~/Repos/lrauv.svn/LRAUV$ python Tools/encodeDiffs2Send.py Missions/Science/science_to_67_70.xml TethysEncryption
    source = Missions/Science/.svn/text-base/science_to_67_70.xml.svn-base
This will produce several files in the current directory, e.g.,
    science_to_67_70.xml.000.sbd
    science_to_67_70.xml.001.sbd
    ...

send email
----------
    to: data@sbd.iridium.com  
    cc: tethys_operator@mbari.org  
    subject: _vehicle code_  
    attachments:  science_to_67_70.xml.000.sbd,
                  science_to_67_70.xml.001.sbd, ... 
    message: anything you want, but diff and md5sum are suggested:  
> **`$ svn diff Missions/Science/science_to_67_70.xml`**  
> `_(copy text of diff here)_`  
> **`$ md5sum Missions/Science/science_to_67_70.xml`**  
> `70d47f00d3577c68efd3f1a2c22112dd  Missions/Science/science_to_67_70.xml`

Vehicle codes are:

* lrauv-tethys 300234011866620  

* lrauv-daphne 300234011783940  

get MTMSM numbers from iridium receipts
---------------------------------------

... the next few are pretty self-explanatory

check in change to SVN repo & log revision number on [TethysDash](TethysDash)
-----------------------------------------------------------------------------
    ~/Repos/lrauv.svn/LRAUV$ svn ci Missions/Science/science_to_67_70.xml -m"changed something in this mission"
    ~/Repos/lrauv.svn/LRAUV$ svn up && svn info
Copy the revision number to paste into a log on [TethysDash](TethysDash)

update SVN on tellum
--------------------
    ~/Repos/lrauv.svn/LRAUV$ ssh tethys@tellum
    $ cd workspace/LRAUV
    $ svn up

continue deployment as required
-------------------------------

------------------------------------------------------------------------------
[TethysDash] (http://http://aosn.mbari.org/TethysDash/)
------------------------------------------------------------------------------
                                        (this document is written in markdown)
