forked from RandomCoderOrg/ubuntu-on-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
89 lines (77 loc) · 3.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
#!/usr/bin/env bash
####################################################
# UDROID installer Script V03 (mad installer)
# A script made by udroid team
# Copyright (c) 2021 @RandomCoderOrg <[email protected]>
version="3.1"
version_code_name="mi03"
installer_authors="saicharankandukuri"
# COLORS
_c_magneta="\e[95m"
_c_green="\e[32m"
_c_red="\e[31m"
_c_blue="\e[34m"
RST="\e[0m"
die() { echo -e "${_c_red}[E] ${*}${RST}";if [ -n "$DISABLE_EXIT" ];then exit 1; fi;:;}
warn() { echo -e "${_c_red}[W] ${*}${RST}";:;}
shout() { echo -e "${_c_blue}[-] ${*}${RST}";:;}
lshout() { echo -e "${_c_blue}-> ${*}${RST}";:;}
msg() { echo -e "${*} \e[0m" >&2;:;}
function logo() {
# check if logo could fit in terminal with its current tty resolution
tty_width=$(stty size | cut -d ' ' -f 2)
if ((tty_width >= 50 )); then
# RES [W X H]: 44X10 ( BEST visible FIT: 50X15 )
msg "████████████████████████████████████████████"
echo
msg "██╗░░░██╗██████╗░██████╗░░█████╗░██╗██████╗░"
msg "██║░░░██║██╔══██╗██╔══██╗██╔══██╗██║██╔══██╗"
msg "██║░░░██║██║░░██║██████╔╝██║░░██║██║██║░░██║"
msg "██║░░░██║██║░░██║██╔══██╗██║░░██║██║██║░░██║"
msg "╚██████╔╝██████╔╝██║░░██║╚█████╔╝██║██████╔╝"
msg "░╚═════╝░╚═════╝░╚═╝░░╚═╝░╚════╝░╚═╝╚═════╝░"
echo
msg "████████████ (c)RandomCoderOrg ████████████"
else
# Just in case the logo is too big for your terminal ( Happens to new termux users )
msg "${_c_magneta}UDROID INSTALLER v$version\e[0m...."
msg "\e[90m© RandomCoderOrg"
fi
}
logo
# Check device os & CPU architecture
# just to make sure its not armv7l
# (armv7l is not supported cause of 64bit cpu and 32bit os)
shout "Checking cpu architecture.."
if [ "$(uname -m)" = "armv7l" ]; then
die "Sorry, armv7l is not supported.."
fi
msg "CPU architecture is OK."
# Check for required packages
shout "Checking for required packages.."
DEPENDS="git curl proot-distro"
for DEPEND in $DEPENDS; do
if [ -z "$(command -v "$DEPEND")" ]; then
msg "Installing $DEPEND.."
pkg install -y "$DEPEND" || die "Failed to install $DEPEND"
fi
done
msg "All required packages are installed."
# Install udroid tool
shout "Installing udroid tool.."
udroid_loc="/data/data/com.termux/files/usr/bin/udroid"
if command -v udroid >/dev/null 2>&1; then
msg "udroid tool is already installed."
fi
curl -fsSL https://raw.githubusercontent.com/RandomCoderOrg/fs-manager-udroid/main/scripts/udroid/udroid.sh -o "$udroid_loc" || {
die "Failed to download udroid tool."
}
chmod +x "$udroid_loc"
# Install udroid-xfce4 by default..
shout "Installing udroid-xfce4.."
msg "udroid -l xfce4"
udroid -i xfce4
# Login for first time
shout "Logining in to udroid"
msg "udroid -l xfce4"
udroid -l xfce4