Skip to content

Commit

Permalink
flux/entry: sort; +dest=/etc/perp/$xn-de
Browse files Browse the repository at this point in the history
  • Loading branch information
sam#gemmi-win10 committed Dec 6, 2023
1 parent 503e9d6 commit df7136a
Showing 1 changed file with 39 additions and 32 deletions.
71 changes: 39 additions & 32 deletions flux/src/entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,37 +69,6 @@ redirect_stderr=true
# stdout_logfile_backups = 10
# redirect_stderr=true
""" |sudo tee /etc/supervisor/conf.d/xvnc$N.conf > /dev/null 2>&1
# PERP: x-xvnc,chansrv,pulse,parec
dest=/etc/perp/$xn-xvnc; mkdir -p $dest/
cat /etc/perp/tpl-rc.main |sed "s^_CMD_^/xvnc.sh xvnc $N^g" > $dest/rc.main
dest=/etc/perp/$xn-chansrv; mkdir -p $dest
cat /etc/perp/tpl-rc.main |sed "s^_CMD_^/xvnc.sh chansrv $N^g" > $dest/rc.main

# frpc.ini
local ip=$(echo $FRPS_ADDR |cut -d':' -f1)
local port=$(echo $FRPS_ADDR |cut -d':' -f2)
echo """
[common]
server_addr = $ip
server_port = $port
[$xn-ssh]
type = tcp
local_ip = 127.0.0.1
local_port = $(expr $PORT_SSH - 100)
remote_port = ${PORT_SSH}
[$xn-xrdp]
type = tcp
local_ip = 127.0.0.1
local_port = $(expr $PORT_RDP - 100)
remote_port = ${PORT_RDP}
[$xn-novnc]
type = tcp
local_ip = 127.0.0.1
local_port = $(expr $PORT_VNC - 100)
remote_port = ${PORT_VNC}
""" |sudo tee /etc/frp/frpc.ini > /dev/null 2>&1

# SV: x$N-de.conf
echo """
[program:$xn-de]
Expand All @@ -115,6 +84,16 @@ stdout_logfile_backups = 10
redirect_stderr=true
""" |sudo tee /etc/supervisor/conf.d/x$N-de.conf > /dev/null 2>&1

# PERP: x-xvnc,chansrv,pulse,parec
dest=/etc/perp/$xn-xvnc; mkdir -p $dest/
cat /etc/perp/tpl-rc.main |sed "s^_CMD_^/xvnc.sh xvnc $N^g" > $dest/rc.main
dest=/etc/perp/$xn-chansrv; mkdir -p $dest
cat /etc/perp/tpl-rc.main |sed "s^_CMD_^/xvnc.sh chansrv $N^g" > $dest/rc.main
#
dest=/etc/perp/$xn-de; mkdir -p $dest
cat /etc/perp/tpl-rc.main |sed "s^_CMD_^bash -c \"env |grep -v PASS; source /.env; exec startfluxbox\"^g" > $dest/rc.main


# XRDP /etc/xrdp/xrdp.ini
echo """
[Xvnc$N]
Expand Down Expand Up @@ -143,8 +122,35 @@ chansrvport=DISPLAY($N)
local line2=$(cat /usr/local/webhookd/static/index.html |grep "ADD_HERE" -n |cut -d':' -f1)
line2=$(expr $line2 - 1)
sed -i "$line2 r $tmpDir/novncHtml$N.htm" /usr/local/webhookd/static/index.html
rm -f $tmpDir/novncHtml$N.htm
rm -f $tmpDir/novncHtml$N.


# frpc.ini
local ip=$(echo $FRPS_ADDR |cut -d':' -f1)
local port=$(echo $FRPS_ADDR |cut -d':' -f2)
echo """
[common]
server_addr = $ip
server_port = $port
[$xn-ssh]
type = tcp
local_ip = 127.0.0.1
local_port = $(expr $PORT_SSH - 100)
remote_port = ${PORT_SSH}
[$xn-xrdp]
type = tcp
local_ip = 127.0.0.1
local_port = $(expr $PORT_RDP - 100)
remote_port = ${PORT_RDP}
[$xn-novnc]
type = tcp
local_ip = 127.0.0.1
local_port = $(expr $PORT_VNC - 100)
remote_port = ${PORT_VNC}
""" |sudo tee /etc/frp/frpc.ini > /dev/null 2>&1
}

function frp(){
mkdir -p /etc/frp
# frps.ini
Expand Down Expand Up @@ -178,6 +184,7 @@ function setXserver(){
# setPorts; sed port=.* || env_ctReset
sed -i "s^port=3389^port=$(expr $PORT_RDP - 100)^g" /etc/xrdp/xrdp.ini
sed -i "s/EFRp 22/EFRp $(expr $PORT_SSH - 100)/g" /etc/supervisor/conf.d/sv.conf #sv.conf
sed -i "s/EFRp 22/EFRp $(expr $PORT_SSH - 100)/g" /etc/perp/ssh/rc.main #perp
sed -i "3a\PORT_VNC=$(expr $PORT_VNC - 100)" /usr/local/webhookd/run.sh #+
# run.sh line4: PORT_VNC=${PORT_VNC:-10091}; echo "PORT_VNC: $PORT_VNC"

Expand Down

0 comments on commit df7136a

Please sign in to comment.