-
Notifications
You must be signed in to change notification settings - Fork 9
/
syncrepo.sh
executable file
·36 lines (32 loc) · 921 Bytes
/
syncrepo.sh
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
33
34
35
36
#! /bin/bash
#
# sync-repo.sh
# Copyright (C) 2016-2017 Adrian Perez <[email protected]>
#
# Distributed under terms of the GPLv3 license.
#
set -e
LOCAL="$(dirname "$0")/.flatpak-repo/"
REMOTE='[email protected]:/srv/http/flatpak.perezdecastro.org/revolt/'
RSYNC_REPOS=$(type -P ostree-rsync-repos rsync-repos \
"$(dirname "$0")/ostree-releng-scripts/rsync-repos" | head -1)
if [[ -z ${RSYNC_REPOS} ]] ; then
echo "$0: The ostree-rsync-repos (or rsync-repos) tool is not installed."
echo 'Please install from https://github.com/ostreedev/ostree-releng-scripts'
echo 'and make sure the tools are in your $PATH'
exit 1
fi 1>&2
declare -a rsync_command=( "${RSYNC_REPOS}" )
case $1 in
push)
rsync_command+=( --src "${LOCAL}" --dest "${REMOTE}" )
;;
pull)
rsync_command+=( --src "${REMOTE}" --dest "${LOCAL}" )
;;
*)
echo "Usage: $0 push|pull" 1>&2
exit 1
;;
esac
exec "${rsync_command[@]}"