forked from merbah3266/rish_installer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrish_launcher.sh
More file actions
46 lines (46 loc) · 1.14 KB
/
Copy pathrish_launcher.sh
File metadata and controls
46 lines (46 loc) · 1.14 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
self_cleanup() {
case "$0" in
*proc*) ;;
*sh) ;;
*)
[ -w "$0" ] && rm -f "$0"
;;
esac
}
[ "$(id -u)" -eq 0 ] && {
echo "Error: Please do not run this as root!"
self_cleanup
exit 1
}
exec 2>/dev/null
SCRIPT_URL="https://tinyurl.com/rish3266"
RAND_ID="$RANDOM"
TMP_DIR="${TMPDIR:-/tmp}/rish_launch.$RAND_ID"
TMP_SCRIPT="$TMP_DIR/rish_installer.sh"
cleanup() {
rm -rf "$TMP_DIR"
self_cleanup
}
trap cleanup INT EXIT
mkdir -p "$TMP_DIR"
if command -v bash >/dev/null 2>&1; then
curl -fsSL "$SCRIPT_URL" -o "$TMP_SCRIPT"
[ ! -f "$TMP_SCRIPT" ] && { echo "Script download failed"; exit 1; }
bash "$TMP_SCRIPT" "$@"
else
ARCH="$(uname -m)"
case "$ARCH" in
aarch64|arm64|armv8*) ARCH="arm64" ;;
armv*|armhf|arm) ARCH="arm" ;;
x86_64|amd64) ARCH="x86_64" ;;
i386|i686|x86) ARCH="x86" ;;
*) echo "Unsupported arch"; exit 1 ;;
esac
BB="$TMP_DIR/busybox"
curl -fsSL "https://raw.githubusercontent.com/merbah3266/rish_installer/main/busybox/$ARCH/busybox" -o "$BB"
[ ! -f "$BB" ] && { echo "BusyBox download failed"; exit 1; }
chmod +x "$BB"
curl -fsSL "$SCRIPT_URL" -o "$TMP_SCRIPT"
[ ! -f "$TMP_SCRIPT" ] && { echo "Script download failed"; exit 1; }
"$BB" ash "$TMP_SCRIPT" "$@"
fi