Skip to content

Commit 4984649

Browse files
rewrote installer script
1 parent c0c60e7 commit 4984649

File tree

1 file changed

+72
-38
lines changed

1 file changed

+72
-38
lines changed

install.sh

Lines changed: 72 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,79 @@
11
#!/usr/bin/env bash
22

3-
####################################
4-
# A Script to implant hippo inside
5-
# proot-distro(for now!)
3+
##############
4+
# Script V01
65
#
7-
TERMUX_PREFIX="/data/data/com.termux/files"
8-
DISTRO_PLUGINS_DIR="${TERMUX_PREFIX}/usr/etc/proot-distro"
96

10-
function _implant_()
7+
8+
CACHE_ROOT="${HOME}/.uoa-cache-root"
9+
TPREFIX="/data/data/com.termux/files"
10+
BIN_DIR="${TPREFIX}/usr/bin"
11+
INSTALL_FOLDER="${TPREFIX}/usr/var/lib/proot-distro/installed-rootfs"
12+
HIPPO_DIR="${INSTALL_FOLDER}/hippo"
13+
SCRIPT_DIR="${TPREFIX}/usr/etc/proot-distro/"
14+
HIPPO_REPO_URL="https://github.com/RandomCoderOrg/ubuntu-on-android"
15+
FSM_URL="https://github.com/RandomCoderOrg/fs-manager-hippo"
16+
17+
die () { echo -e "\e[1;32m Error ${*}\e[0m";exit 1 ;:;}
18+
shout () { echo -e "${*}\e[0m";:; }
19+
20+
function setup_and_clone()
1121
{
12-
if [ -f hippo.sh ]; then
13-
if ! [ -f "${DISTRO_PLUGINS_DIR}"/hippo.sh ]; then
14-
cp -v hippo.sh "${DISTRO_PLUGINS_DIR}"
15-
echo -e "Implant done......."
16-
echo -e "- Now you can install ubuntu by running \e[1;32mproot-distro install hippo\e[0m"
17-
else
18-
echo "Looks like \"hippo\" is already installed..."
19-
echo -e "you can install ubuntu by running \e[1;32mproot-distro install hippo\e[0m"
20-
echo -e "you can login to ubuntu by running \e[1;32mproot-distro login hippo\e[0m"
21-
22-
fi
23-
return 0
24-
else
25-
return 1
22+
shout "Trying to update apt indexes...."
23+
apt update; apt upgrade -y
24+
25+
if ! command -v git >> /dev/null; then
26+
shout "Installing git.."
27+
apt install git -y || {
28+
die "Git installation failed"
29+
}
30+
fi
31+
32+
if ! command -v pulseaudio >> /dev/null; then
33+
shout "Installing pulseaudio..."
34+
apt install pulseaudio -y || {
35+
die "pulseaudio installation failed"
36+
}
2637
fi
38+
39+
if ! command -v pv >> /dev/null; then
40+
shout "installing pv.."
41+
apt install pv -y
42+
fi
43+
44+
git clone ${HIPPO_REPO_URL} "${CACHE_ROOT}/ubuntu-on-android" || die "failed to clone repo"
45+
git clone ${FSM_URL} "${CACHE_ROOT}/fs-manager-hippo" || die "failed to clone repo"
46+
47+
install
2748
}
28-
############################
29-
#
30-
# REQUIREMENTS
31-
32-
apt update; apt upgrade -y
33-
34-
if ! command -v proot-distro; then
35-
apt install proot-distro -y
36-
fi
37-
if ! command -v pulseaudio; then
38-
apt install pulseaudio -y
39-
pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1
40-
fi
41-
42-
########################
43-
if ! _implant_; then # this wont happen (mostly)
44-
echo ":( \e[32m error...\e[0m Please create a issue at \e[1;32mhttps://github.com/SaicharanKandukuri/ubuntu-on-android/issues\e[0m to resolve "
45-
fi
49+
50+
function install()
51+
{
52+
####
53+
# Step 1
54+
55+
shout "setting up implant..."
56+
57+
if [ -f "${CACHE_ROOT}"/ubuntu-on-android/hippo.sh ]; then
58+
cp "${CACHE_ROOT}"/ubuntu-on-android/hippo.sh ${SCRIPT_DIR}
59+
fi
60+
61+
####
62+
# step 2
63+
64+
if [ -f "${CACHE_ROOT}"/fs-manager-hippo/install.sh ]; then
65+
cd "${CACHE_ROOT}"/fs-manager-hippo || die "failed to cd ..."
66+
bash install.sh || die "failed to install manager..."
67+
fi
68+
69+
shout
70+
shout "setup complete..."
71+
shout "Now you can install and login with comand\e[1;32hippo"
72+
shout "for info use hippo --help"
73+
shout
74+
75+
exit 1
76+
77+
}
78+
79+
setup_and_clone

0 commit comments

Comments
 (0)