forked from slac-epics/eco_tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpush2slac-epics.sh
executable file
·29 lines (26 loc) · 968 Bytes
/
push2slac-epics.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
#!/bin/bash
API=https://api.github.com
SLAC_EPICS=https://github.com/slac-epics
test -z $1 && echo "Usage: push2slac-epics.sh githubUserName:githubPassword" 1>&2 && exit 1
GH_USER=$1
# Get list of repos under slac-epics
REPOS=/tmp/slac-epics-repos-$$
echo "Fetching $SLAC_EPICS module list ..."
curl ${API}/orgs/slac-epics/repos > $REPOS
pushd $GIT_TOP/package/epics/modules
for m in *.git
do
MODNAME=${m/.git/}
fgrep full_name $REPOS | fgrep "slac-epics/$MODNAME"
if (($?)); then
echo "Creating $SLAC_EPICS/$m ..."
curl -u $GH_USER ${API}/orgs/slac-epics/repos -d "{\"name\":\"$MODNAME\"}" 2>&1 > /dev/null
fi
echo "Updating $SLAC_EPICS/$m ..."
git --git-dir=$m push --all $SLAC_EPICS/$m
git --git-dir=$m push --tags $SLAC_EPICS/$m
done
popd
# Push base as well
git --git-dir=$GIT_TOP/package/epics/base/base.git push --all $SLAC_EPICS/epics-base.git
git --git-dir=$GIT_TOP/package/epics/base/base.git push --tags $SLAC_EPICS/epics-base.git