Skip to content

Commit 85dd130

Browse files
novnc & colors
1 parent 0a59482 commit 85dd130

File tree

1 file changed

+32
-6
lines changed

1 file changed

+32
-6
lines changed

proot-env/udroid/udroid.sh

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
#!/usr/bin/env bash
22

3-
die() { echo -e "${RED}[E] ${*}${RST}";exit 1;:;}
4-
warn() { echo -e "${RED}[W] ${*}${RST}";:;}
5-
shout() { echo -e "${DS}[-] ${*}${RST}";:;}
6-
lshout() { echo -e "${DC}-> ${*}${RST}";:;}
3+
_c_magneta="\e[95m"
4+
_c_green="\e[32m"
5+
_c_red="\e[31m"
6+
_c_blue="\e[34m"
7+
8+
die() { echo -e "${_c_red}[E] ${*}${RST}";exit 1;:;}
9+
warn() { echo -e "${_c_red}[W] ${*}${RST}";:;}
10+
shout() { echo -e "${_c_blue}[-] ${*}${RST}";:;}
11+
lshout() { echo -e "${_c_blue}-> ${*}${RST}";:;}
712
msg() { echo -e "${*} \e[0m" >&2;:;}
813

914
function _backup() {
@@ -95,7 +100,16 @@ function service_exec() {
95100
}
96101

97102
function no_vnc() {
98-
:
103+
novnc_path="/usr/share/novnc/utils"
104+
novnc="${novnc_path}/launch.sh"
105+
local_port="127.0.0.1"
106+
port=6080
107+
108+
if [ ! -f "$novnc" ]; then
109+
die "novnc launch.sh not found..."
110+
fi
111+
112+
$novnc --listen $port
99113
}
100114

101115
function startvnc() {
@@ -115,8 +129,20 @@ function startvnc() {
115129
else
116130
msg "A vncserver lock is found for port ${port}"
117131
die "try using stopvnc"
118-
fi
132+
fi
133+
134+
msg "VNC server started at ${pubip}:${port}"
135+
msg "local VNC ip -> ${_c_magneta}127.0.0.1:1"
136+
msg "remote VNC ip -> ${_c_magneta}${pubip}:${port}"
119137

138+
if [[ -n $NOVNC ]]; then
139+
msg "Starting novnc server..."
140+
msg "local VNC ip -> ${_c_magneta}127.0.0.1:6090"
141+
msg "remote VNC ip -> ${_c_magneta}${pubip}:6090"
142+
msg
143+
msg "press ctrl+c to stop novnc server!"
144+
no_vnc
145+
fi
120146
}
121147

122148
function stopvnc() {

0 commit comments

Comments
 (0)