-
Notifications
You must be signed in to change notification settings - Fork 5
/
build-main2
59 lines (58 loc) · 1.72 KB
/
build-main2
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
#! /bin/bash
if [ ! -z "$1" ];then
TAGS="$1"
else
TAGS=""
fi
function update_file() {
if [ ! -z "$1" ] && [ ! -z "$2" ] && [ ! -z "$3" ];then
GetValue="$(cat "$3" | grep "$1")"
GetPath=${3/"./"/"/"}
[ "$GetValue" != "$2" ] && \
sed -i "s/$1.*/$2/g" "$3"
[ ! -z "$(git status | grep "modified" )" ] && \
git add "$3" && \
git commit -m "update builder $2"
fi
}
function update_fileB() {
if [ ! -z "$1" ] && [ ! -z "$2" ] && [ ! -z "$3" ];then
GetValue="$(cat "$3" | grep "$1")"
GetPath=${3/"./"/"/"}
[ "$GetValue" != "$2" ] && \
sed -i "s/$1.*/$2"'"'"/g" "$3"
[ ! -z "$(git status | grep "modified" )" ] && \
git add "$3" && \
git commit -m "update builder $2"
fi
}
function make_changes() {
git checkout master && git checkout -b $1-$2
git checkout $1-$2 && update_fileB "00000" "$2" "./$1.sh" && update_file 'do-main.sh' "$1.sh" './.circleci/config.yml'
}
git reset --hard
ListBranch=""
for Files in do-main2
do
if [ "$TAGS" == "all" ];then
if [[ -e ${Files}.sh ]];then
for Types in clang dtc gcc
do
git branch -D $Files-$Types
make_changes $Files $Types
ListBranch="$ListBranch $Files-$Types"
git checkout master
done
fi
else
if [[ -e ${Files}.sh ]];then
if [ "$TAGS" == "gcc" ] || [ "$TAGS" == "clang" ] || [ "$TAGS" == "dtc" ];then
git branch -D $Files-$TAGS
make_changes $Files $TAGS
ListBranch="$ListBranch $Files-$TAGS"
git checkout master
fi
fi
fi
done
git push -f bb $ListBranch