1
1
#! /usr/bin/env bash
2
2
3
- # #############
4
- # * Script V01
5
- #
3
+ # ###################################################
4
+ # Hippo installer Script V01 (mad installer)
5
+ # A script made by @zman-1x1 saicharankandukuri
6
+ # Copyright (c) 2021 Saicharan Kandukuri
7
+
8
+
6
9
7
10
version=" 01"
8
11
@@ -16,20 +19,55 @@ DC=${BLUE}
16
19
# GREEN_THIN="\e[32m"
17
20
18
21
# * Used for testing
22
+ # if set then installer clones code from specified branch (sensitive)
19
23
if [ -n " $HIPPO_BRANCH " ]; then
20
24
BRANCH=" $HIPPO_BRANCH "
21
25
fi
22
26
23
27
28
+ # CACHE_ROOT is the place where are download caches are stored
24
29
CACHE_ROOT=" ${HOME} /.uoa-cache-root"
30
+
31
+ # TPREFIX where root of termux starts
25
32
TPREFIX=" /data/data/com.termux/files"
26
- # BIN_DIR="${TPREFIX}/usr/bin"
33
+
34
+ # BIN_DIR where binary files are stored in termux
35
+ # * (like /bin in traditional linux)
36
+ BIN_DIR=" ${TPREFIX} /usr/bin"
37
+
38
+ # INSTALL_FOLDER variable points to folder location where the file systems are installed in proot-distro
39
+ # * used when checking for hippo
27
40
INSTALL_FOLDER=" ${TPREFIX} /usr/var/lib/proot-distro/installed-rootfs"
41
+
42
+ # HIPPO_DIR variable points to folder where hippo root filesystem is in
28
43
HIPPO_DIR=" ${INSTALL_FOLDER} /hippo"
29
- SCRIPT_DIR=" ${TPREFIX} /usr/etc/proot-distro"
44
+
45
+ # SCRIPT_DIR variable points to folder where plugins for proot-distro is stored
46
+ # * this is where hippo.sh plugin goes
47
+
48
+ SCRIPT_DIR=" ${TPREFIX} /usr/etc/proot-distro/"
49
+
50
+ # HIPPO_REPO_URL & FSM_URL are github repo urls later used to clone the code
30
51
HIPPO_REPO_URL=" https://github.com/RandomCoderOrg/ubuntu-on-android"
31
52
FSM_URL=" https://github.com/RandomCoderOrg/fs-manager-hippo"
32
53
54
+ # DEPENDS programs required to run Hippo
55
+ # * proot-distro - A proot manager tool
56
+ # (which starts hippo)
57
+ # * git - the stupid content tracker
58
+ # (used to copy code from github repo)
59
+ # * pulseaudo - PulseAudio is a networked low-latency sound server for Linux
60
+ # (which is used to get audio from hippo using moudle-tcp*)
61
+ # * Others dependencies like tar comes pre-loaded in termux so no need to mention
62
+ DEPENDS=" proot-distro pulseaudio git"
63
+
64
+
65
+ # * Usefull functions
66
+ # die() exit with code 1 with printing given string
67
+ # warn() like die() without exit status (used when exit is not necessary)
68
+ # shout() pring messege in a good way with some lines
69
+ # lshout() print messege in a standard way
70
+
33
71
die () { echo -e " ${RED} Error ${* }${RST} " ; exit 1 ; : ; }
34
72
warn () { echo -e " ${RED} Error ${* }${RST} " ; : ; }
35
73
shout () { echo -e " ${DC} -----" ; echo -e " ${* } " ; echo -e " -----${RST} " ; : ; }
@@ -39,45 +77,31 @@ lshout () { echo -e "${DC}";echo -e "${*}";echo -e "${RST}";:; }
39
77
shout " \e[1;32m Hippo Installer v${version} "
40
78
sleep 2
41
79
80
+
81
+ # #####################################
82
+ # * function setup_and_clone
42
83
#
43
- # * die function exits program
44
- # * shout just echo the messege out (fancy one line 😁)
45
- #
84
+ # 1. install required programs
85
+ # 2. remove previous cache if found
86
+ # 3. clone code from links in HIPPO_REPO_URL & FSM_URL
87
+ # 4. call install function
88
+ # if anything goes wrong or any program in code fails kill the installation by calling die function
46
89
47
90
function setup_and_clone()
48
91
{
49
92
shout " Trying to update apt indexes...."
50
93
apt update; apt upgrade -y
51
94
52
- if ! command -v proot-distro >> /dev/null; then
53
- shout " Installing proot-distro..."
54
- apt install proot-distro -y || {
55
- die " pulseaudio installation failed"
56
- }
57
- lshout " Done..."
58
- fi
59
-
60
-
61
- if ! command -v git >> /dev/null; then
62
- shout " Installing git.."
63
- apt install git -y || {
64
- die " Git installation failed"
65
- }
66
- lshout " Done..."
67
- fi
95
+ for DEP in $DEPENDS
96
+ do
97
+ if ! command -v " $DEP " >> /dev/null; then
98
+ shout " Installing ${DEP} .."
99
+ apt install " $DEP " -y || {
100
+ die " $DEP installation failed"
101
+ }
102
+ fi
103
+ done
68
104
69
- if ! command -v pulseaudio >> /dev/null; then
70
- shout " Installing pulseaudio..."
71
- apt install pulseaudio -y || {
72
- die " pulseaudio installation failed"
73
- }
74
- lshout " Done..."
75
- fi
76
-
77
- if ! command -v pv >> /dev/null; then
78
- shout " installing pv.."
79
- apt install pv -y
80
- fi
81
105
82
106
if [ -d " ${CACHE_ROOT} " ]; then
83
107
shout " Removing old cache......."
@@ -98,11 +122,17 @@ function setup_and_clone()
98
122
install
99
123
}
100
124
125
+ # ##################################
126
+ # * function install
127
+ #
128
+ # 1. chech for plugin and copy to proot-distro plugin folder
129
+ # 2. chech for fs-manager-hippo(hippo) install script in its root directory and run it
130
+ # 3. trigger hippo installation
131
+ # 4. show echo of installation complete and clear screen
132
+ # if anything goes wrong or any program in code fails kill the installation by calling die function
133
+
101
134
function install()
102
135
{
103
- # ###
104
- # * Step 1
105
-
106
136
shout " setting up proot-distro hippo implant..."
107
137
108
138
sleep 3
@@ -115,9 +145,6 @@ function install()
115
145
cp " ${CACHE_ROOT} " /ubuntu-on-android/hippo.sh ${SCRIPT_DIR}
116
146
fi
117
147
118
- # ###
119
- # step 2
120
-
121
148
if [ -f " ${CACHE_ROOT} " /fs-manager-hippo/install.sh ]; then
122
149
oldpwd=" $( pwd) "
123
150
cd " ${CACHE_ROOT} " /fs-manager-hippo || die " failed to cd ..."
0 commit comments