gjherbiet / dropsync

A DropBox configuration files synchronization utility

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dropsync, a DropBox configuration files synchronization utility

dropsync is a Perl script that will automatically place your selected set of configuration files (e.g. .profile, .bashrc, plist files in Mac OS X users’ Library folder, etc.)

Requirements

dropsync requires a fairly recent version of Perl and the following modules:

  • Getopt::Long
  • Term::ANSIColor
  • YAML
  • Data::Dumper
  • File::Basename
  • File::Path

It has been tested under Mac OS X 10.6.4 with Perl 5.10.0.

General behavior

dropsync will first create a dropsync folder in your Dropbox folder (generally /home/<username>/Dropbox or /Users/<Username>/Dropbox under Mac OS X).

Then for every file YOU have decided, dropsync will do the following:

  • If the file is in its original location (e.g. /home/<username>/.bashrc) but NOT in the dropsync folder, the file will be copied to the dropsync (e.g. dropbox/.bashrc) folder.
  • If the file is present in the dropsync folder (e.g. dropsync/.bashrc) but no file is present in your filesystem, then the file in your dropsync folder will be copied (e.g. /home/<username>/.bashrc will be copied to dropbox/.bashrc).
  • If the file is present in the dropsync folder (e.g. dropsync/.bashrc) and a file exists in the original location (e.g. /home/<username>/.bashrc), then the conflict is resolved by keeping the latest modified file and applying one of the two preceding policies accordingly.

Note: Conflic resolution policy can be modified by using one of the force-push or force-retrieve options described below.

Usage

dropsync [-h|--help] [--version] [--verbose|-v] [--debug|-d]
    [--config-file|-f <path to config file>] [--unsafe]

    --help, -h          : Print this help, then exit
    --version           : Print the script version, then exit
    --verbose, -v       : Enable verbose mode
    --debug, -d         : Enable debug mode

    --config-file, -f   : Alternate location for the configuration file
                          (Default: $HOME/.dropsyncrc.yaml)

    --force-push, -p    : Force pushing local files to the dropsync folder,
                          whatever the conflict resolution status.
    --force-retrieve, -r: Force retrieving local files from the dropsync folder,
                          whatever the conflict resolution status.

    --unsafe            : When run in unsafe mode, no backup of conflicting
                          files will be kept.
                          (This mode is not recommanded and disabled by default).

Configuration file

dropsync uses a YAML-formatted configuration file. It is mainly used to specify the list of files you would like to sync with your dropsync folder.

The default location for this configuration file is $HOME/.dropsyncrc.yaml, where $HOME is your home folder. This can be overriden using the --config-file or -f option when calling the dropsync script.

You can also use it to change some parameters (like the location of your Dropbox folder, or the name of the dropsync folder) to non-default values.

The following options are available from the configuration file:

dropbox_location: a string defining the location of the DropBox folder, if
                  different from the default value (default: "$HOME/Dropbox")
dropsync_folder:  a string defining the name of the dropsync folder in you
                  DropBox (default: "dropsync")
files:            a YAML-formatted list of path to the files you want to sync,
                  relative to your $HOME (e.g. ".bashrc" or ".config/somerc")

An example of configuration is given in the dropsyncrc.yaml file.

Planned (i.e. someday) features

  • Machine-specific version of files
  • Logging mechanism

License

This script is licensed under the GPL v.3
license. See previous link or gpl-3.0.txt for further details.

About

A DropBox configuration files synchronization utility