psync (533B) [raw]
1 #!/bin/sh 2 # Synchronize pash passwords with a central host 3 PHOST=${PSYNC_HOST:="raspberrypi"} 4 PUSER=${PSYNC_USER:="pi"} 5 6 die() { 7 echo "$1" 1>&2 8 exit 1 9 } 10 11 push() { 12 rsync -av $HOME/.local/share/pash/ $PUSER@$PHOST:.local/share/pash/ 13 } 14 15 pull() { 16 rsync -av $PUSER@$PHOST:.local/share/pash/ $HOME/.local/share/pash/ 17 } 18 19 sync() { 20 # Assume current passwords are latest (push then pull) 21 push 22 pull 23 } 24 25 case "$1" in 26 push) push ;; 27 pull) pull ;; 28 sync) sync ;; 29 *) die "usage: psync push|pull|sync" 30 esac