-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathupdate.sh
More file actions
executable file
·50 lines (44 loc) · 890 Bytes
/
update.sh
File metadata and controls
executable file
·50 lines (44 loc) · 890 Bytes
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
#!/bin/sh
check_update_available() {
git fetch
if git status | grep 'Your branch is up to date'; then
echo "Already on the latest version."
exit
else
echo "Found a new version, starting update..."
fi
}
self_update() {
git fetch
git reset --hard HEAD
git pull --force
echo "Installing the new version..."
npm install
npm run build
exit
}
dry_run() {
echo 'Running update dry run'
rm -rf tmp
mkdir tmp
cd tmp || exit
git clone -b new-gui https://github.com/shardeum/validator-gui.git gui
cd gui || exit
if npm install && npm run build; then
echo 'Dry run update successful'
cd ../..
rm -rf tmp
else
echo 'Compilation dry run failed! Canceling update process.'
cd ../..
rm -rf tmp
exit 1
fi
}
main() {
echo '----- STARTING GUI UPDATE PROCESS -----'
check_update_available
dry_run
self_update
}
main