-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlaunch.sh
More file actions
52 lines (46 loc) · 1.28 KB
/
launch.sh
File metadata and controls
52 lines (46 loc) · 1.28 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
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage:"
echo " bash launch.sh trojan <secret> <hostname>"
echo " bash launch.sh mikrotik <secret>"
exit 1
fi
action=$(echo "$1" | awk '{print tolower($0)}')
case "$action" in
"vpn trojan")
if [ $# -lt 3 ]; then
echo "Error: trojan requires <secret> <hostname>"
echo "Usage: bash launch.sh trojan <secret> <hostname>"
exit 1
fi
SCRIPT_URL="https://raw.githubusercontent.com/caasify/script/refs/heads/main/vpn/xui/trojan.sh"
EXTRA_ARGS="${@:2}" # secret + hostname
;;
"mikrotik chr")
if [ $# -lt 3 ]; then
echo "Error: mikrotik requires <secret>"
echo "Usage: bash launch.sh mikrotik <secret>"
exit 1
fi
SCRIPT_URL="https://raw.githubusercontent.com/caasify/script/refs/heads/main/mikrotik/mikrotik.sh"
EXTRA_ARGS="${@:2}" # secret
;;
*)
echo "Invalid option: $1"
echo "Usage:"
echo " bash launch.sh trojan <secret> <hostname>"
echo " bash launch.sh mikrotik <secret>"
exit 1
;;
esac
# Download and execute the script
TMP_SCRIPT=$(mktemp)
curl -fsSL "$SCRIPT_URL" -o "$TMP_SCRIPT"
if [ $? -ne 0 ]; then
echo "Failed to download script from $SCRIPT_URL"
exit 1
fi
chmod +x "$TMP_SCRIPT"
bash "$TMP_SCRIPT" $EXTRA_ARGS
# Clean up
rm -f "$TMP_SCRIPT"