Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 99 lines (78 sloc) 2.51 KB
#!/bin/bash
location="$USER@$HOSTNAME" # must be unique for each host
locations=(user@home user@laptop user@work) # where I am
remotes=(user@server user@server user@server) # where to sync profiles to
unison_dirs=($HOME/.unison $HOME/.unison $HOME/.unison) # optional: to use unisons' *.prf files
# reduce ssh connection time and ask password/passphrase only once
# (control socket and remote will be added automatically)
# comment the following line to disable connection sharing
ssh_master=(ssh -N -M -S)
## logging and notifications
## specify a file for a short status summary of synchronized profiles
# summary=/tmp/unisync_summary
# conflict_log=/tmp/unison_conflicts # requires unison-merge
# if [[ -n DISPLAY ]] && type notify-send &>/dev/null ; then
# conflict_notify="notify-send -a unisync conflict:" # requires unison-merge
# sync_error_notify="notify-send -a unisync"
# fi
backup_args=(
-backup "Name *"
-backup "Name .*" # dot files
-backuploc local
-maxbackups 2
)
merge_args=(
-merge "Regex .* -> unison-merge newer CURRENT1 CURRENT2 NEW \
$conflict_log '$conflict_notify'"
)
ignoe_args=(
-ignore "Name *~"
-ignore "Name #*#"
-ignore "Name *.tmp"
)
# unison_args are passed to unison on every unison execution
unison_args=(
-sshargs "-C -S $ssh_socket"
-batch
-times
# -force newer
"${backup_args[@]}" # backup enabled
# "${merge_args[@]}" # automatic conflict resolution disabled
"${ignoe_args[@]}"
)
# variables
SYNC="/home/user/Sync"
# profiles
# profile 'unisyncrc' is treated specially: if it is updated during
# synchronization, its contents is re-read
profile_01=unisyncrc
local_01="$HOME"
remote_01="$SYNC"
args_01=(-path .unisyncrc)
profile_02=unison
local_02="$HOME/.unison"
remote_02="$SYNC/.unison"
args_02=(-ignore "Name ?*" -ignorenot "Name *.prf")
profile_10=shell
local_10="$HOME"
remote_10="$SYNC/configs"
args_10=(-path .bashrc -path .bash_profile -path .bash_logout)
profile_20=hg
local_20="$HOME"
remote_20="$SYNC/configs"
args_20=(-path .hgrc)
profile_21=git
local_21="$HOME"
remote_21="$SYNC/configs"
args_21=(-path .gitconfig)
profile_30=music
local_30="$HOME/Music"
remote_30=("$SYNC/HomeMusic" "$SYNC/LaptopMusic" "$SYNC/WorkMusic")
auto_30=false # synchronize on demand
profile_31=documents
local_31=("$HOME/Docs" "$HOME/Docs" "$HOME/HomeDocs")
remote_31="$SYNC/Docs"
# groups
group_configs=(shell hg git)
group_vcs_configs=(hg git)
group_data=(music documents)