-
Notifications
You must be signed in to change notification settings - Fork 3
/
install.sh
65 lines (53 loc) · 1.68 KB
/
install.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
#! /usr/bin/env bash
releases=$(curl -s https://api.github.com/repos/iflytek/spark-ai-cli/releases/latest)
if which "sed" >/dev/null 2>&1;
then
tag_name=`echo "$releases" | grep '"tag_name": ' | sed -E 's/.*"tag_name": "([^"]+)".*/\1/' `
elif which "cut">/dev/null 2>&1;
then
tag_name=`echo "$releases" | grep '"tag_name": '|cut -d':' -f2 |tr -d '",'`
else
tag_nam="development"
fi
ARCH=$(uname -m)
architecture=""
case $ARCH in
i386) architecture="386" ;;
i686) architecture="386" ;;
x86_64) architecture="amd64" ;;
arm64) architecture="arm64" ;;
esac
PLATFORM=$(uname -s | awk '{print tolower($0)}')
BIN=aispark-$PLATFORM-$architecture
echo "###### Start Downloading and Installing aispark cli tool ########"
echo "Find latest release version: ${tag_name}"
echo "Downloading >>>>"
TAG=$tag_name
URL=https://repo.model.xfyun.cn/api/packages/aispark/generic/aispark/$TAG/$BIN
echo "Installing >>>>>>>> $URL"
mkdir -p /usr/local/bin/
SUFFIX=""
if which "gunzip" >/dev/null 2>&1;
then
if which "wget" >/dev/null 2>&1;
then
echo "using wget download..."
wget --no-check-certificate --quiet $URL.gz -O - |gunzip > /usr/local/bin/aispark
elif which "curl">/dev/null 2>&1;
then
echo "using curl download..."
curl -s -k --location $URL.gz |gunzip > /usr/local/bin/aispark
fi
else
if which "wget" >/dev/null 2>&1;
then
wget --no-check-certificate --quiet $URL -O /usr/local/bin/aispark
elif which "curl">/dev/null 2>&1;
then
curl -k --location --output /usr/local/bin/aispark $URL
fi
fi
chmod +x /usr/local/bin/aispark
echo "<<<<<<<<Installed Happy Use!"
echo ">>>>"
echo "Please enter aispark to start !!"