Windows installer and medley script for running Medley in Docker on Windows (#1077)
* Update docker file build to use new deb linux installers; move Dockefile to .github/workflows since its really only useable from the buildDocker.yml workflow * Fix typo in dockerfile location * remove extraneous " in >>GITHUB_ENV statements * Fix handling of TARGETPLATFORM in Dockerfile * Trying with just one platform * Fix issues with missing man-db in docker build workflow; added man-db to depends in deb builds for linux * Sicthed docker from tightvnc to tigervnc to match oio. This getting the apt package name right. * Going back to single platform to debug this thing * Trying with just arm64 * Removing arm/v7 from docker images. Takes too long to build and just wastes our github actions minutes. This is assuming its a never used feature since docker is not big on raspberry pis and their ilk. * Fix typo in control-linux; update build_deb so that files in /usr/local installed by deb are owned by root; add ubuntu user and nano in docker file for dbebugging; when in draft only create for x86_64 platform * Fix typo in buildDocker.yml * Add sudo to docker image; in docker image ensure that all /usr/local/interlisp files are owned by root * Add securityTypes none to docker entrypoint * Updated docker base to Ubuntu 22.10 to get fixed xrdp; add xrdp to the docker image; updated user permission in docker image; * In Dockerfile make xrdp install noninteractive * Update medley.sh scripts to handle docker case * Fix a couple of typos * BuildDcoker: added pulling latest draft release (if any) when this is a draft docker build; removed checkout of medley code cause its not used * BuildDocker: added medley checkout backin - turns pout its needed by a bunch of actions even though I dont really think they use it * BuildDocker: moved download assets to use gh instaed of a marketplace action becauase that action could not handle draft releases. * Tweaking medley.sh and associated tweaks to work Windows via wsl medley and docker * adding first pass at powershell script for windows docker and wsl * Tuning how Xvnc, medley, and vncviewer handle the various ways of exiting - eg logout vs closing viewer window. * Tuning vncviewer launch to make sure that tty works as expected when medley.sh runs in background * Minor typo fixes and added extra check to use of /run/shm in medley_vnc.sh * Added SSH_KEY secret to buildReleaseIncDocker workflow * Gertting the add SSH_KEY secret into orkflows right this time, hopefully * Adding TERM env variable and setting USER to medley in docker image * Debugging medley.ps1 and adding a couple of arguments * Typo in Dockerfile medley * Synchronizing flag processing and usage for medley.ps1 and medley.sh; refactored medley_args.sh and medley_usage.sh code. * Adding first pass at windows installer * Adding first pass an inno setup script for Windows installation * Update buildLoadup workflow and downloads page for windows installer * Fix typo in buildLoadup * BuildLoadup make sure windows runner uses powershell * Another typo in buildLoadup * Another typo in buildLoadup; damn those double quotes * Updating handling of windows installer in buildLoadup, added vncviewer to medley.iss install * Unknown syntax error in buildLoadup * Another damn typo from double quotes * buildLoadup: fixed loadup job outputs * buidLoadup: fixed bug with COMBINED_RELEASE_TAG; fixed Upload script in windows job to be compatible with actions.script v6. * buidLoadup: upload win installer adapted to find draft releases as well as full releases * BuildLoadup: fixing up javascript in actions in windows job to use / instead of \ in pathname * BuildLoadup: changing win installer update to same action used for other release assets * Fix windows installer file name; in BuildLoadup move update downl;oad page to the Windows runner because uploading the window-installer changes the release download url, so updating the downloads page must be done after the windows installer upload.; General buildLoadup cleanup * Run md2html to update downloads page * Fix typo in build_deb.sh * Removing some leftover crud in medley_usage.sh * Fixing up windows installer a bit, mostly cosmetic * Adding support for WSL1; mostly forcing --vnc and changing how to find open ports and displays since WSL1 networking is different tha WSL2 * Update manual page for new Windows Medley script * First pass done for man page that incorporates new Windows medley script. Add Xvnc wait before calling run-medley in case of docker to prevent occasonal missing X windows server error. * Change buildLoadup to update man page to a draft if this is a draft run.
This commit is contained in:
3
scripts/medley/medley.cmd
Normal file
3
scripts/medley/medley.cmd
Normal file
@@ -0,0 +1,3 @@
|
||||
@echo off
|
||||
powershell medley.ps1 %*
|
||||
|
||||
410
scripts/medley/medley.ps1
Executable file
410
scripts/medley/medley.ps1
Executable file
@@ -0,0 +1,410 @@
|
||||
###############################################################################
|
||||
#
|
||||
# medley.ps1 - PowerShell script for running Medley Interlisp in a Docker
|
||||
# container on Windows. This script will pull the
|
||||
# interlisp/medley docker container, run the container
|
||||
# using the Linux medley script as the entrypoint
|
||||
# passing on the flags as given to this script, and
|
||||
# then start a vncviewer onto medley running in the
|
||||
# container.
|
||||
#
|
||||
# This script can also be used to start medley in a WSL
|
||||
# distro, although the same can easily be accomplished
|
||||
# using the wsl command.
|
||||
#
|
||||
# 2023-02-10 Frank Halasz
|
||||
#
|
||||
# Copyright 2023 Interlisp.org
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
|
||||
#
|
||||
# Various useful functions
|
||||
#
|
||||
|
||||
# Function to check if docker is installed on this system
|
||||
function Test-DockerInstalled {
|
||||
$ErrorActionPreference = "SilentlyContinue"
|
||||
if (Get-Command "docker" -Syntax)
|
||||
{ return $true }
|
||||
else
|
||||
{ return $false }
|
||||
}
|
||||
|
||||
# Function to check if docker is running on this system
|
||||
function Test-DockerRunning {
|
||||
$ErrorActionPreference = "SilentlyContinue"
|
||||
docker info 2>&1 >$null
|
||||
if ( $LastExitCode -eq 0 )
|
||||
{ return $true }
|
||||
else
|
||||
{ return $false }
|
||||
}
|
||||
|
||||
# Function to test if WSL is installed on this machine
|
||||
function Test-WSLInstalled {
|
||||
#$ErrorActionPreference = "SilentlyContinue"
|
||||
if ((Get-Command "wsl" -Syntax) -and
|
||||
(((wsl --list --verbose) -replace "`0" | Measure-Object -Line | Select -ExpandProperty Lines) -gt 1))
|
||||
{ return $true }
|
||||
else
|
||||
{ return $false }
|
||||
|
||||
}
|
||||
|
||||
# Function to test if a named WSL distro is actually present
|
||||
function Test-WSLDistro {
|
||||
param($distro="unknown")
|
||||
$paddedDistro= " " + $distro + " "
|
||||
if ( (wsl --list --verbose) -replace "`0" | Select-String -Pattern $paddedDistro )
|
||||
{ return $true }
|
||||
else
|
||||
{ return $false }
|
||||
}
|
||||
|
||||
# Function to test if medley is installed (using standard installation)
|
||||
# in the wsl distro whose name is the first and only arg. Defaults
|
||||
# to the default wsl distro
|
||||
function Test-MedleyInstalled {
|
||||
param($distro)
|
||||
if($distro -and (-not (Test-WSLDistro $distro)))
|
||||
{
|
||||
return $false
|
||||
}
|
||||
if ($distro)
|
||||
{
|
||||
$is_installed = wsl -d $distro bash -c "test -e /usr/local/interlisp; echo \`$?"
|
||||
}
|
||||
else
|
||||
{
|
||||
$is_installed = wsl bash -c "test -e /usr/local/interlisp; echo \`$?"
|
||||
}
|
||||
if ($is_installed -eq 0)
|
||||
{
|
||||
return $true
|
||||
}
|
||||
else
|
||||
{
|
||||
return $false
|
||||
}
|
||||
}
|
||||
|
||||
# Function to find an unused port between 5900 and 5999
|
||||
function Find-OpenPort {
|
||||
$min_port=5900
|
||||
$max_port=5999
|
||||
$udp_openPorts = Get-NetUDPEndpoint | Where-Object { ($_.LocalPort -ge $min_port) -and ($_.LocalPort -le $max_port) }
|
||||
$tcp_openPorts = Get-NetTCPConnection | Where-Object { ($_.LocalPort -ge $min_port) -and ($_.LocalPort -le $max_port) }
|
||||
$openPorts = ($udp_openPorts + $tcp_openPorts) | Select-Object -Property LocalPort | Sort-Object -Property LocalPort -Unique
|
||||
$expected=$min_port;
|
||||
foreach ($port in $openPorts)
|
||||
{
|
||||
if ( $port.LocalPort -ne $expected )
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
${expected}++
|
||||
}
|
||||
}
|
||||
if ($expected -gt $max_port)
|
||||
{
|
||||
Write-Output "Error: No available ports between 5900 and 5999."
|
||||
Write-Output "Exiting."
|
||||
exit 34
|
||||
}
|
||||
else
|
||||
{
|
||||
return $expected
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Function that processes all the arguments to this script
|
||||
#
|
||||
function Process-Args {
|
||||
|
||||
# Default values for script-scoped varaibles
|
||||
$script:bg = $false
|
||||
$script:draft = "latest"
|
||||
$script:logindir = "${env:USERPROFILE}\AppData\Local\Medley\il"
|
||||
$script:medleyArgs = @()
|
||||
$script:noviewer = $false
|
||||
$script:port = $false
|
||||
$script:update = $false
|
||||
$script:wsl = $false
|
||||
$displayFlag = $false
|
||||
$display = ""
|
||||
|
||||
# Variables local this function
|
||||
$passRest = $false
|
||||
$vncRequested = $false
|
||||
|
||||
# Loop thru args
|
||||
for ( $idx = 0; $idx -lt $args.count; $idx++ ) {
|
||||
$arg = $args[$idx]
|
||||
if ($passRest)
|
||||
{
|
||||
$script:medleyArgs += $args
|
||||
continue
|
||||
}
|
||||
switch($arg) {
|
||||
{ @("-b", "--background") -contains $_ }
|
||||
{
|
||||
$script:bg= $true
|
||||
}
|
||||
{ @("-d", "--display") -contains $_ }
|
||||
{
|
||||
$displayFlag = $true
|
||||
$display = $args[$idx+1]
|
||||
if ( ($idx + 1 -gt $args.count) -or ($display -match "^-") )
|
||||
{
|
||||
Write-Output "Error: the `"--display`" flag is missing its value" "Exiting"
|
||||
exit 33
|
||||
}
|
||||
if ( $display -notmatch ":[0-9]+" )
|
||||
{
|
||||
Write-Output "Error: the `"--display`" value is not of the form `":N`, where N is number between 0 and 63: $display" "Exiting"
|
||||
exit 33
|
||||
}
|
||||
}
|
||||
{ @("-h", "--help", "-z", "--man") -contains $_ }
|
||||
{
|
||||
$script:noviewer = $true
|
||||
$script:medleyArgs += $_
|
||||
}
|
||||
{ @("-p", "--port") -contains $_ }
|
||||
{
|
||||
if ( ($idx + 1 -gt $args.count) -or ($args[$idx+1] -match "^-") )
|
||||
{
|
||||
Write-Output "Error: the `"-p / --port`" flag is missing its value" "Exiting"
|
||||
exit 33
|
||||
}
|
||||
$script:port = $args[$idx+1]
|
||||
if (( $script:port -notmatch "^[0-9]*`$" ) -or ( $script:port -le 1024) -or ( $script:port -gt 65535 ))
|
||||
{
|
||||
Write-Output "Error: the value of `"-p / --port`" flag is not an integer between 1025 and 65535: $script:port " "Exiting"
|
||||
exit 33
|
||||
}
|
||||
$idx++
|
||||
}
|
||||
{ @("-u", "--update") -contains $_ }
|
||||
{
|
||||
$script:update = $true
|
||||
}
|
||||
{ @("-v", "--vnc") -contains $_ }
|
||||
{
|
||||
$vncRequested = $true
|
||||
}
|
||||
{ @("-w", "--wsl") -contains $_ }
|
||||
{
|
||||
if (-not (Test-WSLInstalled))
|
||||
{
|
||||
Write-Output "Error: The `"-w / --wsl`" flag was used, But WSL is not installed." "Exiting"
|
||||
exit 33
|
||||
}
|
||||
if ( ($idx + 1 -gt $args.count) -or ($args[$idx+1] -match "^-") )
|
||||
{
|
||||
Write-Output "Error: the `"--wsl`" flag is missing its value" "Exiting"
|
||||
exit 33
|
||||
}
|
||||
$script:wsl = $true
|
||||
$script:wslDistro = $args[$idx + 1]
|
||||
if (($script:wslDistro -ne "-") -and (-not (Test-WSLDistro $script:wslDistro)))
|
||||
{
|
||||
Write-Output "Error: value of `"--wsl`" flag is not an installed WsL distro: $script:wslDistro." "Exiting"
|
||||
exit 33
|
||||
}
|
||||
if (-not (Test-MedleyInstalled $script:wslDistro))
|
||||
{
|
||||
Write-Output "Error: value of `"--wsl`" flag is an installed WsL distro, but Medley is not installed in standard location: $script:wslDistro." "Exiting"
|
||||
exit 33
|
||||
}
|
||||
$idx++
|
||||
}
|
||||
{ @("-x", "--logindir") -contains $_ }
|
||||
{
|
||||
$script:logindir=$args[$idx+1]
|
||||
$idx++
|
||||
}
|
||||
{ @("-y", "--draft") -contains $_ }
|
||||
{
|
||||
$script:draft="draft"
|
||||
}
|
||||
{ $_ -eq "--" }
|
||||
{
|
||||
$passRest=$true
|
||||
$script:medleyArgs += $_
|
||||
}
|
||||
default
|
||||
{
|
||||
$script:medleyArgs += $_
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($script:logindir)
|
||||
{
|
||||
if ($script:wsl)
|
||||
{
|
||||
$script:medleyArgs = @( "--logindir", $script:logindir) + $script:medleyArgs
|
||||
}
|
||||
}
|
||||
if ($script:update -and $script:wsl)
|
||||
{
|
||||
Write-Output "Warning: Both the -u or --update flag and the -w or --wsl flags were given. "
|
||||
Write-Output "The -u or --update flag is not relevant for wsl."
|
||||
Write-Output "Ignoring the -u or --update flag."
|
||||
}
|
||||
if ($vncRequested)
|
||||
{
|
||||
if (-not $script:wsl)
|
||||
{
|
||||
Write-Output "Warning: The -v or --vnc flag is not relevant when running under docker"
|
||||
Write-Output "Ignoring the -v or --vnc flag."
|
||||
}
|
||||
else
|
||||
{
|
||||
$script:medleyArgs = @( "--vnc") + $script:medleyArg
|
||||
}
|
||||
}
|
||||
if ($script:wsl -and $displayFlag)
|
||||
{
|
||||
$script:medleyArgs = @( "--display", "$display") + $script:medleyArg
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
###############################################################################
|
||||
|
||||
#
|
||||
# Main script
|
||||
#
|
||||
|
||||
#
|
||||
# Process the arguments
|
||||
#
|
||||
Process-Args @args
|
||||
|
||||
#
|
||||
# If we're not calling wsl, check if docker is installed and running,
|
||||
# check if logindir is a legitamte directory, do the pull if required.
|
||||
#
|
||||
if (-not $wsl)
|
||||
{
|
||||
# Make sure docker is installed
|
||||
if (-not (Test-DockerInstalled) )
|
||||
{
|
||||
Write-Output "Error: Docker is not installed on this system."
|
||||
Write-Output "This medley app requires Docker unless the --wsl flag is used"
|
||||
Write-Output "Exiting."
|
||||
exit 34
|
||||
}
|
||||
# Make sure docker is running
|
||||
if (-not (Test-DockerRunning) )
|
||||
{
|
||||
Write-Output "Error: The Docker engine is installed but not currently running on this system."
|
||||
Write-Output "This medley app requires the Docker Engine running unless the --wsl flag is used"
|
||||
Write-Output "Exiting."
|
||||
exit 33
|
||||
}
|
||||
# Check/create logindir
|
||||
if (-not (Test-Path -Path $logindir -PathType Container))
|
||||
{
|
||||
try
|
||||
{
|
||||
$null = New-Item -ItemType Directory -Path ${logindir} -Force -ErrorAction Stop
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Output "Error: The specified logindir does not exist and cannot be created: ${logindir}"
|
||||
Write-Output "Exiting."
|
||||
exit 35
|
||||
}
|
||||
}
|
||||
# Do a pull if required
|
||||
if ($update -or (-not (docker image ls interlisp/medley:${draft} | Select-String medley)))
|
||||
{
|
||||
docker pull interlisp/medley:${draft}
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Call wsl or run docker
|
||||
#
|
||||
if ($wsl)
|
||||
{
|
||||
#
|
||||
# Call wsl
|
||||
#
|
||||
if ( $wslDistro -eq "-" )
|
||||
{
|
||||
$distro = @()
|
||||
}
|
||||
else
|
||||
|
||||
{
|
||||
$distro = @( "-d", $wslDistro )
|
||||
}
|
||||
wsl @distro medley @medleyArgs
|
||||
}
|
||||
else
|
||||
|
||||
{
|
||||
#
|
||||
# Run docker and vncviewer
|
||||
#
|
||||
|
||||
# Find an open port to use for vnc
|
||||
if (-not $port) { $port=Find-OpenPort }
|
||||
Write-Output "Using VNC_PORT=$port"
|
||||
|
||||
|
||||
# Unless $noviewer is set (i.e., if --help and --man flag are set),
|
||||
# start the vncviwer in the background.
|
||||
# But wait for the docker container to actually come up
|
||||
# before starting it
|
||||
if (-not $noviewer)
|
||||
{
|
||||
Start-Job -InputObject "$port" -ScriptBlock {
|
||||
$port = $input.Clone()
|
||||
$stopTime = (Get-Date).AddSeconds(10)
|
||||
$hit=$false
|
||||
while ((-not $hit) -and ((Get-Date) -lt $stopTime))
|
||||
{
|
||||
docker container ls | Select-String 'medley' | Select-String "${port}->5900" | Set-Variable "hit"
|
||||
if (-not $hit) { Start-Sleep -Milliseconds 250 }
|
||||
}
|
||||
if ($hit)
|
||||
{
|
||||
Write-Host $hit
|
||||
vncviewer64-1.12.0.exe -geometry '+50+50' -ReconnectOnError=off −AlertOnFatalError=off localhost:${port}
|
||||
}
|
||||
} >$null
|
||||
}
|
||||
|
||||
#
|
||||
# Run the docker container using medley as the entrypoint and passing on the args
|
||||
# Run in the foreground unless requested to run in the background by the -b flag.
|
||||
#
|
||||
|
||||
if (-not $bg)
|
||||
{
|
||||
docker run -it --rm -p ${port}:5900 -v ${logindir}:/home/medley/il --entrypoint medley --env TERM=xterm interlisp/medley:${draft} --windows @medleyArgs
|
||||
}
|
||||
else
|
||||
{
|
||||
$dockerArgs=@("run", "--rm", "-p", "${port}:5900", "-v", "${logindir}:/home/medley/il", "--entrypoint", "medley", "interlisp/medley:${draft}", "--windows") + $medleyArgs
|
||||
Start-Process -NoNewWindow -FilePath "docker" -ArgumentList $dockerArgs
|
||||
}
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Done
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
@@ -56,13 +56,39 @@ export MEDLEYDIR=$(cd ${SCRIPTDIR}; cd ../..; pwd)
|
||||
IL_DIR=$(cd ${MEDLEYDIR}; cd ..; pwd)
|
||||
export LOGINDIR=${HOME}/il
|
||||
|
||||
# Are we running under WSL?
|
||||
grep --ignore-case --quiet wsl /proc/sys/kernel/osrelease
|
||||
if [ $? -eq 0 ];
|
||||
# Are we running under Docker or if not under WSL?
|
||||
if [ -n "${MEDLEY_DOCKER_BUILD_DATE}" ];
|
||||
then
|
||||
wsl='true'
|
||||
else
|
||||
docker='true'
|
||||
wsl='false'
|
||||
else
|
||||
docker='false'
|
||||
wsl_ver=0
|
||||
# WSL2
|
||||
grep --ignore-case --quiet wsl /proc/sys/kernel/osrelease
|
||||
if [ $? -eq 0 ];
|
||||
then
|
||||
wsl='true'
|
||||
wsl_ver=2
|
||||
else
|
||||
# WSL1
|
||||
grep --ignore-case --quiet microsoft /proc/sys/kernel/osrelease
|
||||
if [ $? -eq 0 ];
|
||||
then
|
||||
if [ $(uname -m) = x86_64 ];
|
||||
then
|
||||
wsl='true'
|
||||
wsl_ver=1
|
||||
else
|
||||
echo "ERROR: Running Medley on WSL1 requires an x86_64-based PC."
|
||||
echo "This is not an x86_64-based PC."
|
||||
echo "Exiting"
|
||||
exit 23
|
||||
fi
|
||||
else
|
||||
wsl='false'
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# process args
|
||||
@@ -79,7 +105,7 @@ then
|
||||
exit 3
|
||||
fi
|
||||
|
||||
# Set the LDEDESTSYSOUT env variable based on id
|
||||
# Set LDEDESTSYSOUT env variable based on id
|
||||
if [ -z ${LDEDESTSYSOUT} ];
|
||||
then
|
||||
if [ "${run_id}" = "default" ];
|
||||
@@ -104,12 +130,12 @@ fi
|
||||
mkdir -p ${LOGINDIR}/vmem
|
||||
|
||||
# Call run-medley with or without vnc
|
||||
if [[ ${wsl} = false || ${use_vnc} = false ]];
|
||||
if [[ ( ${wsl} = false || ${use_vnc} = false ) && ${docker} = false ]];
|
||||
then
|
||||
# If not using vnc, just call run-medley
|
||||
${MEDLEYDIR}/run-medley -id "${run_id}" ${geometry} ${screensize} "${run_args[@]}"
|
||||
${MEDLEYDIR}/run-medley -id "${run_id}" ${geometry} ${screensize} ${run_args[@]}
|
||||
else
|
||||
# do the vnc thing on wsl
|
||||
# do the vnc thing on wsl or docker
|
||||
source ${SCRIPTDIR}/medley_vnc.sh
|
||||
fi
|
||||
|
||||
|
||||
172
scripts/medley/medley_args.sh
Normal file → Executable file
172
scripts/medley/medley_args.sh
Normal file → Executable file
@@ -14,27 +14,53 @@
|
||||
# load usage function
|
||||
source ${SCRIPTDIR}/medley_usage.sh
|
||||
|
||||
# Process args
|
||||
# Defaults
|
||||
apps_flag=false
|
||||
err_msg=""
|
||||
full_flag=false
|
||||
geometry=""
|
||||
greet_specified=false
|
||||
lisp_flag=false
|
||||
noscroll=false
|
||||
pass_args=false
|
||||
run_args=()
|
||||
run_id="default"
|
||||
use_vnc='false'
|
||||
geometry=""
|
||||
screensize=""
|
||||
noscroll='false'
|
||||
pass_args=false
|
||||
lisp_flag=false
|
||||
full_flag=false
|
||||
apps_flag=false
|
||||
sysout_flag=false
|
||||
sysout_arg=""
|
||||
err_msg=""
|
||||
greet_specified='false'
|
||||
use_vnc=false
|
||||
windows=false
|
||||
|
||||
# Loop thru args and process
|
||||
while [ "$#" -ne 0 ];
|
||||
do
|
||||
if [ ${pass_args} = false ];
|
||||
then
|
||||
case "$1" in
|
||||
-a | --apps)
|
||||
sysout_arg="apps"
|
||||
apps_flag=true
|
||||
;;
|
||||
-d | --display)
|
||||
check_for_dash_or_end "$1" "$2"
|
||||
run_args+=(-d $2)
|
||||
shift
|
||||
;;
|
||||
-e | --interlisp)
|
||||
export MEDLEY_EXEC="inter"
|
||||
;;
|
||||
-f | --full)
|
||||
sysout_arg="-full"
|
||||
full_flag=true
|
||||
;;
|
||||
-g | --geometry)
|
||||
check_for_dash_or_end "$1" "$2"
|
||||
geometry="$2"
|
||||
shift
|
||||
;;
|
||||
-h | --help)
|
||||
usage
|
||||
;;
|
||||
-i | --id)
|
||||
if [ "$2" = "-" ];
|
||||
then
|
||||
@@ -48,6 +74,47 @@ do
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
-k | --vmem)
|
||||
check_for_dash_or_end "$1" "$2"
|
||||
check_file_writeable_or_creatable "$1" "$2"
|
||||
export LDEDESTSYSOUT="$2"
|
||||
shift
|
||||
;;
|
||||
-l | --lisp)
|
||||
sysout_arg="-lisp"
|
||||
lisp_flag=true
|
||||
;;
|
||||
-m | --mem)
|
||||
check_for_dash_or_end "$1" "$2"
|
||||
run_args+=(-m $2)
|
||||
shift
|
||||
;;
|
||||
-n | --noscroll)
|
||||
noscroll=true
|
||||
run_args+=("-noscroll")
|
||||
;;
|
||||
-r | --greet)
|
||||
if [[ "$2" = "-" || "$2" = "--" ]];
|
||||
then
|
||||
run_args+=("--nogreet")
|
||||
else
|
||||
check_for_dash_or_end "$1" "$2"
|
||||
check_file_readable "$1" "$2"
|
||||
run_args+=("-greet" "$2")
|
||||
fi
|
||||
greet_specified='true'
|
||||
shift
|
||||
;;
|
||||
-s | --screensize)
|
||||
check_for_dash_or_end "$1" "$2"
|
||||
screensize="$2"
|
||||
shift
|
||||
;;
|
||||
-t | --title)
|
||||
check_for_dash_or_end "$1" "$2"
|
||||
run_args+=(-title $2)
|
||||
shift
|
||||
;;
|
||||
-v | --vnc)
|
||||
if [[ ${wsl} = true && $(uname -m) = x86_64 ]];
|
||||
then
|
||||
@@ -60,68 +127,6 @@ do
|
||||
use_vnc=false
|
||||
fi
|
||||
;;
|
||||
-g | --geometry)
|
||||
check_for_dash_or_end "$1" "$2"
|
||||
geometry="$2"
|
||||
shift
|
||||
;;
|
||||
-s | --screensize)
|
||||
check_for_dash_or_end "$1" "$2"
|
||||
screensize="$2"
|
||||
shift
|
||||
;;
|
||||
-n | --noscroll)
|
||||
noscroll=true
|
||||
run_args+=("-noscroll")
|
||||
;;
|
||||
-e | --interlisp)
|
||||
export MEDLEY_EXEC="inter"
|
||||
;;
|
||||
-a | --apps)
|
||||
sysout_arg="apps"
|
||||
apps_flag=true
|
||||
;;
|
||||
-f | --full)
|
||||
sysout_arg="-full"
|
||||
full_flag=true
|
||||
;;
|
||||
-l | --lisp)
|
||||
sysout_arg="-lisp"
|
||||
lisp_flag=true
|
||||
;;
|
||||
-m | --mem)
|
||||
check_for_dash_or_end "$1" "$2"
|
||||
run_args+=(-m $2)
|
||||
shift
|
||||
;;
|
||||
-t | --title)
|
||||
check_for_dash_or_end "$1" "$2"
|
||||
run_args+=(-title $2)
|
||||
shift
|
||||
;;
|
||||
-d | --display)
|
||||
check_for_dash_or_end "$1" "$2"
|
||||
run_args+=(-d $2)
|
||||
shift
|
||||
;;
|
||||
-r | --greet)
|
||||
if [[ "$2" = "-" || "$2" = "--" ]];
|
||||
then
|
||||
run_args+=("--nogreet")
|
||||
else
|
||||
check_for_dash_or_end "$1" "$2"
|
||||
check_file_readable "$1" "$2"
|
||||
run_args+=("-greet" "$2")
|
||||
fi
|
||||
greet_specified='true'
|
||||
shift
|
||||
;;
|
||||
-p | --vmem)
|
||||
check_for_dash_or_end "$1" "$2"
|
||||
check_file_writeable_or_creatable "$1" "$2"
|
||||
export LDEDESTSYSOUT="$2"
|
||||
shift
|
||||
;;
|
||||
-x | --logindir)
|
||||
if [[ "$2" = "-" || "$2" = "--" ]];
|
||||
then
|
||||
@@ -134,13 +139,14 @@ do
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
-h | --help)
|
||||
usage
|
||||
;;
|
||||
-z | --man)
|
||||
/usr/bin/man -l "${MEDLEYDIR}/docs/man-page/medley.1.gz"
|
||||
exit 0
|
||||
;;
|
||||
--windows)
|
||||
# internal: called from Windows medley.ps1 (via docker)
|
||||
windows=true
|
||||
;;
|
||||
--)
|
||||
pass_args=true
|
||||
;;
|
||||
@@ -190,15 +196,23 @@ then
|
||||
fi
|
||||
if [ "${sysout_arg}" = "apps" ];
|
||||
then
|
||||
export LDESRCESYSOUT="$MEDLEYDIR/loadups/apps.sysout"
|
||||
export LDESRCESYSOUT="${MEDLEYDIR}/loadups/apps.sysout"
|
||||
if [ "${greet_specified}" = "false" ];
|
||||
then
|
||||
export LDEINIT="$MEDLEYDIR/greetfiles/APPS-INIT.LCOM"
|
||||
export LDEINIT="${MEDLEYDIR}/greetfiles/APPS-INIT.LCOM"
|
||||
fi
|
||||
else
|
||||
# pass on to run-medley
|
||||
export LDESRCESYSOUT=""
|
||||
run_args+=("${sysout_arg}")
|
||||
unset LDESRCESYSOUT
|
||||
if [ -n "${sysout_arg}" ];
|
||||
then
|
||||
run_args+=("${sysout_arg}")
|
||||
fi
|
||||
fi
|
||||
|
||||
# if running on WSL1, force use_vnc
|
||||
if [[ ${wsl} = true && ${wsl_ver} -eq 1 ]];
|
||||
then
|
||||
use_vnc=true
|
||||
fi
|
||||
|
||||
|
||||
@@ -17,6 +17,34 @@ usage() {
|
||||
local err_msg
|
||||
local msg_path=/tmp/msg-$$
|
||||
local lines=("$@")
|
||||
|
||||
if [ ${wsl} = true ];
|
||||
then
|
||||
wsl_incl="+w"
|
||||
wsl_excl="-w"
|
||||
else
|
||||
wsl_incl="-w"
|
||||
wsl_excl="+w"
|
||||
fi
|
||||
|
||||
if [ ${docker} = true ];
|
||||
then
|
||||
docker_incl="+d"
|
||||
docker_excl="-d"
|
||||
else
|
||||
docker_incl="-d"
|
||||
docker_excl="+d"
|
||||
fi
|
||||
|
||||
if [ ${windows} = true ];
|
||||
then
|
||||
windows_incl="+W"
|
||||
windows_excl="-W"
|
||||
else
|
||||
windows_incl="-W"
|
||||
windows_excl="+W"
|
||||
fi
|
||||
|
||||
if [ $# -ne 0 ];
|
||||
then
|
||||
echo > ${msg_path}
|
||||
@@ -26,7 +54,12 @@ usage() {
|
||||
else
|
||||
touch ${msg_path}
|
||||
fi
|
||||
cat ${msg_path} - <<EOF | ${PAGER}
|
||||
|
||||
cat ${msg_path} - <<EOF \
|
||||
| sed -e "/^${docker_excl}/d" -e "s/^${docker_incl}/ /" \
|
||||
| sed -e "/^${wsl_excl}/d" -e "s/^${wsl_incl}/ /" \
|
||||
| sed -e "/^${windows_excl}/d" -e "s/^${windows_incl}/ /" \
|
||||
| ${PAGER}
|
||||
Usage: medley [flags] [sysout] [--] [pass_args ...]
|
||||
|
||||
Note: MEDLEYDIR is the directory at the top of the code tree where this script is executed from
|
||||
@@ -56,8 +89,8 @@ flags:
|
||||
-t STRING | --title STRING : use STRING as title of window
|
||||
|
||||
-d :N | --display :N : use X display :N
|
||||
|
||||
-v | --vnc : (WSL only) Use a VNC window instead of an X window
|
||||
+w
|
||||
+w -v | --vnc : (WSL only) Use a VNC window instead of an X window
|
||||
|
||||
-i STRING | --id STRING : use STRING as the id for this run of Medley (default: default)
|
||||
|
||||
@@ -67,20 +100,33 @@ flags:
|
||||
|
||||
-m N | --mem N : set Medley memory size to N
|
||||
|
||||
-p FILE | --vmem FILE : use FILE as the Medley virtual memory store
|
||||
-k FILE | --vmem FILE : use FILE as the Medley virtual memory store.
|
||||
+d FILE must be a file in the Medley file system under LOGINDIR (/home/medley/il).
|
||||
|
||||
-r FILE | --greet FILE : use FILE as the Medley greetfile
|
||||
-r FILE | --greet FILE : use FILE as the Medley greetfile.
|
||||
+d FILE must be a file in the Medley file system under LOGINDIR (/home/medley/il).
|
||||
|
||||
-r - | --greet - : do not use a greetfile
|
||||
|
||||
-x DIR | --logindir DIR : use DIR as LOGINDIR in Medley
|
||||
|
||||
-x - | --logindir - : use MEDLEYDIR/logindir as LOGINDIR in Medley
|
||||
-d
|
||||
-d -x DIR | --logindir DIR : use DIR as LOGINDIR in Medley
|
||||
-d
|
||||
-d -x - | --logindir - : use MEDLEYDIR/logindir as LOGINDIR in Medley
|
||||
+d
|
||||
+d -x DIR | --logindir DIR : use DIR (on the host) to map to LOGINDIR (/home/medley/il) in Medley
|
||||
+d
|
||||
+d -p N | --port N : use N as the port for connecting to the Xvnc server inside the Docker container
|
||||
+d
|
||||
+d -u | --update : first do a pull to get the latest medley Docker image
|
||||
+W
|
||||
+W -w DISTRO | --wsl DISTRO : run in WSL (on the named DISTRO) instead of in a Docker container
|
||||
+W
|
||||
+W -b | --background : run as background process
|
||||
|
||||
sysout:
|
||||
The name of the file to use as a sysout for Medley to start from. If sysout is not
|
||||
provided and none of the flags [-a, -f & -l] is used, then Medley will start from
|
||||
the saved virtual memory file for the id for this run.
|
||||
The pathname of the file to use as a sysout for Medley to start from.
|
||||
+d The pathname must be in the Medley file system under LOGINDIR (/home/medley/il).
|
||||
If sysout is not provided and none of the flags [-a, -f & -l] is used, then Medley will start from
|
||||
the saved virtual memory file for the previous run with the sane id as this run.
|
||||
|
||||
pass_args:
|
||||
All arguments after the "--" flag, are passed unaltered to lde via run-medley.
|
||||
|
||||
@@ -21,15 +21,23 @@
|
||||
find_open_display() {
|
||||
local ctr=1
|
||||
local result=-1
|
||||
local locked_pid=0
|
||||
while [ ${ctr} -lt 64 ];
|
||||
do
|
||||
ss -a | grep -q "tmp/.X11-unix/X${ctr}[^0-9]"
|
||||
if [ $? -ne 0 ];
|
||||
if [ ! -e /tmp/.X${ctr}-lock ];
|
||||
then
|
||||
result=${ctr}
|
||||
break
|
||||
else
|
||||
(( ctr++ ))
|
||||
locked_pid=$(cat /tmp/.X${ctr}-lock)
|
||||
ps lax | awk '{print $3}' | grep --quiet ${locked_pid} >/dev/null
|
||||
if [ $? -eq 1 ];
|
||||
then
|
||||
result=${ctr}
|
||||
break
|
||||
else
|
||||
(( ctr++ ))
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo ${result}
|
||||
@@ -40,8 +48,13 @@
|
||||
local result=-1
|
||||
while [ ${ctr} -lt 6000 ];
|
||||
do
|
||||
ss -a | grep -q "LISTEN.*:${ctr}[^0-9]"
|
||||
if [ $? -ne 0 ];
|
||||
if [[ ${wsl} = true && ${wsl_ver} -eq 1 ]];
|
||||
then
|
||||
netstat.exe -a -n | awk '{ print $2 }' | grep -q ":${ctr}\$"
|
||||
else
|
||||
ss -a | grep -q "LISTEN.*:${ctr}[^0-9]"
|
||||
fi
|
||||
if [ $? -eq 1 ];
|
||||
then
|
||||
result=${ctr}
|
||||
break
|
||||
@@ -53,102 +66,185 @@
|
||||
}
|
||||
|
||||
#
|
||||
# Make sure prequisites for vnc support are in place
|
||||
# Make sure prequisites for vnc support in wsl are in place
|
||||
#
|
||||
win_userprofile="$(cmd.exe /c "<nul set /p=%UserProfile%" 2>/dev/null)"
|
||||
vnc_dir="$(wslpath ${win_userprofile})/AppData/Local/Interlisp"
|
||||
vnc_exe="vncviewer64-1.12.0.exe"
|
||||
if [[ $(which Xvnc) = "" || $(Xvnc -version |& grep -iq tigervnc; echo $?) -eq 1 ]];
|
||||
if [ "${use_vnc}" = "true" ];
|
||||
then
|
||||
echo "Error: The -v or --vnc flag was set."
|
||||
echo "But it appears that that TigerVNC \(Xvnc\) has not been installed."
|
||||
echo "Please install TigerVNC using \"sudo apt install tigervnc-standalone-server tigervnc-xorg-extension\""
|
||||
echo "Exiting."
|
||||
exit 4
|
||||
elif [ ! -e "${vnc_dir}/${vnc_exe}" ];
|
||||
then
|
||||
if [ -e "${IL_DIR}/wsl/${vnc_exe}" ];
|
||||
win_userprofile="$(cmd.exe /c "<nul set /p=%UserProfile%" 2>/dev/null)"
|
||||
vnc_dir="$(wslpath ${win_userprofile})/AppData/Local/Interlisp"
|
||||
vnc_exe="vncviewer64-1.12.0.exe"
|
||||
if [[ $(which Xvnc) = "" || $(Xvnc -version |& grep -iq tigervnc; echo $?) -eq 1 ]];
|
||||
then
|
||||
# make sure TigerVNC viewer is in a Windows (not Linux) directory. If its in a Linux directory
|
||||
# there will be a long delay when it starts up
|
||||
mkdir -p ${vnc_dir}
|
||||
cp -p "${IL_DIR}/wsl/${vnc_exe}" "${vnc_dir}/${vnc_exe}"
|
||||
else
|
||||
echo "TigerVnc viewer is required by the -vnc option but is not installed."
|
||||
echo -n "Ok to download from SourceForge? [y, Y, n or N, default n] "
|
||||
read resp
|
||||
if [ -z ${resp} ]; then resp=n; else resp=${resp:0:1}; fi
|
||||
if [[ ${resp} = 'n' || ${resp} = 'N' ]];
|
||||
echo "Error: The -v or --vnc flag was set."
|
||||
echo "But it appears that that TigerVNC \(Xvnc\) has not been installed."
|
||||
echo "Please install TigerVNC using \"sudo apt install tigervnc-standalone-server tigervnc-xorg-extension\""
|
||||
echo "Exiting."
|
||||
exit 4
|
||||
elif [ ! -e "${vnc_dir}/${vnc_exe}" ];
|
||||
then
|
||||
if [ -e "${IL_DIR}/wsl/${vnc_exe}" ];
|
||||
then
|
||||
echo "Ok. You can download the Tiger VNC viewer \(v1.12.0\) .exe yourself and "
|
||||
echo "place it in ${vnc_dir}/${vnc_exe}. Then retry."
|
||||
echo "Exiting."
|
||||
exit 5
|
||||
# make sure TigerVNC viewer is in a Windows (not Linux) directory. If its in a Linux directory
|
||||
# there will be a long delay when it starts up
|
||||
mkdir -p ${vnc_dir}
|
||||
cp -p "${IL_DIR}/wsl/${vnc_exe}" "${vnc_dir}/${vnc_exe}"
|
||||
else
|
||||
pushd "${vnc_dir}" >/dev/null
|
||||
wget https://sourceforge.net/projects/tigervnc/files/stable/1.12.0/vncviewer64-1.12.0.exe
|
||||
popd >/dev/null
|
||||
echo "TigerVnc viewer is required by the -vnc option but is not installed."
|
||||
echo -n "Ok to download from SourceForge? [y, Y, n or N, default n] "
|
||||
read resp
|
||||
if [ -z ${resp} ]; then resp=n; else resp=${resp:0:1}; fi
|
||||
if [[ ${resp} = 'n' || ${resp} = 'N' ]];
|
||||
then
|
||||
echo "Ok. You can download the Tiger VNC viewer \(v1.12.0\) .exe yourself and "
|
||||
echo "place it in ${vnc_dir}/${vnc_exe}. Then retry."
|
||||
echo "Exiting."
|
||||
exit 5
|
||||
else
|
||||
pushd "${vnc_dir}" >/dev/null
|
||||
wget https://sourceforge.net/projects/tigervnc/files/stable/1.12.0/vncviewer64-1.12.0.exe
|
||||
popd >/dev/null
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# Find an unused display, start Xvnc, run-medley, then start the vnc viewer on the windows side
|
||||
# Start the log file so we can trace any issues with vnc, etc
|
||||
#
|
||||
#set -x
|
||||
LOG=${LOGINDIR}/logs/medley_${run_id}.log
|
||||
mkdir -p $(dirname -- ${LOG})
|
||||
echo "START" >${LOG}
|
||||
OPEN_DISPLAY=`find_open_display`
|
||||
if [ ${OPEN_DISPLAY} -eq -1 ];
|
||||
#
|
||||
# If we're running under docker:
|
||||
# set the VNC_PORT to the value of the --port flag (or its default value)
|
||||
# set DISPLAY to :0
|
||||
#
|
||||
#set -x
|
||||
if [ "${docker}" = "true" ];
|
||||
then
|
||||
echo "Error: cannot find an unused DISPLAY between 1 and 63"
|
||||
echo "Exiting"
|
||||
exit 33
|
||||
export VNC_PORT=5900
|
||||
export DISPLAY=:0
|
||||
else
|
||||
echo "Using DISPLAY=${OPEN_DISPLAY}"
|
||||
# are we running in background - used for pretty-fying the echos
|
||||
case $(ps -o stat= -p $$) in
|
||||
*+*) bg=false ;;
|
||||
*) bg=true ;;
|
||||
esac
|
||||
# For not docker (i.e., for wsl/vnc)
|
||||
# find an unused display and an available port
|
||||
#
|
||||
#set -x
|
||||
OPEN_DISPLAY=`find_open_display`
|
||||
if [ ${OPEN_DISPLAY} -eq -1 ];
|
||||
then
|
||||
echo "Error: cannot find an unused DISPLAY between 1 and 63"
|
||||
echo "Exiting"
|
||||
exit 33
|
||||
else
|
||||
if [ ${bg} = true ]; then echo; fi
|
||||
echo "Using DISPLAY=:${OPEN_DISPLAY}"
|
||||
fi
|
||||
export DISPLAY=":${OPEN_DISPLAY}"
|
||||
export VNC_PORT=`find_open_port`
|
||||
if [ ${VNC_PORT} -eq -1 ];
|
||||
then
|
||||
echo "Error: cannot find an unused port between 5900 and 5999"
|
||||
echo "Exiting"
|
||||
exit 33
|
||||
else
|
||||
echo "Using VNC_PORT=${VNC_PORT}"
|
||||
fi
|
||||
fi
|
||||
VNC_PORT=`find_open_port`
|
||||
if [ ${VNC_PORT} -eq -1 ];
|
||||
then
|
||||
echo "Error: cannot find an unused port between 5900 and 5999"
|
||||
echo "Exiting"
|
||||
exit 33
|
||||
else
|
||||
echo "Using VNC_PORT=${VNC_PORT}"
|
||||
fi
|
||||
export DISPLAY=":${OPEN_DISPLAY}"
|
||||
# start vnc
|
||||
#
|
||||
# Start the Xvnc server
|
||||
#
|
||||
mkdir -p ${LOGINDIR}/logs
|
||||
/usr/bin/Xvnc ":${OPEN_DISPLAY}" \
|
||||
/usr/bin/Xvnc "${DISPLAY}" \
|
||||
-rfbport ${VNC_PORT} \
|
||||
-geometry "${geometry#-g }" \
|
||||
-SecurityTypes None \
|
||||
-NeverShared \
|
||||
-DisconnectClients=0 \
|
||||
--MaxDisconnectionTime=10 \
|
||||
>> ${LOG} 2>&1 &
|
||||
xvnc_pid=""
|
||||
while [ -z ${xvnc_pid} ];
|
||||
do
|
||||
sleep .25
|
||||
xvnc_pid=$(ps h -C Xvnc -o pid,command | grep "Xvnc :${OPEN_DISPLAY}" | awk '{print $1}')
|
||||
done
|
||||
echo "XVNC_PID is ${xvnc_pid}"
|
||||
# run Medley
|
||||
( ${MEDLEYDIR}/run-medley -id "${run_id}" ${geometry} ${screensize} "${run_args[@]}" 2>>${LOG} \
|
||||
; \
|
||||
kill -9 ${xvnc_pid} ${xvnc_pid} >>${LOG} 2>&1
|
||||
) &
|
||||
# Give medley time to startup
|
||||
sleep 2
|
||||
# Start vnc viewer on Windows side
|
||||
pushd ${vnc_dir} >/dev/null
|
||||
( ./${vnc_exe} -geometry "+50+50" \
|
||||
-ReconnectOnError=off \
|
||||
−AlertOnFatalError=off \
|
||||
$(ip_addr):${VNC_PORT} \
|
||||
>>${LOG} 2>&1 \
|
||||
; \
|
||||
kill -9 ${xvnc_pid} >>${LOG} 2>&1 \
|
||||
) &
|
||||
popd >/dev/null
|
||||
|
||||
# Leaving pid wait for all but docker,
|
||||
# which seems to need it. For all others
|
||||
# it seems like its not needed but we'll have
|
||||
# to see how it runs on slower/faster machines
|
||||
# FGH 2023-02-16
|
||||
if [ ${docker} = true ];
|
||||
then
|
||||
xvnc_pid=""
|
||||
end_time=$(expr $(date +%s) + 10)
|
||||
while [ -z "${xvnc_pid}" ];
|
||||
do
|
||||
if [ $(date +%s) -gt $end_time ];
|
||||
then
|
||||
echo "Xvnc server failed to start."
|
||||
echo "See log file at ${LOG}"
|
||||
echo "Exiting"
|
||||
exit 3
|
||||
fi
|
||||
sleep .125
|
||||
xvnc_pid=$(pgrep -f "Xvnc ${DISPLAY}")
|
||||
done
|
||||
# echo "XVNC_PID is ${xvnc_pid}"
|
||||
fi
|
||||
#
|
||||
# Run Medley in foreground if docker, else in background
|
||||
#
|
||||
tmp_dir=$(if [[ -d /run/shm && ! -h /run/shm ]]; then echo "/run/shm"; else echo "/tmp"; fi)
|
||||
medley_run=$(mktemp --tmpdir=${tmp_dir} medley-XXXXX)
|
||||
cat > ${medley_run} <<..EOF
|
||||
#!/bin/bash
|
||||
${MEDLEYDIR}/run-medley -id '${run_id}' ${geometry} ${screensize} ${run_args[@]} \
|
||||
2>&1 | tee -a ${LOG} | grep -v "broken (explicit kill"
|
||||
if [ -n "\$(pgrep -f "${vnc_exe}.*:${VNC_PORT}")" ]; then vncconfig -disconnect; fi
|
||||
..EOF
|
||||
#cat ${medley_run}
|
||||
chmod +x ${medley_run}
|
||||
if [ "${docker}" = "true" ];
|
||||
then
|
||||
${medley_run}; rm ${medley_run}
|
||||
else
|
||||
(${medley_run}; rm ${medley_run}) &
|
||||
#
|
||||
# If not docker (i.e., if wsl/vnc), start the vncviewer on the windows side
|
||||
#
|
||||
|
||||
# First give medley time to startup
|
||||
# sleep .25
|
||||
# SLeep appears not to be needed, but faster/slower machines ????
|
||||
# FGH 2023-02-08
|
||||
|
||||
# Then start vnc viewer on Windows side
|
||||
start_time=$(date +%s)
|
||||
${vnc_dir}/${vnc_exe} \
|
||||
-geometry "+50+50" \
|
||||
-ReconnectOnError=off \
|
||||
−AlertOnFatalError=off \
|
||||
$(ip_addr):${VNC_PORT} \
|
||||
>>${LOG} 2>&1 &
|
||||
wait $!
|
||||
if [ $( expr $(date +%s) - ${start_time} ) -lt 5 ];
|
||||
then
|
||||
if [ -z "$(pgrep -f "Xvnc ${DISPLAY}")" ];
|
||||
then
|
||||
echo "Xvnc server failed to start."
|
||||
echo "See log file at ${LOG}"
|
||||
echo "Exiting"
|
||||
exit 3
|
||||
else
|
||||
echo "VNC viewer failed to start.";
|
||||
echo "See log file at ${LOG}";
|
||||
echo "Exiting" ;
|
||||
exit 4;
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
#
|
||||
# Done, "Go back" to medley.sh
|
||||
#
|
||||
true
|
||||
|
||||
#######################################
|
||||
|
||||
Reference in New Issue
Block a user