-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathopenmls.sh
More file actions
executable file
·112 lines (105 loc) · 3.09 KB
/
openmls.sh
File metadata and controls
executable file
·112 lines (105 loc) · 3.09 KB
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/env bash
# Usage info
show_help()
{
echo "Usage: ./openmls [setup] [pull] [switch] [clear] [branch] [status]"
echo " setup clone repositories for the first time"
echo " switch switch branches according to config"
echo " pull pull all repositories"
echo " clear delete all local repositories"
echo " branch list branches for all repositories"
echo " status git status on all repositories"
}
source config
repos=(
evercrypt-rust
algorithm-identifiers-rs
key-store-rs
hpke-rs
crypto
openmls
)
branches=(
evercrypt_rust
algorithm_identifiers_rs_branch
key_store_rs_branch
hpke_rs_branch
crypto_branch
openmls_branch
)
repo_urls=(
git@github.com:franziskuskiefer/evercrypt-rust.git
git@github.com:franziskuskiefer/algorithm-identifiers-rs.git
git@github.com:franziskuskiefer/key-store-rs.git
git@github.com:franziskuskiefer/hpke-rs.git
git@github.com:openmls/crypto.git
git@github.com:openmls/openmls.git
)
while [ $# -gt 0 ]; do
case "$1" in
setup)
echo "Cloning repositories"
for repo in "${repo_urls[@]}"
do
git clone --recurse-submodules $repo
for i in "${!repos[@]}"
do
echo "Switch to branch ${!branches[$i]} for ${repos[$i]} ..."
git -C ${repos[$i]} switch "${!branches[$i]}"
done
done
;;
pull)
echo "Updating repositories"
for repo in "${repos[@]}"
do
echo "Updating $repo ..."
git -C $repo pull
done
;;
branch)
echo ""
for repo in "${repos[@]}"
do
b=$(git -C $repo branch --show-current)
printf "%-30s %s %s\n" $repo $b
done
echo ""
;;
status)
echo ""
for repo in "${repos[@]}"
do
echo " > $repo git status ..."
git -C $repo status
done
echo ""
;;
switch)
echo "Switching branches"
for i in "${!repos[@]}"
do
echo "Switch to branch ${!branches[$i]} for ${repos[$i]} ..."
git -C ${repos[$i]} switch "${!branches[$i]}"
done
;;
clear)
echo "⚠️ Do you really want to delete everything?"
select yn in "Yes" "No"; do
case $yn in
Yes)
echo "Removing all repositories ..."
for repo in "${repos[@]}"
do
rm -rf $repo
done
exit
;;
*) exit;;
esac
done
;;
*) show_help; exit 2 ;;
esac
shift
done