-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmirror-linphone-repos.sh
executable file
·90 lines (71 loc) · 1.75 KB
/
mirror-linphone-repos.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
# Linphone-Sync (https://github.com/Linphone-sync)
# Mirror Linphone source codes from the official upstream repositories to GitHub
DATE=/bin/date
function log {
DATE_FORMAT=+%Y-%m-%d_%H:%M:%S
echo `${DATE} ${DATE_FORMAT}:` $1
}
function die {
log "$@"
exit 1
}
function usage {
die "Usage: $0 local_linphone_sync_path"
}
LINPHONE_REPOS=(
'antlr3.git'
'axmlrpc.git'
'bcg729.git'
'belle-sip.git'
'bzrtp.git'
'cunit.git'
'gsm.git'
'libilbc-rfc3951.git'
'linphone-android.git'
'linphone.git'
'linphone-iphone.git'
'mediastreamer2.git'
'msamr.git'
'msilbc.git'
'msopenh264.git'
'mssilk.git'
'mswebrtc.git'
'msx264.git'
'ortp.git'
'polarssl.git'
'speex.git'
'srtp.git'
'webrtc.git'
)
# Check if first arugment exists (local_linphone_sync_path)
if [ "$#" -ne 1 ]; then
usage
fi
LOCAL_REPO_PATH=$1
echo "===== Starting to mirror Linphone repositories from the official Belledonne's git servers to GitHub ====="
COUNT=0
while [ "x${LINPHONE_REPOS[COUNT]}" != "x" ]
do
GITREPO=${LOCAL_REPO_PATH}/${LINPHONE_REPOS[COUNT]}
if [ ! -d ${GITREPO} ]; then
die "ERROR: directory does not exist: ${GITREPO}"
fi
cd ${GITREPO}
REMOTE_ORIGIN_URL=`git config --get remote.origin.url`
REMOTE_ORIGIN_PUSHURL=`git config --get remote.origin.pushurl`
log "Starting to mirror changes from [${GITREPO}] repository"
log "Fetching remote changes from [${REMOTE_ORIGIN_URL}]"
git fetch -p origin
if [ $? -ne 0 ]; then
die "ERROR: git fetch failed."
fi
log "Pushing changes (--mirror) to [${REMOTE_ORIGIN_PUSHURL}]"
git push --mirror
if [ $? -ne 0 ]; then
die "ERROR: git push --mirror failed."
fi
log "[${GITREPO}] mirror has been finished"
COUNT=$(( $COUNT + 1 ))
done
log "===== Changes have been pushed to GitHub successfully ====="