Skip to content

Commit 32cc5dd

Browse files
version 01 patch
- written shortcut launcher for hippo - started vncserver shorcuts - implementing upgrade system - stoped work for /root/fs-manager
1 parent 827d5e0 commit 32cc5dd

File tree

8 files changed

+359
-217
lines changed

8 files changed

+359
-217
lines changed

README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,2 @@
11
# fs-manager-hippo
22
A tool manage common things with ubuntu-on-android
3-
<hr>
4-
> testing
5-
6-
```bash
7-
. <(curl -L https://git.io/JZNyD)
8-
```
9-
<hr>

etc/scripts/hippo/hippo.sh

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
#!/usr/bin/env bash
2+
3+
version=0
4+
5+
TPREFIX="/data/data/com.termux/files"
6+
7+
SCRIPT_DIR="${TPREFIX}/usr/etc/proot-distro/"
8+
INSTALL_FOLDER="${TPREFIX}/usr/varlib/proot-distro/installed-rootfs"
9+
10+
HIPPO_DIR="${INSTALL_FOLDER}/hippo"
11+
HIPPO_SCRIPT_FILE="${SCRIPT_DIR}/hippo.sh"
12+
13+
SOCIAL_PLATFORM="https://discord.gg/TAqaG5sEfW"
14+
15+
# HIPPO_DIR = "${INSTALL_FOLDER}/${HIPPO_DEFAULT}"
16+
# HIPPO_SCRIPT_FILE="${SCRIPT_DIR}/hippo.sh"
17+
18+
function __check_for_hippo() {
19+
if [ -d ${HIPPO_DIR} ] && [ -f ${HIPPO_SCRIPT_FILE} ]; then
20+
return 0;
21+
else
22+
return 1;
23+
fi
24+
}
25+
26+
function __check_for_plugin() {
27+
28+
if [ -f ${HIPPO_SCRIPT_FILE} ]; then
29+
return 0
30+
else
31+
return 1
32+
fi
33+
34+
}
35+
36+
function __check_for_filesystem() {
37+
38+
if [ -d ${HIPPO_DIR}/bin ]; then
39+
return 0
40+
else
41+
return 1
42+
fi
43+
}
44+
45+
function __upgrade() {
46+
# setup downloader
47+
if ! command -v axel >> /dev/null; then
48+
apt install axel
49+
fi
50+
mkdir -p .1x1tmp
51+
axel -o .1x1tmp/version https://raw.githubusercontent.com/RandomCoderOrg/fs-manager-hippo/main/version || {
52+
echo "Error"; exit 1
53+
}
54+
55+
origin_version=$(cat .1x1tmp/version)
56+
57+
rm -rf .1x1tmp
58+
59+
if [ "$origin_version" -gt "$version" ]; then
60+
echo "upgrdae avalibe to \e[1;32${origin_version}\e[0m"
61+
elif [ "$origin_version" -eq "$version" ]; then
62+
echo "You are on latest version \e[1;32${origin_version}\e[0m]]"
63+
else
64+
echo "Upgrader hit unexpected condition..."
65+
fi
66+
67+
if start_upgrade; then
68+
bash -x .1x1tmp/upgrade --summary
69+
rm -rf .1x1tmp
70+
else
71+
echo "Error"
72+
fi
73+
74+
75+
}
76+
77+
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 || {
80+
echo "Error"; exit 1
81+
}
82+
bash -x upgrade.sh || {
83+
return 1
84+
}
85+
return 0
86+
}
87+
88+
function _lauch_or_install()
89+
{
90+
if ! __check_for_plugin; then
91+
echo -e "Plugin at ${HIPPO_SCRIPT_FILE} is missing ......"
92+
echo -e "May be this not a correct installation...."
93+
echo -e "Try to notice us a \e[34m${SOCIAL_PLATFORM}\e[0m"
94+
exit 1
95+
else
96+
if ! __check_for_filesystem; then
97+
echo -e "Installing hippo..........."
98+
if proot-distro install hippo; then
99+
echo -e "Installation Done......\a"
100+
echo "Waiting..."
101+
sleep 2
102+
clear
103+
echo -e "Now You can launch your ubuntu 21.04 with command \e[1;32mhippo\e[0m"
104+
# echo -e "use hippo --help for more option and comming up features"
105+
else
106+
echo -e "Launching".....
107+
proot-distro login hippo
108+
fi
109+
fi
110+
fi
111+
}
112+
113+
if [ $# -eq 0 ]; then
114+
case "$1" in
115+
upgrade) __upgrade;;
116+
*) _lauch_or_install;;
117+
118+
# startvnc)
119+
# if __check_for_hippo; then
120+
# proot-distro launch hippo -- startvnc
121+
# else
122+
# echo -e "This command is supposed to run after installing hippo"
123+
# # echo -e "Use \e[1;32mhippo --install\e[0m install"
124+
# echo -e "\e[32mError:\e[0m Hippo not found"
125+
# fi
126+
# ;;
127+
# stoptvnc)
128+
# if __check_for_hippo; then
129+
# proot-distro launch hippo -- stoptvnc
130+
# else
131+
# echo -e "This command is supposed to run after installing hippo"
132+
# # echo -e "Use \e[1;32mhippo --install\e[0m install"
133+
# echo -e "\e[32mError:\e[0m Hippo not found"
134+
# fi
135+
# ;;
136+
esac
137+
fi
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env bash
2+
:

etc/scripts/vncserver/startvnc.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
3+
vncserver --kill :1
4+

etc/scripts/vncserver/stopvnc.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
##############
4+
# Kill vnc script
5+

0 commit comments

Comments
 (0)