-
Notifications
You must be signed in to change notification settings - Fork 81
/
Copy pathdownload.sh
executable file
·66 lines (47 loc) · 1.91 KB
/
download.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
#!/usr/bin/env sh
#
# Copyright (C) 2016-2020 Hiveon
# Distributed under GNU GENERAL PUBLIC LICENSE 2.0
# License information can be found in the LICENSE file or at https://github.com/minershive/hiveos-asic/blob/master/LICENSE.txt
#
readonly script_mission='Client for ASICs: Download bulk install scripts'
readonly script_version='1.0.1'
# consts
readonly bulk_install_dir='/tmp/hive-bulk-install'
readonly github_path='https://raw.githubusercontent.com/minershive/hiveos-asic/master/hive/hive-asic-net-installer'
# functions
print_script_version() {
echo -e "${YELLOW-}${script_mission}, version ${script_version}${NOCOLOR-}"
echo
}
is_on_busybox() {
[ -f "/usr/bin/compile_time" ]
}
# code
print_script_version
if is_on_busybox; then
which sshpass > /dev/null || ( echo -e "${CYAN}sshpass${NOCOLOR} is required, update Client to latest version: ${CYAN}selfupgrade${NOCOLOR}"; exit 1 )
else
which sshpass > /dev/null || ( echo -e "${CYAN}sshpass${NOCOLOR} is required, try ${CYAN}apt-get install sshpass${NOCOLOR}"; exit 1 )
which curl > /dev/null || ( echo -e "${CYAN}sshpass${NOCOLOR} is required, try ${CYAN}apt-get install curl${NOCOLOR}"; exit 1 )
fi
echo -e "Creating ${WHITE}${bulk_install_dir}...${NOCOLOR}"
mkdir -p "$bulk_install_dir" || ( echo -e "${RED}ERROR${NOCOLOR}"; exit 1 )
cd "$bulk_install_dir"
for file in config.txt ips.txt install.sh ipscan.sh firmware.sh setup.sh firmware-upgrade ipscan_model.sh firmware-L3.sh firmware-upgrade-L3; do
echo -e "${NOCOLOR}Downloading ${WHITE}$file...${DGRAY}"
if ! curl -L --insecure -O "${github_path}/$file"; then
fail=1
echo -e -n "${DGRAY}"
break
fi
echo
done
if [ -z "$fail" ]; then
for file in install.sh ipscan.sh firmware.sh setup.sh firmware-upgrade ipscan_model.sh; do
chmod +x "$file"
done
echo -e "${GREEN}Done.${NOCOLOR} All files downloaded to ${WHITE}${bulk_install_dir}${NOCOLOR}."
else
echo -e ${RED}"Something bad happen.${NOCOLOR}"
fi