22
33version=0
44
5+ CACHE_ROOT=" ${HOME} /.uoa-cache-root"
56TPREFIX=" /data/data/com.termux/files"
67
78SCRIPT_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
7778function 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+
113141if [ $# -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
0 commit comments