Skip to content

Commit d7670d7

Browse files
modified installer
to satisfy new conditions of my algo :)
1 parent f09d569 commit d7670d7

File tree

2 files changed

+43
-30
lines changed

2 files changed

+43
-30
lines changed

etc/scripts/hippo/hippo.sh

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
version=0
44

5+
CACHE_ROOT="${HOME}/.uoa-cache-root"
56
TPREFIX="/data/data/com.termux/files"
67

78
SCRIPT_DIR="${TPREFIX}/usr/etc/proot-distro/"
@@ -47,14 +48,14 @@ function __upgrade() {
4748
if ! command -v axel >> /dev/null; then
4849
apt install axel
4950
fi
50-
mkdir -p .1x1tmp
51-
axel -o .1x1tmp/version https://raw.githubusercontent.com/RandomCoderOrg/fs-manager-hippo/main/version || {
51+
mkdir -p "${CACHE_ROOT}"
52+
axel -o "${CACHE_ROOT}"/version https://raw.githubusercontent.com/RandomCoderOrg/fs-manager-hippo/main/version || {
5253
echo "Error"; exit 1
5354
}
5455

55-
origin_version=$(cat .1x1tmp/version)
56+
origin_version=$(cat "${CACHE_ROOT}"/version)
5657

57-
rm -rf .1x1tmp
58+
rm -rf "${CACHE_ROOT}"
5859

5960
if [ "$origin_version" -gt "$version" ]; then
6061
echo "upgrdae avalibe to \e[1;32${origin_version}\e[0m"
@@ -65,8 +66,8 @@ function __upgrade() {
6566
fi
6667

6768
if start_upgrade; then
68-
bash -x .1x1tmp/upgrade --summary
69-
rm -rf .1x1tmp
69+
bash -x "${CACHE_ROOT}"/upgrade --summary
70+
rm -rf "${CACHE_ROOT}"
7071
else
7172
echo "Error"
7273
fi
@@ -75,8 +76,8 @@ function __upgrade() {
7576
}
7677

7778
function start_upgrade() {
78-
mkdir -p .1x1tmp
79-
axel -o .1x1tmp/upgrade.sh https://raw.githubusercontent.com/RandomCoderOrg/fs-manager-hippo/main/etc/scripts/upgrade_patch/upgrade.sh || {
79+
mkdir -p "${CACHE_ROOT}"
80+
axel -o "${CACHE_ROOT}"/upgrade.sh https://raw.githubusercontent.com/RandomCoderOrg/fs-manager-hippo/main/etc/scripts/upgrade_patch/upgrade.sh || {
8081
echo "Error"; exit 1
8182
}
8283
bash -x upgrade.sh || {
@@ -104,15 +105,47 @@ function _lauch_or_install()
104105
# echo -e "use hippo --help for more option and comming up features"
105106
fi
106107
else
107-
echo -e "Launching".....
108-
proot-distro login hippo
108+
if [ -f "{CACHE_ROOT}"/ubuntu-on-android/etc/scripts/vncserver/startvnc.sh ] && [ ! -f ${HIPPO_DIR}/bin/startvnc ]; then
109+
DIR="{CACHE_ROOT}/ubuntu-on-android/etc/scripts/vncserver/startvnc.sh"
110+
cp ${DIR} ${HIPPO_DIR}/bin/startvnc
111+
proot-distro login hippo -- chmod 775 /bin/startvnc
112+
fi
113+
114+
if [ -f "{CACHE_ROOT}"/ubuntu-on-android/etc/scripts/vncserver/stopvnc.sh ] && [ ! -f ${HIPPO_DIR}/bin/stopvnc ]; then
115+
DIR="${CACHE_ROOT}/ubuntu-on-android/etc/scripts/vncserver/stopvnc.sh"
116+
cp "${DIR}" ${HIPPO_DIR}/bin/stopvnc
117+
proot-distro login hippo -- chmod 775 /bin/stopvnc
118+
fi
119+
120+
proot-distro login hippo "$@"
109121
fi
110122
fi
111123
}
112124

125+
function __help()
126+
{
127+
echo -e "hippo - termux Version ${version}"
128+
echo -e "A bash script to make basic action(login, vncserver) easier for ubuntu-on-android project"
129+
echo -e
130+
echo -e "Usage ${0} [options]"
131+
echo -e
132+
echo -e "Options:"
133+
echo -e "--install To try installing hippo"
134+
echo -e "--help to display this message"
135+
echo -e "--enable-dbus To start terminal session with dbus enabled"
136+
echo -e "startvnc To start hippo vncserver"
137+
echo -e "stopvnc To stop hippo vncserver"
138+
echo -e "Join the community and leave at DISCORD -> $SOCIAL_PLATFORM"
139+
}
140+
113141
if [ $# -eq 0 ]; then
114142
case "$1" in
115143
upgrade) __upgrade;;
144+
--enable-dbus) shift 1; _lauch_or_install --bind /dev/null:/proc/sys/kernel/cap_last_cap ;;
145+
"--enable-dbus startvnc") shift 1; _lauch_or_install --bind /dev/null:/proc/sys/kernel/cap_last_cap -- startvnc ;;
146+
"--enable-dbus stopvnc") shift 1; _lauch_or_install --bind /dev/null:/proc/sys/kernel/cap_last_cap -- stopvnc ;;
147+
--install) _lauch_or_install;;
148+
--help) __help;;
116149
startvnc)
117150
if __check_for_hippo; then
118151
proot-distro launch hippo -- startvnc

install.sh

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
TPREFIX="/data/data/com.termux/files"
44
BIN_DIR="${TPREFIX}/usr/bin"
5-
INSTALL_FOLDER="${TPREFIX}/usr/var/lib/proot-distro/installed-rootfs"
6-
HIPPO_DIR="${INSTALL_FOLDER}/hippo"
75

86
echo "setting hippo..."
97

@@ -16,24 +14,6 @@ else
1614
exit 1
1715
fi
1816

19-
if [ -f etc/scripts/vncserver/startvnc.sh ]; then
20-
DIR="etc/scripts/vncserver/startvnc.sh"
21-
cp ${DIR} ${HIPPO_DIR}/bin/startvnc
22-
proot-distro login hippo -- chmod 775 /bin/startvnc
23-
else
24-
echo "Installation Failed..."
25-
exit 1
26-
fi
27-
28-
if [ -f etc/scripts/vncserver/stopvnc.sh ]; then
29-
DIR="etc/scripts/vncserver/stopvnc.sh"
30-
cp ${DIR} ${HIPPO_DIR}/bin/stopvnc
31-
proot-distro login hippo -- chmod 775 /bin/stopvnc
32-
else
33-
echo "Installation Failed..."
34-
exit 1
35-
fi
36-
3717
echo "Done"
3818

3919
exit 0

0 commit comments

Comments
 (0)