aboutsummaryrefslogtreecommitdiff
path: root/sync-code
blob: eece25fb5de82eb31467ba5d13382b4231e82976 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
#
# sync code or home folder across systems
#

BASENAME="`basename $0`"
DEST="$1"
UNISON="unison"

# Use the following config if you need to sync with legacy systems
UNISON="unison-2.32.52"

if [ ! -z "$DEST" ]; then

  if [ "$BASENAME" == "sync-code" ]; then
    profile="$DEST-code"
  elif [ "$BASENAME" == "sync-irssi" ]; then
    profile="$DEST-irssi"
  elif [ "$BASENAME" == "sync-irssi-tor" ]; then
    profile="$DEST-irssi-tor"
  else
    profile="$DEST-home"
  fi

  if [ -f "$HOME/.unison/$profile.prf" ]; then
    $UNISON $profile
  else
    echo "No such profile $HOME/.unison/$profile.prf"
    exit 1
  fi

fi