-
Notifications
You must be signed in to change notification settings - Fork 5
/
felix-package-broker-ng
executable file
·53 lines (42 loc) · 1.2 KB
/
felix-package-broker-ng
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
set -e
# BROKER=magnezone
# BROKER=squirtle
# BROKER=tentacool
BROKERS=(magnezone tentacool)
BROKER=${BROKERS[$RANDOM % ${#BROKERS[@]}]}
WORKDIR=/root/broker
source /usr/share/makepkg/util.sh
colorize
BUILDHOST=${BUILDHOST//[0-9]/}
_rsyncopts=
_files=
_srcfiles=
_brokerfiles=
_sigfiles=
_mark=
for _part in "$@"; do
if [[ $_part =~ .*\.zst$ ]]; then
_part=$(basename $_part)
_mark=1
_files="$_files $_part"
_srcfiles="$_srcfiles $BUILDHOST:packages/$PKGBASE/$_part"
_brokerfiles="$_brokerfiles $WORKDIR/$_part"
elif [[ $_part =~ .*\.sig$ ]]; then
_part=$(basename $_part)
_mark=1
_sigfiles="$_sigfiles ./$_part"
_brokerfiles="$_brokerfiles $WORKDIR/$_part"
elif [[ -z "$_mark" ]]; then
_rsyncopts="$_rsyncopts $_part"
else
_target="$_part"
fi
done
msg "Package Broker Transferring$_files ($BUILDHOST => $BROKER)"
ssh $BROKER "rsync $_rsyncopts $_srcfiles $WORKDIR/"
msg "Package Broker Transferring$_sigfiles (localhost => $BROKER)"
/usr/bin/rsync $_rsyncopts $_sigfiles "$BROKER:$WORKDIR/"
msg "Package Broker Transferring$_files ($BROKER => $_target)"
ssh $BROKER "rsync $_rsyncopts $_brokerfiles $_target; rm $_brokerfiles"
# /usr/bin/rsync "$@"