Unison

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(Unison File Synchronizer)
(Installation)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Unison File Synchronizer ==
+
== Overview ==
  
[http://www.cis.upenn.edu/~bcpierce/unison Unison] is a file-synchronization tool for Unix and Windows. See the [http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html manual] for a detailed look at it's capabilities.
+
[http://www.cis.upenn.edu/~bcpierce/unison Unison] is a file-synchronization tool for Unix and Windows. It determines all differences between two directory trees and lets the user decide, how to proceed with every differing file.
  
 
Unison comes in two flavors:
 
Unison comes in two flavors:
Line 10: Line 10:
 
* between two directory trees on the same computer or  
 
* between two directory trees on the same computer or  
 
* between directory trees on two separate machines.
 
* between directory trees on two separate machines.
 +
 
For syncing desktop machine and Neo we use the latter. The recommended way to do this is the [http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html#rshmeth remote shell method]:
 
For syncing desktop machine and Neo we use the latter. The recommended way to do this is the [http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html#rshmeth remote shell method]:
 +
 
We start unison or unison-gtk on the desktop PC. The program will connect to the Neo via ssh and start a text-only instance of unison on the Neo to retrieve new files or deltas and to modify files on the Neo.
 
We start unison or unison-gtk on the desktop PC. The program will connect to the Neo via ssh and start a text-only instance of unison on the Neo to retrieve new files or deltas and to modify files on the Neo.
  
For this to work, ssh may not output any text itself, because unison parses the first line of console output to determine the version of unison on the remote computer. So we setup ssh for public key authentication:
+
{{note|The following deals with Unsion on '''Linux'''. It should apply for a [http://wiki.openmoko.org/wiki/Neo1973_and_Windows#USB_Ethernet_emulation network connection from a Windows machine] as well. Check [http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html#ssh-win unison manual] for details!}}
  
* Create a key pair on the desktop PC
 
* Configure the desktop PC for public key authentication
 
* Add the public key of the desktop PC to ~/.ssh/authorized_keys on the Neo
 
  
We need to install the text version of unison on the neo. Since there's no native opkg file available currently, we take the [http://packages.debian.org/lenny/armel/unison/download debian package]. Extract the file unison-2.27.57 and copy it to /usr/bin on neo. Create a symlink by the name of unison.
+
== SSH Setup ==
  
A unison configuration on the desktop PC (~/.unison/Openmoko.prf) might look like this
+
For this to work, ssh must not output any text itself, because unison parses the first line of console output to determine the version of unison on the remote computer:
 +
 
 +
* So we should setup ssh for public key authentication as described under [http://wiki.openmoko.org/wiki/USB_Networking#SSH_Keys USB Networking].
 +
* If you are working with more than one distribution to boot from or even with more than one device, I found it convenient to make them all use the same host key (/etc/dropbear/dropbear_rsa_host_key).
 +
 
 +
== Installation ==
 +
 
 +
On the Neo we use the text version of unison. Since there's no native opkg file available currently, we take the [http://packages.debian.org/lenny/armel/unison/download debian package (armel)]. Extract the file unison-2.27.57, copy it to /usr/bin on neo and create a symlink by the name of unison!
 +
 
 +
When calling Unison via ssh, the console must only show the unison version information:
 +
<pre>
 +
user@desktoppc:~$ ssh moko unison -version
 +
unison version 2.27.57
 +
</pre>
 +
 
 +
== Configuration ==
 +
 
 +
Unison allows for multiple configuration profiles on the desktop PC. My ~/.unison/moko.prf looks like this:
 
<pre>
 
<pre>
 
# Unison preferences file
 
# Unison preferences file
Line 29: Line 45:
 
# the directories on the desktop and on the neo
 
# the directories on the desktop and on the neo
 
root      = /home/user/Openmoko/data
 
root      = /home/user/Openmoko/data
root      = ssh://root@192.168.0.202//media/mmc4
+
root      = ssh://root@moko//media/mmc4
  
# common options
+
# common options (You can 'outsource' settings as include file. Comment out, if not needed! )
 
include Common.opt
 
include Common.opt
  
Line 45: Line 61:
 
ignore    = Path gps/Maps/*
 
ignore    = Path gps/Maps/*
 
ignorenot  = Path gps/Maps/OSM
 
ignorenot  = Path gps/Maps/OSM
ignore    = Path gps/log/*
 
  
 
</pre>
 
</pre>
  
On first execution of unison on the desktop, unison will create hashes for the entire directory tree. This may take a while.
+
== Using Unison ==
 +
 
 +
On first execution of unison on the desktop with the above profile
 +
<pre>
 +
unison-gtk moko
 +
</pre>
 +
unison will ask you to create a new hash archive. Depending on your directory tree, this may take a while. After that you may choose how to proceed with differences.
 +
 
 +
On the second call unison is actually able to detect changes and will automatically suggest appropriate actions on how to sync the directory trees:
 +
 
 +
[[Image:UnisonScreenshot1.png|thumb|908px|center|Unison-GTK syncing with the Neo]]
 +
 
 +
Unison can integrate programs for comparing and merging files during synchronization and offers a great number of other usefull options (see the [http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html manual]).
  
Unison supports various preferences to interactively include programs for comparing and merging files during synchronization (see the [http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html manual]).
+
[[Category:Applications]]

Latest revision as of 15:56, 4 July 2009

Contents

[edit] Overview

Unison is a file-synchronization tool for Unix and Windows. It determines all differences between two directory trees and lets the user decide, how to proceed with every differing file.

Unison comes in two flavors:

  • Text mode only version (debian package name: unison)
  • GTK-based graphical version (debian package name: unison-gtk)

Unison can sync

  • between two directory trees on the same computer or
  • between directory trees on two separate machines.

For syncing desktop machine and Neo we use the latter. The recommended way to do this is the remote shell method:

We start unison or unison-gtk on the desktop PC. The program will connect to the Neo via ssh and start a text-only instance of unison on the Neo to retrieve new files or deltas and to modify files on the Neo.

NOTE: The following deals with Unsion on Linux. It should apply for a network connection from a Windows machine as well. Check unison manual for details!



[edit] SSH Setup

For this to work, ssh must not output any text itself, because unison parses the first line of console output to determine the version of unison on the remote computer:

  • So we should setup ssh for public key authentication as described under USB Networking.
  • If you are working with more than one distribution to boot from or even with more than one device, I found it convenient to make them all use the same host key (/etc/dropbear/dropbear_rsa_host_key).

[edit] Installation

On the Neo we use the text version of unison. Since there's no native opkg file available currently, we take the debian package (armel). Extract the file unison-2.27.57, copy it to /usr/bin on neo and create a symlink by the name of unison!

When calling Unison via ssh, the console must only show the unison version information:

user@desktoppc:~$ ssh moko unison -version
unison version 2.27.57

[edit] Configuration

Unison allows for multiple configuration profiles on the desktop PC. My ~/.unison/moko.prf looks like this:

# Unison preferences file

label      = Syncing Openmoko

# the directories on the desktop and on the neo
root       = /home/user/Openmoko/data
root       = ssh://root@moko//media/mmc4

# common options (You can 'outsource' settings as include file. Comment out, if not needed! )
include Common.opt


# Do not compare modification time
times      = false

########### Music ##############
path       =      music

########### GPS Data ###########
path       =      gps
ignore     = Path gps/Maps/*
ignorenot  = Path gps/Maps/OSM

[edit] Using Unison

On first execution of unison on the desktop with the above profile

unison-gtk moko

unison will ask you to create a new hash archive. Depending on your directory tree, this may take a while. After that you may choose how to proceed with differences.

On the second call unison is actually able to detect changes and will automatically suggest appropriate actions on how to sync the directory trees:

Unison-GTK syncing with the Neo

Unison can integrate programs for comparing and merging files during synchronization and offers a great number of other usefull options (see the manual).

Personal tools

Unison File Synchronizer

Unison is a file-synchronization tool for Unix and Windows. See the manual for a detailed look at it's capabilities.

Unison comes in two flavors:

  • Text mode only version (debian package name: unison)
  • GTK-based graphical version (debian package name: unison-gtk)

Unison can sync

  • between two directory trees on the same computer or
  • between directory trees on two separate machines.

For syncing desktop machine and Neo we use the latter. The recommended way to do this is the remote shell method: We start unison or unison-gtk on the desktop PC. The program will connect to the Neo via ssh and start a text-only instance of unison on the Neo to retrieve new files or deltas and to modify files on the Neo.

For this to work, ssh may not output any text itself, because unison parses the first line of console output to determine the version of unison on the remote computer. So we setup ssh for public key authentication:

  • Create a key pair on the desktop PC
  • Configure the desktop PC for public key authentication
  • Add the public key of the desktop PC to ~/.ssh/authorized_keys on the Neo

We need to install the text version of unison on the neo. Since there's no native opkg file available currently, we take the debian package. Extract the file unison-2.27.57 and copy it to /usr/bin on neo. Create a symlink by the name of unison.

A unison configuration on the desktop PC (~/.unison/Openmoko.prf) might look like this

# Unison preferences file

label      = Syncing Openmoko

# the directories on the desktop and on the neo
root       = /home/user/Openmoko/data
root       = ssh://root@192.168.0.202//media/mmc4

# common options
include Common.opt


# Do not compare modification time
times      = false

########### Music ##############
path       =      music

########### GPS Data ###########
path       =      gps
ignore     = Path gps/Maps/*
ignorenot  = Path gps/Maps/OSM
ignore     = Path gps/log/*

On first execution of unison on the desktop, unison will create hashes for the entire directory tree. This may take a while.

Unison supports various preferences to interactively include programs for comparing and merging files during synchronization (see the manual).