iankelling.org
/
git
/
distro-setup
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
474fb77
)
better option for new system
author
Ian Kelling
<ian@iankelling.org>
Fri, 6 May 2016 04:12:14 +0000
(21:12 -0700)
committer
Ian Kelling
<ian@iankelling.org>
Fri, 6 May 2016 04:12:14 +0000
(21:12 -0700)
myunison
patch
|
blob
|
history
diff --git
a/myunison
b/myunison
index fa79b4af9e8abc680ff7cc065410d66b89111c36..68ec7d4ff72d3a7556e240e6272af3ff3bc7d2f0 100755
(executable)
--- a/
myunison
+++ b/
myunison
@@
-1,15
+1,16
@@
-#!/bin/bash -l
+#!/bin/bash -l
x
set -eE -o pipefail
trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
gen_args=()
do_snapshot=true
set -eE -o pipefail
trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
gen_args=()
do_snapshot=true
-while [[ $1
== -*
]]; do
+while [[ $1 ]]; do
case $1 in
-n) do_snapshot=false; shift ;;
--) shift; break ;;
-*) gen_args+=($1) ; shift ;;
case $1 in
-n) do_snapshot=false; shift ;;
--) shift; break ;;
-*) gen_args+=($1) ; shift ;;
+ *) host=$1; shift ;;
esac
done
esac
done
@@
-24,12
+25,11
@@
done
# todo: I should test pushing my unison version instead
# of pulling it.
/p/c/subdir_files/.unison/gen ${gen_args[@]}
# todo: I should test pushing my unison version instead
# of pulling it.
/p/c/subdir_files/.unison/gen ${gen_args[@]}
-if [[ ! $
1
]]; then
+if [[ ! $
host
]]; then
echo "$0: error: expected argument for hostname"
exit 1
fi
echo "$0: error: expected argument for hostname"
exit 1
fi
-host=$1
# todo: this doesn't deal with if the host is running arch too
# todo: this doesn't deal with if the host is running arch too
@@
-37,14
+37,22
@@
host=$1
# on an uncustomized jessie install.
scp /usr/bin/unison root@$host:/usr/local/bin
# on an uncustomized jessie install.
scp /usr/bin/unison root@$host:/usr/local/bin
+echo "$0: egen args ${gen_args[@]}"
if $do_snapshot; then
unison-snapshot
if $do_snapshot; then
unison-snapshot
- ssh root@$host unison-snapshot
+ if ! ssh root@$host unison-snapshot; then
+ if [[ ! ${gen_args[@]} ]]; then
+ # gen_args are all about syncing with new systems where
+ # we could expect the remote snapshot to not be available yet.
+ echo "$0: error: failed remote unison-snapshot"
+ exit 1
+ fi
+ fi
fi
f=unison-gtk
type -t $f &>/dev/null || f=unison-gtk2 # for arch
fi
f=unison-gtk
type -t $f &>/dev/null || f=unison-gtk2 # for arch
-if s $f "$
@
"; then
+if s $f "$
host
"; then
if [[ $host == frodo ]]; then
# only send data to the machine i do full backups to
p=/p/c/machine_specific/$HOSTNAME/.unison/
if [[ $host == frodo ]]; then
# only send data to the machine i do full backups to
p=/p/c/machine_specific/$HOSTNAME/.unison/