Skip to content

Commit d49c8ee

Browse files
committed
Do not compile for now, use the binary program.
1 parent 84521fc commit d49c8ee

1 file changed

Lines changed: 34 additions & 12 deletions

File tree

mtproxy.sh

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ WORKDIR=$(dirname $(readlink -f $0))
33
cd $WORKDIR
44
pid_file=$WORKDIR/pid/pid_mtproxy
55

6+
7+
MTG_URL="https://github.com/ellermister/mtproxy/releases/download/v0.04/$(uname -m)-mtg"
8+
MTPROTO_URL="https://github.com/ellermister/mtproxy/releases/download/v0.04/mtproto-proxy"
9+
610
check_sys() {
711
local checkType=$1
812
local value=$2
@@ -243,30 +247,47 @@ function is_pid_exists() {
243247
fi
244248
}
245249

246-
do_install() {
247-
cd $WORKDIR
248-
249-
mtg_provider=$(get_mtg_provider)
250+
do_install_proxy() {
251+
$mtg_provider=$1
250252

251253
if [[ "$mtg_provider" == "mtg" ]]; then
252254
local arch=$(get_architecture)
253255
if [ "amd64" != "$arch" ]; then
254256
echo -e "[\033[33m提醒\033[0m] 你的系统架构不支持安装 mtg\n"
255257
exit 1
256258
fi
257-
local mtg_url="https://github.com/ellermister/mtproxy/releases/download/v0.04/mtg"
258-
wget $mtg_url -O mtg
259+
wget $MTG_URL -O mtg -q
259260
chmod +x mtg
260-
261-
[[ -f "./mtg" ]] && ./mtg && echo "Installed for mtg"
261+
./mtg
262+
exit_code=$?
263+
if [ $exit_code -ne 0 ]; then
264+
echo -e "[\033[33m提醒\033[0m] 安装 mtg 失败\n"
265+
exit 1
266+
fi
267+
echo "Installed for mtg"
262268
else
263-
wget https://github.com/ellermister/mtproxy/releases/download/v0.04/mtproto-proxy -O mtproto-proxy -q
269+
wget $MTPROTO_URL -O mtproto-proxy -q
264270
chmod +x mtproto-proxy
271+
./mtproto-proxy
272+
exit_code=$?
273+
if [ $exit_code -ne 0 ] && [ $exit_code -ne 2 ]; then
274+
echo -e "[\033[33m提醒\033[0m] 安装 mtproto-proxy 失败\n"
275+
exit 1
276+
fi
277+
echo "Installed for mtproto-proxy"
265278
fi
266279

267280
if [ ! -d "./pid" ]; then
268281
mkdir "./pid"
269282
fi
283+
}
284+
285+
do_install() {
286+
cd $WORKDIR
287+
288+
mtg_provider=$(get_mtg_provider)
289+
290+
do_install_proxy $mtg_provider
270291

271292
}
272293

@@ -615,16 +636,17 @@ elif [[ "debug" == $param ]]; then
615636
elif [[ "restart" == $param ]]; then
616637
stop_mtp
617638
run_mtp
618-
debug_mtp
619639
elif [[ "reinstall" == $param ]]; then
620640
reinstall_mtp
621641
elif [[ "build" == $param ]]; then
622642
arch=$(get_architecture)
623643
if [[ "$arch" == "amd64" ]]; then
624-
build_mtproto 1
644+
# build_mtproto 1
645+
do_install_proxy "mtproto-proxy"
625646
fi
626647

627-
build_mtproto 2
648+
# build_mtproto 2
649+
do_install_proxy "mtg"
628650
else
629651
if ! is_installed; then
630652
echo "MTProxyTLS一键安装运行绿色脚本"

0 commit comments

Comments
 (0)