forked from hexparrot/mineos-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_webui.sh
39 lines (29 loc) · 1.03 KB
/
update_webui.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
#!/bin/bash
# Reset MineOS git repository to current master
LOG="/var/log/mineos.log"
if [[ $EUID -ne 0 ]]; then
echo "reset_scripts.sh must be run as root" 1>&2 | tee -a $LOG
exit 1
fi
ECHO_LOG_N () {
echo -en "$1" | tee -a $LOG
}
ECHO_LOG () {
echo -e "$1" | tee -a $LOG
}
ECHO_LOG_N "Script execution started on: "
date | tee -a $LOG
ECHO_LOG_N "Updating mineos-node repository..."
git fetch >> $LOG
if [ $? -eq 0 ]; then ECHO_LOG "OK"; else ECHO_LOG "FAILED" && exit 1; fi
ECHO_LOG_N "Pulling master branch..."
git pull origin master >> $LOG
if [ $? -eq 0 ]; then ECHO_LOG "OK"; else ECHO_LOG "FAILED" && exit 1; fi
ECHO_LOG_N "Updating npm dependencies..."
npm install --no-spin >> $LOG
if [ $? -eq 0 ]; then ECHO_LOG "OK"; else ECHO_LOG "FAILED" && exit 1; fi
ECHO_LOG_N "Setting node javascript files to executable..."
chmod +x mineos_console.js webui.js update_webui.sh reset_webui.sh >> $LOG
if [ $? -eq 0 ]; then ECHO_LOG "OK"; else ECHO_LOG "FAILED" && exit 1; fi
ECHO_LOG_N "Script execution ended on: "
date | tee -a $LOG