Skip to content

Commit 42b1cae

Browse files
authored
Merge pull request #1 from cabrata/autoscript-update-feature
Add autoscript update feature
2 parents 5ab69fe + becf3de commit 42b1cae

4 files changed

Lines changed: 82 additions & 0 deletions

File tree

menu/m-system.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ echo -e " [\e[36m•4\e[0m] Restart All Service"
1111
echo -e " [\e[36m•5\e[0m] Cek Bandwith"
1212
echo -e " [\e[36m•6\e[0m] Install TCP BBR"
1313
echo -e " [\e[36m•7\e[0m] DNS CHANGER"
14+
echo -e " [\e[36m•8\e[0m] Update Script"
1415
echo -e ""
1516
echo -e " [\e[31m•0\e[0m] \e[31mBACK TO MENU\033[0m"
1617
echo -e ""
@@ -28,6 +29,7 @@ case $opt in
2829
5) clear ; bw ; exit ;;
2930
6) clear ; m-tcp ; exit ;;
3031
7) clear ; m-dns ; exit ;;
32+
8) clear ; m-update ; exit ;;
3133
0) clear ; menu ; exit ;;
3234
x) exit ;;
3335
*) echo -e "" ; echo "Anda salah tekan" ; sleep 1 ; m-system ;;

menu/menu.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ echo -e "\e[1;36m 9 \e[0m: Menu Setting"
118118
echo -e "\e[1;36m 10 \e[0m: Status Service"
119119
echo -e "\e[1;36m 11 \e[0m: Clear RAM Cache"
120120
echo -e "\e[1;36m 12 \e[0m: Reboot VPS"
121+
echo -e "\e[1;36m 13 \e[0m: Update Script"
121122
echo -e "\e[1;36m r \e[0m: Xray Renew (Expired)"
122123
echo -e "\e[1;36m x \e[0m: Exit Script"
123124
echo -e ""
@@ -143,6 +144,7 @@ case $opt in
143144
10) clear ; running ;;
144145
11) clear ; clearcache ;;
145146
12) clear ; reboot ; /sbin/reboot ;;
147+
13) clear ; m-update ;;
146148
r) clear ; xray-renew ;;
147149
x) exit ;;
148150
*) echo "Silahkan masukkan pilihan dengan benar! " ; sleep 1 ; menu ;;

setup.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,13 @@ echo -e "\e[33m-----------------------------------\033[0m"
156156
sleep 0.5
157157
clear
158158
wget https://autoscript.caliphdev.com/ssh/ssh-vpn.sh && chmod +x ssh-vpn.sh && ./ssh-vpn.sh
159+
#Instal Update Script
160+
echo -e "\e[33m-----------------------------------\033[0m"
161+
echo -e "$BGreen Install Update Script $NC"
162+
echo -e "\e[33m-----------------------------------\033[0m"
163+
sleep 0.5
164+
clear
165+
wget -O /usr/bin/m-update https://autoscript.caliphdev.com/update/update.sh && chmod +x /usr/bin/m-update
159166
#Instal Xray
160167
echo -e "\e[33m-----------------------------------\033[0m"
161168
echo -e "$BGreen Install XRAY $NC"

update/update.sh

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/bin/bash
2+
###########- COLOR CODE -##############
3+
colornow=$(cat /etc/rmbl/theme/color.conf)
4+
NC="\e[0m"
5+
RED="\033[0;31m"
6+
COLOR1="$(cat /etc/rmbl/theme/$colornow | grep -w "TEXT" | cut -d: -f2|sed 's/ //g')"
7+
COLBG1="$(cat /etc/rmbl/theme/$colornow | grep -w "BG" | cut -d: -f2|sed 's/ //g')"
8+
WH='\033[1;37m'
9+
###########- END COLOR CODE -##########
10+
11+
echo -e "$COLOR1┌─────────────────────────────────────────────────┐${NC}"
12+
echo -e "$COLOR1${NC} ${WH} UPDATE SCRIPT BY CALIPHDEV ${NC} $COLOR1${NC}"
13+
echo -e "$COLOR1└─────────────────────────────────────────────────┘${NC}"
14+
echo -e ""
15+
echo -e " \033[1;91m Update Script...\033[1;37m"
16+
17+
# Define base URL
18+
BASE_URL="https://autoscript.caliphdev.com"
19+
20+
# Function to download and install a file
21+
update_file() {
22+
local file_path=$1
23+
local file_url=$2
24+
local tmp_file="/tmp/$(basename "$file_path")"
25+
26+
echo -e " Downloading $(basename "$file_path")..."
27+
if wget -q -O "$tmp_file" "$file_url"; then
28+
mv "$tmp_file" "$file_path"
29+
chmod +x "$file_path"
30+
echo -e " [${WH}OK${NC}] Updated $file_path"
31+
else
32+
echo -e " [${RED}FAIL${NC}] Failed to download $file_path"
33+
fi
34+
}
35+
36+
# Update files
37+
update_file "/usr/bin/menu" "$BASE_URL/menu/menu.sh"
38+
update_file "/usr/bin/m-sshovpn" "$BASE_URL/menu/m-sshovpn.sh"
39+
update_file "/usr/bin/m-vmess" "$BASE_URL/menu/m-vmess.sh"
40+
update_file "/usr/bin/m-vless" "$BASE_URL/menu/m-vless.sh"
41+
update_file "/usr/bin/m-trojan" "$BASE_URL/menu/m-trojan.sh"
42+
update_file "/usr/bin/m-system" "$BASE_URL/menu/m-system.sh"
43+
update_file "/usr/bin/m-ssws" "$BASE_URL/menu/m-ssws.sh"
44+
update_file "/usr/bin/m-webmin" "$BASE_URL/menu/m-webmin.sh"
45+
update_file "/usr/bin/running" "$BASE_URL/menu/running.sh"
46+
update_file "/usr/bin/bw" "$BASE_URL/menu/bw.sh"
47+
update_file "/usr/bin/m-tcp" "$BASE_URL/menu/tcp.sh"
48+
update_file "/usr/bin/auto-reboot" "$BASE_URL/menu/auto-reboot.sh"
49+
update_file "/usr/bin/clearcache" "$BASE_URL/menu/clearcache.sh"
50+
update_file "/usr/bin/restart" "$BASE_URL/menu/restart.sh"
51+
update_file "/usr/bin/m-domain" "$BASE_URL/menu/m-domain.sh"
52+
update_file "/usr/bin/m-dns" "$BASE_URL/menu/m-dns.sh"
53+
update_file "/usr/bin/m-l2tp" "$BASE_URL/menu/m-l2tp.sh"
54+
update_file "/usr/bin/m-pptp" "$BASE_URL/menu/m-pptp.sh"
55+
update_file "/usr/bin/m-sstp" "$BASE_URL/menu/m-sstp.sh"
56+
update_file "/usr/bin/m-update" "$BASE_URL/update/update.sh"
57+
58+
# Update version file
59+
echo -e " Updating Version..."
60+
serverV=$(curl -sS "$BASE_URL/menu/versi")
61+
if [ -n "$serverV" ]; then
62+
echo "$serverV" > /opt/.ver
63+
echo -e " [${WH}OK${NC}] Version updated to $serverV"
64+
else
65+
echo -e " [${RED}FAIL${NC}] Failed to fetch version"
66+
fi
67+
68+
echo -e ""
69+
echo -e " \033[1;91m Update Done...\033[1;37m"
70+
sleep 2
71+
menu

0 commit comments

Comments
 (0)