-
-
Notifications
You must be signed in to change notification settings - Fork 183
/
Copy pathkatana.sh
48 lines (37 loc) · 947 Bytes
/
katana.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
#!/usr/bin/env bash
# Check for katana updates and then run Katana
function failure
{
echo "[!] error: $*"
exit 1
}
function update_katana
{
# Prompt if user wants to update
declare -- ANSWER=;
until [[ $ANSWER =~ [yYnN] ]]; do
read -rp "[?] update katana (y/n): " ANSWER
done
if ! [[ $ANSWER =~ [yY] ]]; then
echo "[*] skipping update"
return
fi
echo "[+] installing katana upgrades"
# Grab new changes
git pull || failure "git pull failed"
# Run pip installer just in case
pip install -r requirements.txt || failure "pip install failed"
}
# Ensure we are in the repo
cd /katana
# Check for updates to current branch
echo "[+] checking for updates"
git remote update >/dev/null
if git status -uno | grep "branch is up to date with" >/dev/null; then
echo "[+] katana is up to date!"
else
echo "[*] newer katana version avaiable (you should rebuild your docker)"
update_katana
fi
# Run katana
python -m katana "$@"