This repository has been archived by the owner on Aug 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
run.sh
executable file
·89 lines (70 loc) · 1.34 KB
/
run.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
#!/bin/bash
# functions
# funntion confirm
# takes two arguments, prompt string and default condition.
function confirm() {
default="Y"
q_string="[Y/n]"
case "$2" in
no)
default="n"
q_string="[y/N]"
;;
*)
default="y"
q_string="[Y/n]"
;;
esac
#change prompt
read -r -p "$1 $q_string: " response
case "$response" in
"")
if [ $default == "y" ]; then
true
else
false
fi
;;
[yY][eE][sS] | [yY])
true
;;
[nN][oO] | [nN])
false
;;
*)
false
;;
esac
}
git ls-remote -q >/dev/null 2>&1
# this helped me save so much time
# https://stackoverflow.com/a/18999726
if [ $? -ne 0 ]; then
git init
git remote add origin https://github.com/molangning/bypass-js.git
git fetch
git reset origin/main
git checkout -t origin/main
fi
if [ ! -f ".setup_done" ]; then
if confirm "Do you want to use the development branch?" n; then
git pull
git checkout dev
touch .use_dev
fi
if confirm "Do you want to keep local changes?" n; then
touch .keep_changes
fi
touch .setup_done
fi
if [ ! -f ".keep_changes" ]; then
git fetch --all
if [ -f ".use_dev" ]; then
git reset origin/dev --hard
else
git reset origin/main --hard
fi
fi
npm install uuid compression cookie-parser node-fetch express moment-timezone --save
git pull
node app.js