-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathql
More file actions
108 lines (94 loc) · 2.22 KB
/
ql
File metadata and controls
108 lines (94 loc) · 2.22 KB
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
#!/usr/bin/env bash
# Easy alias for escape codes
function echo() {
command echo -e "${@}"
}
function help_menu() {
echo
echo "${BOLD}QLauncher menu${RST}"
echo
echo "${BOLD}USAGE:${RST} ${0} <options>"
echo
echo "${BOLD}EXAMPLE:${RST} ${0} -s"
echo
echo "${BOLD}EXAMPLE:${RST} ${0} --status"
echo
echo " -b | --bind: Bind account to QQQ App"
echo " -c | --check: Verify Installation"
echo " -f | --freeze: Stop miner"
echo " -h | --help: Help menu"
echo " -k | --kickoff: Start miner"
echo " -r | --restart: Restart miner"
echo " -s | --status: Status miner"
echo " -u | --update: Update QLauncher"
echo
}
function setup_variables() {
DIRQL="$HOME/qlauncher"
ZIP="app.tar.gz"
BOLD="\033[1m"
RST="\033[0m"
QLS="$DIRQL/qlauncher.sh"
}
function bind() {
$QLS bind
}
function check() {
$QLS check
}
function freeze() {
$QLS stop
}
function kickoff() {
$QLS start
}
function restart() {
$QLS restart
}
function status() {
$QLS status
}
function zipdl() {
wget https://github.com/poseidon-network/qlauncher-linux/releases/latest/download/ql-linux.tar.gz -O "${ZIP}"
tar -vxzf "${ZIP}" -C "${DIRQL}"
echo "start QLauncher"
kickoff
}
function update() {
if [[ -d ${DIRQL} ]]; then
echo "folder exist, deleting current qlauncher folder"
freeze
rm -rf ${DIRQL}
mkdir ${DIRQL}
if [[ -e ${ZIP} ]]; then
echo
# remove package if exist then start updating
rm -rf "${ZIP}"
zipdl
else
echo
# seems file doesn't exist, lets start updating
zipdl
rm -rf "${ZIP}"
fi
else
echo
echo "QLauncher doesn't exist, read the README for how to install it"
echo
fi
}
function parse_parameters() {
case "${1}" in
"-b"|"--bind") bind ;;
"-c"|"--check") check ;;
"-f"|"--freeze") freeze ;;
"-k"|"--kickoff") kickoff ;;
"-r"|"--restart") restart ;;
"-s"|"--status") status ;;
"-u"|"--update") update ;;
# HELP!
"-h"|"--help"|*) help_menu ;;
esac
}
setup_variables
parse_parameters "${@}"