-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgitma.sh
executable file
·116 lines (101 loc) · 3.1 KB
/
gitma.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/bash
source /opt/conda/bin/activate
conda activate gitma
red='\033[31m'
green='\033[32m'
yellow='\033[33m'
blue='\033[34m'
purple='\033[35m'
bold='\033[1m'
italic='\033[3m'
ul='\033[4m'
clear='\033[0m'
color_red(){
echo -ne $red$1$clear
}
color_green(){
echo -ne $green$1$clear
}
color_yellow(){
echo -ne $yellow$1$clear
}
color_blue(){
echo -ne $blue$1$clear
}
run_jupyter() {
echo ""
echo "$(color_blue 'Starting jupyter')"
echo ""
jupyter lab \
--notebook-dir=./src/demo/notebooks/ \
--ip='*' \
--port=8888 \
--no-browser \
--allow-root
}
update_gitma() {
echo ""
echo "$(color_blue 'Updating conda')"
echo ""
conda update -y -n gitma --all
echo ""
echo "$(color_blue 'Updating GitMA')"
echo ""
python -m pip install --upgrade git+https://github.com/forTEXT/gitma
python -m pip install --upgrade "pygamma-agreement[CBC]"
}
reinstall_demo(){
echo ""
echo "$(color_red 'Removing old GitMA demo files')"
echo ""
rm -rf ./src
echo "Restoring GitMA demo files"
# git clone https://github.com/forTEXT/gitma.git ./src
cp -R ./backup ./src
}
press_enter() {
echo ""
echo -e "$bold$(color_blue 'Press Enter to continue ')"
read
clear
}
incorrect_selection() {
echo ""
echo -e "$(color_red 'Incorrect selection!') Try again."
}
print_logo(){
echo -ne "
$bold
$blue ___ $purple ___ ___
$blue / /\ ___ ___ $purple /__/\ / /\
$blue / /:/_ / /\ / /\ $purple | |::\ / /::\
$blue / /:/ /\ / /:/ / /:/ $purple | |:|:\ / /:/\:\
$blue / /:/_/::\ /__/::\ / /:/ $purple __|__|:|\:\ / /:/~/::\
$blue /__/:/__\/\:\ \__\/\:\__ / /::\ $purple/__/::::| \:\ /__/:/ /:/\:\
$blue \ \:\ /~~/:/ \ \:\/\ /__/:/\:\ $purple\ \:\~~\__\/ \ \:\/:/__\/
$blue \ \:\ /:/ \__\::/ \__\/ \:\ $purple \ \:\ \ \::/
$blue \ \:\/:/ /__/:/ \ \:\ $purple \ \:\ \ \:\
$blue \ \::/ \__\/ \__\/ $purple \ \:\ \ \:\
$blue \__\/ $purple \__\/ \__\/
$clear$italic$blue https://github.com/forTEXT/gitma
$clear$italic$blue v0.0.9 2024-05-08
$clear$italic$blue CATMA 7
$clear"
}
until [ "$selection" = "0" ]; do
clear
print_logo
echo -ne "
$(color_blue 1): Run jupyter
$(color_blue 2): Reinstall demo files $(color_red '(all changes will be lost!)')
$(color_red q): Exit
$bold$(color_blue 'Enter selection'): "
read selection
case $selection in
1 ) clear ; run_jupyter ; press_enter ;;
2 ) clear ; reinstall_demo ; press_enter ;;
3 | u | U ) clear ; update_gitma ; press_enter ;;
0 | x | X | q | ":q" ) clear ; exit ;;
* ) clear ; incorrect_selection ; press_enter ;;
esac
done