master
bel 2021-09-08 14:10:10 -06:00
parent 622ceaa922
commit b4ea5e108f
2 changed files with 14 additions and 3 deletions

17
sync.sh
View File

@ -27,14 +27,23 @@ function main() {
} }
function install() { function install() {
if ! go version; then
echo "Must install go" >&2
exit 1
fi
export GOFLAGS=""
mkdir -p "$GOPATH/bin/$(uname)" mkdir -p "$GOPATH/bin/$(uname)"
for i in ncw/rclone restic/restic; do for i in ncw/rclone restic/restic; do
local b="${i##*/}" local b="${i##*/}"
if [ -e "$GOPATH/bin/$(uname)/$b" ]; then if [ -e "$GOPATH/bin/$(uname)/$b" ]; then
continue continue
fi fi
go get -u "github.com/$i" || true mkdir -p $GOPATH/src/github.com/${i%/*}
pushd "$GOPATH/src/github.com/$i" #go get -u "github.com/$i" || true
pushd "$GOPATH/src/github.com/${i%/*}"
git clone --depth 1 --branch master https://github.com/$i
cd ${i##*/}
go get ./...
case "$i" in case "$i" in
restic* ) restic* )
go run build.go go run build.go
@ -116,7 +125,9 @@ function restore() {
fi fi
mv "$HOME/$path-restore" "$HOME/$path" mv "$HOME/$path-restore" "$HOME/$path"
done done
clean_remote if [ -z "${DIRTY:-}" ]; then
clean_remote
fi
} }
function clean_remote() { function clean_remote() {