Created
March 21, 2019 19:15
-
-
Save iL3D/10154b03c8f9cc105cc3d8162596b273 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/data/data/com.termux/files/usr/bin/bash -e | |
set -euo pipefail | |
shopt -s inherit_errexit | |
yes | pkg upgrade || true | |
yes | pkg install x11-repo || true | |
yes | pkg install tigervnc || true | |
yes | pkg install curl || true | |
curl --silent -O https://raw.githubusercontent.com/Hax4us/TermuxAlpine/master/TermuxAlpine.sh | |
bash TermuxAlpine.sh | |
clear | |
unset LD_PRELOAD | |
addresolvconf () | |
{ | |
[ /data/data/com.termux/files/usr/bin/getprop ] && getprop | sed -n -e 's/^\[net\.dns.\]: \[\(.*\)\]/\1/p' | sed '/^\s*$/d' | sed 's/^/nameserver /' > /data/data/com.termux/files/home/TermuxAlpine/etc/resolv.conf | |
} | |
addresolvconf | |
ALPINE='proot --link2symlink -0 -r /data/data/com.termux/files/home/TermuxAlpine/ -b /dev/ -b /sys/ -b /proc/ -b /storage/ -b /data/data/com.termux/files/home -w /data/data/com.termux/files/home /usr/bin/env HOME=/root TERM="xterm" LANG=en_US.UTF-8 PATH=/bin:/usr/bin:/sbin:/usr/sbin' | |
$ALPINE apk update --quiet | |
$ALPINE apk add --quiet -X http://dl-2.alpinelinux.org/alpine/latest-stable/main gdbm | |
$ALPINE apk add --quiet bash novnc | |
$ALPINE apk add --quiet fvwm xclock | |
$ALPINE apk add --quiet -X http://dl-2.alpinelinux.org/alpine/latest-stable/main mkfontdir | |
TTFS=`$ALPINE apk search -q ttf- | grep -v '\-doc' | grep -v '\-dev'` | |
$ALPINE apk add --quiet $TTFS | |
# support full-blown Java (openjdk8 compatible) apps just for kicks | |
$ALPINE apk add --quiet openjdk8-jre || true | |
curl --silent -O https://datapacket.dl.sourceforge.net/project/jedit/jedit/5.5.0/jedit5.5.0install.jar | |
cat >>rungui<<EOF | |
#!/data/data/com.termux/files/usr/bin/bash -e | |
export your_fav_gui_app=xclock | |
#export any_java8_app="java -cp your.jar:some-other.jar theMainClass any-args" | |
export any_java8_app="java -cp jedit5.5.0install.jar installer.Install" | |
unset LD_PRELOAD | |
addresolvconf () | |
{ | |
[ /data/data/com.termux/files/usr/bin/getprop ] && getprop | sed -n -e 's/^\[net\.dns.\]: \[\(.*\)\]/\1/p' | sed '/^\s*$/d' | sed 's/^/nameserver /' > /data/data/com.termux/files/home/TermuxAlpine/etc/resolv.conf | |
} | |
addresolvconf | |
ALPINE='proot --link2symlink -0 -r /data/data/com.termux/files/home/TermuxAlpine/ -b /dev/ -b /sys/ -b /proc/ -b /storage/ -b /data/data/com.termux/files/home -w /data/data/com.termux/files/home /usr/bin/env HOME=/root TERM="xterm" LANG=en_US.UTF-8 PATH=/bin:/usr/bin:/sbin:/usr/sbin' | |
Xvnc -SecurityTypes None -localhost -listen tcp :13 &> /dev/null & | |
echo -ne "Waiting 3 seconds... " | |
sleep 3s | |
echo -ne "Done waiting\n" | |
\$ALPINE DISPLAY=127.0.0.1:13 fvwm &> /dev/null & | |
\$ALPINE DISPLAY=127.0.0.1:13 \$your_fav_gui_app &> /dev/null & | |
\$ALPINE DISPLAY=127.0.0.1:13 \$any_java8_app &> /dev/null & | |
\$ALPINE websockify --web /usr/share/novnc 6080 localhost:5913 &> /dev/null & | |
\$ALPINE novnc_server --web /usr/share/novnc --vnc localhost:5913 &> /dev/null & | |
echo -ne \\ | |
" \n\n\n"\\ | |
" \$your_fav_gui_app is now running locally on your Android device. \n"\\ | |
" You can see it & use in your web browser. \n"\\ | |
" To access: Long press anywhere on the Termux screen \n"\\ | |
' Select MORE > SELECT URL in the copy/paste menu that pops up. \n'\\ | |
' Long press the entry corresponding to http://127.0.0.1:6080/vnc.html . \n' | |
EOF | |
chmod a+x rungui | |
cat >>stopgui<<EOF | |
pkill "java" | |
pkill "\$your_fav_gui_app" | |
pkill "fvwm" | |
pkill "novnc_server" | |
pkill "websockify" | |
pkill "Xvnc" | |
EOF | |
chmod a+x stopgui | |
echo -ne ' To stop the gui sesssion, type "bash stop-gui-apps".\n\n' | |
echo -ne ' To run $your_favorite_gui_app, type "bash run-gui-apps"\n\n' |
`good one
`good one8
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
`good one