-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
100 lines (95 loc) · 2.41 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
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
#!/bin/bash
clear
echo "Sedang Cek Koneksi Internet"
if ping -c 3 8.8.8.8 &> /dev/null
then
# Download Package
clear
printf "Menjalankan Update Package"
opkg update > tbot.log
printf " Selesai "
echo ""
printf "Menjalankan Install Package"
opkg install curl wget > tbot.log
printf " Selesai "
echo ""
# Download File Bot Telegram
wget -q https://github.com/Jeriyant/Jeriyant_Bot_Telegram/archive/refs/heads/main.zip -O main.zip
unzip main.zip > tbot.log
folder=$(unzip -qql main.zip | sed -r '1 {s/([ ]+[^ ]+){3}\s+//;q}')
# Mencari File dan Lokasi Directory
fd=$(pwd)/$folder
rm -rf main.zip
# Menyalin File
echo "Sedang Menyalin File."
cp -r $fd/etc /
cp -r $fd/sbin /
cp -r $fd/usr /
printf "Loading"
sleep 1
printf "."
sleep 1
printf "."
sleep 1
printf "."
sleep 1
printf "\rSelesai Bos! \n"
# Memberikan Izin
echo "Sedang Memberikan Izin."
chmod +x -R /usr/lib/telegramopenwrt/plugins/*
chmod +x /etc/init.d/*
chmod +x /etc/config/*
chmod +x /sbin/*
printf "Loading"
sleep 1
printf "."
sleep 1
printf "."
sleep 1
printf "."
sleep 1
printf "\rSelesai Bos! \n"
# Menjalankan Service
echo "Sedang Menjalankan Service."
/etc/init.d/lanports enable
/etc/init.d/telegram_bot enable
/etc/init.d/hosts_scan enable
/etc/init.d/lanports start
/etc/init.d/telegram_bot start
/etc/init.d/hosts_scan start
printf "Loading"
sleep 1
printf "."
sleep 1
printf "."
sleep 1
printf "."
sleep 1
printf "\rSelesai Bos! \n"
# Uji Coba Bot Telegram
echo "Sedang Menguji Fungsi Bot Telegram."
printf "Loading"
sleep 1
printf "."
sleep 1
printf "."
sleep 1
printf "."
sleep 1
printf "\rSelesai Bos! \n"
echo ""
bot_token="$(uci get telegramopenwrt.global.key)"
chat_id="$(uci get telegramopenwrt.global.my_chat_id)"
curl -s "https://api.telegram.org/bot${bot_token}/sendMessage?chat_id=${chat_id}&text=Bot+Berhasil+di+Install+Bos" > tbot.log
rm -rf tbot.log
# Pesan
echo "Jika Bot Tidak Mengirim Pesan, Silakan Cek /etc/config/telegramopenwrt"
sleep 3
rm -rf $fd
echo ""
echo "Sistem Bot Telegram Siap Digunakan!"
echo ""
else
echo "Installasi Gagal, Butuh Koneksi Internet!"
echo "Silakan Periksa Koneksi Internet Anda!"
fi