-
Notifications
You must be signed in to change notification settings - Fork 0
/
stationhubUpdater.sh
130 lines (114 loc) · 3.97 KB
/
stationhubUpdater.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/bin/sh
echo "░█▀▀░▀█▀░█▀█░▀█▀░▀█▀░█▀█░█▀█░█░█░█░█░█▀▄
░▀▀█░░█░░█▀█░░█░░░█░░█░█░█░█░█▀█░█░█░█▀▄
░▀▀▀░░▀░░▀░▀░░▀░░▀▀▀░▀▀▀░▀░▀░▀░▀░▀▀▀░▀▀░"
OS="`uname`"
case $OS in
'Linux')
OS='Linux'
alias ls='ls --color=auto'
;;
'WindowsNT')
OS='Windows'
;;
'Darwin')
OS='Mac'
;;
'AIX')
;;
*)
OS='Windows'
;;
esac
echo Detected OS: $OS
dir=`dirname "$0"`
echo "Installing jq.."
case $OS in
'Linux')
curl -sS https://webi.sh/jq | sh
;;
'Windows')
curl -L -o /usr/bin/jq.exe https://github.com/stedolan/jq/releases/latest/download/jq-win64.exe
setx path "%path%;C:\Program Files\7-Zip"
;;
'Mac')
curl -sS https://webi.sh/jq | sh
;;
'AIX')
;;
*)
curl.exe -sS https://webi.ms/jq | powershell
setx path "%path%;C:\Program Files\7-Zip"
;;
esac
echo "Grabbing latest release.."
DATA=$(curl -sS https://api.github.com/repos/unitystation/stationhub/releases/latest | jq '.assets' > releases.json)
DOWNLOADLINK=sss
FILENAME=aaa
#TODO: Use labels instead of the index of releases. Talk to GIllies and Bod about this.
case $OS in
'Linux')
DOWNLOADLINK=$(jq -r .[0].browser_download_url releases.json)
FILENAME=$(jq -r .[0].name releases.json)
;;
'Windows')
DOWNLOADLINK=$(jq -r .[2].browser_download_url releases.json)
FILENAME=$(jq -r .[2].name releases.json)
;;
'Mac')
DOWNLOADLINK=$(jq -r .[1].browser_download_url releases.json)
FILENAME=$(jq -r .[1].name releases.json)
;;
'AIX') ;;
*) ;;
esac
echo "Release found: $FILENAME"
echo "Downlading from: $DOWNLOADLINK"
curl -L $DOWNLOADLINK > $FILENAME
echo "Looking for 7zip.."
if ! command -v 7z &> /dev/null
then
echo "7zip could not be found. Extract files manually."
case $OS in
'Linux')
xdg-open https://7-zip.org/
;;
'Windows')
msg "%username%" 7zip could not be found. Extract files manually.
start https://7-zip.org/
;;
'Mac')
open https://7-zip.org/
;;
'AIX') ;;
*) ;;
esac
exit 1
fi
echo "Extracting.."
case $OS in
'Linux')
7z x $FILENAME -o*
;;
'Windows')
echo "Extracting in $dir"
7z x $FILENAME -o"$dir\stationhub"
;;
'Mac')
7z x $FILENAME
;;
'AIX')
;;
*)
7z x $FILENAME
;;
esac
echo " █████ █████ ██████ ███
░░███ ░░███ ███░░███ ░███
░███ ░███ ██████ █████ █████ ██████ ░███ ░░░ █████ ████ ████████ ░███
░███████████ ░░░░░███ ░░███ ░░███ ███░░███ ███████ ░░███ ░███ ░░███░░███ ░███
░███░░░░░███ ███████ ░███ ░███ ░███████ ░░░███░ ░███ ░███ ░███ ░███ ░███
░███ ░███ ███░░███ ░░███ ███ ░███░░░ ░███ ░███ ░███ ░███ ░███ ░░░
█████ █████░░████████ ░░█████ ░░██████ █████ ░░████████ ████ █████ ███
░░░░░ ░░░░░ ░░░░░░░░ ░░░░░ ░░░░░░ ░░░░░ ░░░░░░░░ ░░░░ ░░░░░ ░░░ "
read -rn1