Installers for Linux: workflow changes and more to support standard Linux installations (#1058)
* Adding LANG environment variable to docker image; adding MAIKO_ and MEDLEY_INSTALLDIR environment variables; Changing /usr/local/bin/run-medley to a symbolic link instead of a shell script * Added draft input to all workflows, so that can create draft releases as well as regular releases * Update buildDocker.yml to handle deprecation of set-output and to update versions of actions to handle node 12 to node 16 transition. * Added scripts and updated github workflows to support creation of deb installers for Linux and WSL * Fix minor bug in buildLoadup.yml * First pass implementation of deb installer * Fixing wget of vncviewer in build_deb.sh * Fix typo in buildLoadup.yml in call to build_deb.sh * Multiple small fixes to medley.sh from debugging. Change postinst script and how its created in build_deb. Add postrm script in build_deb. * Reworking vnc portion of Medley.sh - including removing dependency on startx and xinit * Misc fixes to medley_vnc.sh script; fix creation of postinst and postrm in build_deb.sh * Cleaning up window geometry amd screen size in medley.sh * Created apps.sysout loadup with rooms, notecards, clos on top of full.sysout; added plumbing for -apps flag to run-medley to run this syout; created a new init file for this sysout that calls MEDLEYDIR-INIT; all of this is based on online.sysout * Create UNIXUTILS file in library with ShellWhich function - linux which command equivalent. Also move ShellCommand from UNIXPRINT to UNIXUTILS. * Adding UNIXUTILS to LOADUP-FULL so it gets included in full.sysout * Change of names from open(er) to browse(r). Refine the browse(r) functions a bit * Minor bug fixes * Update Apps.ShowDoc to new ShellBrowsefunction * Adding apps support into the .github builds; adding xdg-utils as dependecy in debs * fixing bug as to where notecards is checked out in BuildLoadup. Needs to be before loadups so app.sysout can be built * Added defaulting to Interlisp exec tomedley.sh and APPS-INIT. Works only in apps.sysout. Added wlsu package to wsl debs since wlsview is not always installed by defailt. Fixed Notefiles directories issues in Apps.Init. Made medley.sh compute medleydir based on where the script is located. Can now work for /usr/lcal/interlisp as well as local directories. * Added -id - feature to medley.sh so id can be directory mae. Removed extraneous set -x commands in medley.sh from debugging. In build_deb.sh changed compression to xz for deb files since debian does not support the zstd compression that ubuntu uses. * For wsl deb files, make sure wslu package is not 4.0 - which is bad. Change how we choose an open port and open display in medley_vnc.sh. Add notecards download to build_deb.sh. Fix type in medley.sh * Add (FILES UNIXUTILS) to UNIXPRINTCOMS so that ShellCommand is loaded in case only UNIXPRINT is loaded. For backward compatibility. * Moved medley.sh and associates to script/medley dir; fixed up args to medley.sh; added usage and --help to medley.sh * Add comprehensive tar files to releases to match deb files for local installs; add --id -- arg to medley.sh * Remove remaining reference to usr/local/interlisp to ensure local install works * Fix bug in buildLoadup - couldn't file install tars * Add medley symbolic linkto loadups, so it comes thru to local install tars * Fix up error messaging in medley.sh scripts * Created man page for medley and added it throughout build up, installers, etc. * Add support for a downloads page on OIO, including creating said page while building a release * Fix full_release_tag in downloads section of buildLoadup.yml * Misc fixups on downloads page * Adding online man page stored on oio static server. * Fix minor bug in man installation in deb file
This commit is contained in:
@@ -16,4 +16,7 @@ fi
|
||||
./scripts/cpv tmp/lisp.sysout loadups
|
||||
./scripts/cpv tmp/whereis.hash loadups
|
||||
./scripts/cpv tmp/exports.all library
|
||||
if [ "${1}" = "-apps" ]; then
|
||||
./scripts/cpv tmp/apps.sysout loadups
|
||||
fi
|
||||
|
||||
|
||||
@@ -7,12 +7,19 @@ if [ ! -x run-medley ] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$1" = "-apps" ]; then
|
||||
apps="./scripts/loadup-apps-from-full.sh"
|
||||
else
|
||||
apps="true"
|
||||
fi
|
||||
|
||||
./scripts/loadup-init.sh && \
|
||||
./scripts/loadup-mid-from-init.sh && \
|
||||
./scripts/loadup-lisp-from-mid.sh && \
|
||||
./scripts/loadup-full-from-lisp.sh && \
|
||||
${apps} && \
|
||||
./scripts/loadup-aux.sh && \
|
||||
./scripts/copy-all.sh
|
||||
./scripts/copy-all.sh $1
|
||||
|
||||
echo "**** DONE ****"
|
||||
|
||||
|
||||
73
scripts/loadup-apps-from-full.sh
Executable file
73
scripts/loadup-apps-from-full.sh
Executable file
@@ -0,0 +1,73 @@
|
||||
#!/bin/bash
|
||||
|
||||
#set -x
|
||||
|
||||
# function to discover what directory this script is being executed from
|
||||
where_am_i() {
|
||||
|
||||
# call this with ${BASH_SOURCE[0]:-$0} as its (only) parameter
|
||||
|
||||
local SCRIPT_PATH="$1";
|
||||
|
||||
pushd . > '/dev/null';
|
||||
|
||||
while [ -h "$SCRIPT_PATH" ];
|
||||
do
|
||||
cd "$( dirname -- "$SCRIPT_PATH"; )";
|
||||
SCRIPT_PATH="$( readlink -f -- "$SCRIPT_PATH"; )";
|
||||
done
|
||||
|
||||
cd "$( dirname -- "$SCRIPT_PATH"; )" > '/dev/null';
|
||||
SCRIPT_PATH="$( pwd; )";
|
||||
|
||||
popd > '/dev/null';
|
||||
|
||||
echo "${SCRIPT_PATH}"
|
||||
}
|
||||
|
||||
SCRIPTDIR=$(where_am_i "${BASH_SOURCE[0]:-$0}")
|
||||
export MEDLEYDIR=$(cd ${SCRIPTDIR} && cd .. && pwd)
|
||||
export ROOMSDIR=${MEDLEYDIR}/rooms
|
||||
export CLOSDIR=${MEDLEYDIR}/clos
|
||||
|
||||
export NOTECARDSDIR=${MEDLEYDIR}/notecards
|
||||
if [ ! -e ${NOTECARDSDIR} ]; then
|
||||
NOTECARDSDIR=$(cd ${MEDLEYDIR}/../ && pwd)/notecards
|
||||
if [ ! -e ${NOTECARDSDIR} ]; then
|
||||
NOTECARDSDIR=$(cd ${MEDLEYDIR}/../../ && pwd)/notecards
|
||||
if [ ! -e ${NOTECARDSDIR} ]; then
|
||||
NOTECARDSDIR=""
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "${SYSOUTDIR}" ]; then
|
||||
export SYSOUTDIR=${MEDLEYDIR}/tmp
|
||||
fi
|
||||
|
||||
if [ -z "${FULLSYSOUTPATH}" ]; then
|
||||
FULLSYSOUTPATH=${SYSOUTDIR}/full.sysout
|
||||
if [ ! -e ${FULLSYSOUTPATH} ]; then
|
||||
FULLSYSOUTPATH=${MEDLEYDIR}/loadups/full.sysout
|
||||
fi
|
||||
fi
|
||||
|
||||
cd ${MEDLEYDIR}
|
||||
|
||||
scr="-sc 1024x768 -g 1042x790"
|
||||
|
||||
mkdir -p ${SYSOUTDIR}
|
||||
touch ${SYSOUTDIR}/loadup.timestamp
|
||||
|
||||
./run-medley $scr -loadup "${MEDLEYDIR}/sources/LOADUP-APPS.CM" "${FULLSYSOUTPATH}"
|
||||
|
||||
if [ ${SYSOUTDIR}/apps.sysout -nt ${SYSOUTDIR}/loadup.timestamp ]; then
|
||||
echo ---- made ----
|
||||
ls -l ${SYSOUTDIR}/apps.*
|
||||
echo --------------
|
||||
else
|
||||
echo XXXXX FAILURE XXXXX
|
||||
ls -l ${SYSOUTDIR}/apps.*
|
||||
exit 1
|
||||
fi
|
||||
|
||||
116
scripts/medley/medley.sh
Executable file
116
scripts/medley/medley.sh
Executable file
@@ -0,0 +1,116 @@
|
||||
#!/bin/bash
|
||||
###############################################################################
|
||||
#
|
||||
# medley.sh - script for running Medley Interlisp on Linux/WSL.
|
||||
# On Linux and WSL when using X Windows it just sets
|
||||
# up directories and environment variables and then calls
|
||||
# run-medley. On WSL, there is an option to run without
|
||||
# or around X Windows by using the XVnc and a VNC viewer
|
||||
# on the Windows side. This script will start this VNC viewer
|
||||
# on the Windows side.
|
||||
#
|
||||
# 2023-01-12 Frank Halasz
|
||||
#
|
||||
# Copyright 2023 Interlisp.org
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
#set -x
|
||||
|
||||
# functions to discover what directory this script is being executed from
|
||||
get_abs_filename() {
|
||||
# $1 : relative filename
|
||||
echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
|
||||
}
|
||||
get_script_dir() {
|
||||
|
||||
# call this with ${BASH_SOURCE[0]:-$0} as its (only) parameter
|
||||
|
||||
# set -x
|
||||
|
||||
local SCRIPT_PATH="$( get_abs_filename "$1" )";
|
||||
|
||||
pushd . > '/dev/null';
|
||||
|
||||
while [ -h "$SCRIPT_PATH" ];
|
||||
do
|
||||
cd "$( dirname -- "$SCRIPT_PATH"; )";
|
||||
SCRIPT_PATH="$( readlink -f -- "$SCRIPT_PATH"; )";
|
||||
done
|
||||
|
||||
cd "$( dirname -- "$SCRIPT_PATH"; )" > '/dev/null';
|
||||
SCRIPT_PATH="$( pwd; )";
|
||||
|
||||
popd > '/dev/null';
|
||||
|
||||
# set +x
|
||||
|
||||
echo "${SCRIPT_PATH}"
|
||||
}
|
||||
|
||||
SCRIPTDIR=$(get_script_dir "${BASH_SOURCE[0]:-$0}")
|
||||
# Define some generally useful functions
|
||||
source ${SCRIPTDIR}/medley_utils.sh
|
||||
|
||||
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 ];
|
||||
then
|
||||
wsl='true'
|
||||
else
|
||||
wsl='false'
|
||||
fi
|
||||
|
||||
# process args
|
||||
source ${SCRIPTDIR}/medley_args.sh
|
||||
|
||||
# Make sure that there is not another instance currently running with this same id
|
||||
ps ax | grep ldex | grep --quiet "\-id ${run_id}"
|
||||
if [ $? -eq 0 ];
|
||||
then
|
||||
echo "Another instance of Medley Interlisp is already running with the id \"${run_id}\"."
|
||||
echo "Only a single instance with a given id can be run at the same time."
|
||||
echo "Please retry using the \"--id <name>\" argument to give this new instance a different id."
|
||||
echo "Exiting"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
# Set the LDEDESTSYSOUT env variable based on id
|
||||
if [ -z ${LDEDESTSYSOUT} ];
|
||||
then
|
||||
if [ "${run_id}" = "default" ];
|
||||
then
|
||||
export LDEDESTSYSOUT=${LOGINDIR}/vmem/lisp.virtualmem
|
||||
else
|
||||
export LDEDESTSYSOUT=${LOGINDIR}/vmem/lisp_${run_id}.virtualmem
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create LOGINDIR if necessary
|
||||
if [ ! -e ${LOGINDIR} ];
|
||||
then
|
||||
mkdir -p ${LOGINDIR}
|
||||
elif [ ! -d ${LOGINDIR} ];
|
||||
then
|
||||
echo "ERROR: Medley requires a directory named ${LOGINDIR}."
|
||||
echo "But ${LOGINDIR} exists appears not be a directory."
|
||||
echo "Exiting"
|
||||
exit 2
|
||||
fi
|
||||
mkdir -p ${LOGINDIR}/vmem
|
||||
|
||||
# Call run-medley with or without vnc
|
||||
if [[ ${wsl} = false || ${use_vnc} = false ]];
|
||||
then
|
||||
# If not using vnc, just call run-medley
|
||||
${MEDLEYDIR}/run-medley -id "${run_id}" ${geometry} ${screensize} "${run_args[@]}"
|
||||
else
|
||||
# do the vnc thing on wsl
|
||||
source ${SCRIPTDIR}/medley_vnc.sh
|
||||
fi
|
||||
|
||||
|
||||
204
scripts/medley/medley_args.sh
Normal file
204
scripts/medley/medley_args.sh
Normal file
@@ -0,0 +1,204 @@
|
||||
###############################################################################
|
||||
#
|
||||
# medley_args.sh - script for processing the args to medley.sh script.
|
||||
#
|
||||
# !!!! This script is meant to be SOURCEd from the scripts/medley.sh script.
|
||||
# !!!! It should not be run as a standlone script.
|
||||
#
|
||||
# 2023-01-12 Frank Halasz
|
||||
#
|
||||
# Copyright 2023 Interlisp.org
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
# load usage function
|
||||
source ${SCRIPTDIR}/medley_usage.sh
|
||||
|
||||
# Process args
|
||||
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'
|
||||
|
||||
while [ "$#" -ne 0 ];
|
||||
do
|
||||
if [ ${pass_args} = false ];
|
||||
then
|
||||
case "$1" in
|
||||
-i | --id)
|
||||
if [ "$2" = "-" ];
|
||||
then
|
||||
run_id=$( basename ${MEDLEYDIR} )
|
||||
elif [ "$2" = "--" ];
|
||||
then
|
||||
run_id=$(cd ${MEDLEYDIR}; cd ..; basename $(pwd))
|
||||
else
|
||||
check_for_dash_or_end "$1" "$2"
|
||||
run_id=$(echo "$2" | sed s/[^A-Za-z0-9]//g)
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
-v | --vnc)
|
||||
if [[ ${wsl} = true && $(uname -m) = x86_64 ]];
|
||||
then
|
||||
use_vnc=true
|
||||
else
|
||||
echo "Warning: The -v or --vnc flag was set."
|
||||
echo "But the vnc option is only available when running on "
|
||||
echo "Windows System for Linux (wsl) on x86_64 machines."
|
||||
echo "Ignoring the -v or --vnc flag."
|
||||
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
|
||||
check_dir_writeable_or_creatable "$1" "${MEDLEYDIR}/logindir"
|
||||
LOGINDIR="${MEDLEYDIR}/logindir"
|
||||
else
|
||||
check_for_dash_or_end "$1" "$2"
|
||||
check_dir_writeable_or_creatable "$1" "$2"
|
||||
LOGINDIR="$2"
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
-h | --help)
|
||||
usage
|
||||
;;
|
||||
-z | --man)
|
||||
/usr/bin/man -l "${MEDLEYDIR}/docs/man-page/medley.1.gz"
|
||||
exit 0
|
||||
;;
|
||||
--)
|
||||
pass_args=true
|
||||
;;
|
||||
-*)
|
||||
err_msg=("ERROR: Unknown flag: $1" )
|
||||
usage "${err_msg[@]}"
|
||||
;;
|
||||
*)
|
||||
if [[ $# -eq 1 || "$2" = "--" ]];
|
||||
then
|
||||
sysout_flag=true
|
||||
sysout_arg="$2"
|
||||
else
|
||||
err_msg=(
|
||||
"ERROR: sysout argument must be last argument"
|
||||
"or last argument before the \"--\" flag"
|
||||
)
|
||||
usage "${err_msg[@]}"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
else
|
||||
run_args+=("$1")
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
# Figure out screensize and geometry based on arguments
|
||||
source ${SCRIPTDIR}/medley_geometry.sh
|
||||
|
||||
# Figure out the sysout situation
|
||||
ctr=0
|
||||
for x in ${lisp_flag} ${full_flag} ${apps_flag} ${sysout_flag};
|
||||
do
|
||||
if [ "${x}" = "true" ];
|
||||
then
|
||||
(( ctr++ ))
|
||||
fi
|
||||
done
|
||||
if [ ${ctr} -gt 1 ];
|
||||
then
|
||||
err_msg=(
|
||||
"Error: only one sysout can be specified. Two or more sysouts were specified"
|
||||
"via the -l (--lisp), -f (--full), -a (--apps) flags and/or a sysout filename"
|
||||
)
|
||||
usage "${err_msg[@]}"
|
||||
fi
|
||||
if [ "${sysout_arg}" = "apps" ];
|
||||
then
|
||||
export LDESRCESYSOUT="$MEDLEYDIR/loadups/apps.sysout"
|
||||
if [ "${greet_specified}" = "false" ];
|
||||
then
|
||||
export LDEINIT="$MEDLEYDIR/greetfiles/APPS-INIT.LCOM"
|
||||
fi
|
||||
else
|
||||
# pass on to run-medley
|
||||
export LDESRCESYSOUT=""
|
||||
run_args+=("${sysout_arg}")
|
||||
fi
|
||||
|
||||
|
||||
79
scripts/medley/medley_geometry.sh
Executable file
79
scripts/medley/medley_geometry.sh
Executable file
@@ -0,0 +1,79 @@
|
||||
###############################################################################
|
||||
#
|
||||
# medley_geometry.sh - script for computing the geometry and screensize
|
||||
# parameters for a medley session
|
||||
#
|
||||
# !!!! This script is meant to be SOURCEd from the scripts/medley.sh script.
|
||||
# !!!! It should not be run as a standlone script.
|
||||
#
|
||||
# 2023-01-17 Frank Halasz
|
||||
#
|
||||
# Copyright 2023 Interlisp.org
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
if [ ${noscroll} = false ];
|
||||
then
|
||||
scroll=22
|
||||
else
|
||||
scroll=0
|
||||
fi
|
||||
if [[ -n ${geometry} && -n ${screensize} ]];
|
||||
then
|
||||
gw=$(expr "${geometry}" : "\([0-9]*\)x[0-9]*$")
|
||||
gh=$(expr "${geometry}" : "[0-9]*x\([0-9]*\)$")
|
||||
if [[ -z "${gw}" || -z "${gh}" ]];
|
||||
then
|
||||
echo "Error: Improperly formed -geometry or -dimension argument: ${geometry}"
|
||||
echo "Exiting"
|
||||
exit 7
|
||||
fi
|
||||
geometry="-g ${geometry}"
|
||||
#
|
||||
sw=$(expr "${screensize}" : "\([0-9]*\)x[0-9]*$")
|
||||
sh=$(expr "${screensize}" : "[0-9]*x\([0-9]*\)$")
|
||||
if [[ -z "${sw}" || -z "${sh}" ]];
|
||||
then
|
||||
echo "Error: Improperly formed -screensize argument: ${screensize}"
|
||||
echo "Exiting"
|
||||
exit 7
|
||||
fi
|
||||
screensize="-sc ${screensize}"
|
||||
elif [[ -n ${geometry} ]];
|
||||
then
|
||||
gw=$(expr "${geometry}" : "\([0-9]*\)x[0-9]*$")
|
||||
gh=$(expr "${geometry}" : "[0-9]*x\([0-9]*\)$")
|
||||
if [ -n "${gw}" -a -n "${gh}" ] ; then
|
||||
sw=$(( ((31+${gw})/32*32) - ${scroll} ))
|
||||
sh=$(( ${gh} - ${scroll} ))
|
||||
geometry="-g ${gw}x${gh}"
|
||||
screensize="-sc ${sw}x${sh}"
|
||||
else
|
||||
echo "Error: Improperly formed -geometry or -dimension argument: ${geometry}"
|
||||
echo "Exiting"
|
||||
exit 7
|
||||
fi
|
||||
elif [[ -n ${screensize} ]];
|
||||
then
|
||||
sw=$(expr "${screensize}" : "\([0-9]*\)x[0-9]*$")
|
||||
sh=$(expr "${screensize}" : "[0-9]*x\([0-9]*\)$")
|
||||
if [ -n "${sw}" -a -n "${sh}" ] ; then
|
||||
sw=$(( (31+$sw)/32*32 ))
|
||||
gw=$(( ${scroll}+${sw} ))
|
||||
gh=$(( ${scroll}+${sh} ))
|
||||
geometry="-g ${gw}x${gh}"
|
||||
screensize="-sc ${sw}x${sh}"
|
||||
else
|
||||
echo "Error: Improperly formed -screensize argument: ${screensize}"
|
||||
echo "Exiting"
|
||||
exit 7
|
||||
fi
|
||||
else
|
||||
screensize="-sc 1440x900"
|
||||
if [ ${noscroll} = false ];
|
||||
then
|
||||
geometry="-g 1462x922"
|
||||
else
|
||||
geometry="-g 1440x900"
|
||||
fi
|
||||
fi
|
||||
93
scripts/medley/medley_usage.sh
Normal file
93
scripts/medley/medley_usage.sh
Normal file
@@ -0,0 +1,93 @@
|
||||
###############################################################################
|
||||
#
|
||||
# medley_useage.sh - script defining the "usage" for medley.sh script.
|
||||
#
|
||||
# !!!! This script is meant to be SOURCEd from the scripts/medley.sh script.
|
||||
# !!!! It should not be run as a standlone script.
|
||||
#
|
||||
# 2023-01-21 Frank Halasz
|
||||
#
|
||||
# Copyright 2023 Interlisp.org
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
PAGER=$( if [ -n $(which more) ]; then echo "more"; else echo "cat"; fi)
|
||||
|
||||
usage() {
|
||||
local err_msg
|
||||
local msg_path=/tmp/msg-$$
|
||||
local lines=("$@")
|
||||
if [ $# -ne 0 ];
|
||||
then
|
||||
echo > ${msg_path}
|
||||
echo "$(output_error_msg "${lines[@]}")" >> ${msg_path}
|
||||
echo >> ${msg_path}
|
||||
echo >> ${msg_path}
|
||||
else
|
||||
touch ${msg_path}
|
||||
fi
|
||||
cat ${msg_path} - <<EOF | ${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
|
||||
after all symbolic links have been resolved. For standard installations this will be
|
||||
/usr/local/interlisp/medley. For "local" installations this will be the "medley" sub-directory
|
||||
under the directory into which the Medley distribution was installed.
|
||||
|
||||
flags:
|
||||
-h | --help : print this usage information
|
||||
|
||||
-z | --man : show the man page for medley
|
||||
|
||||
-f | --full : start Medley from the "full" sysout
|
||||
|
||||
-l | --lisp : start Medley from the "lisp" sysout
|
||||
|
||||
-a | --apps : start Medley from the "apps" sysout
|
||||
|
||||
-e | --interlisp : (for apps.sysout only) Start in the Interlisp exec
|
||||
|
||||
-n | --noscroll : do not use scroll bars in Medley window
|
||||
|
||||
-g WxH | --geometry WxH : set the window geometry to Width x Height.
|
||||
|
||||
-s WxH | --screensize WxH : set the Medley screen size to be Width x Height
|
||||
|
||||
-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
|
||||
|
||||
-i STRING | --id STRING : use STRING as the id for this run of Medley (default: default)
|
||||
|
||||
-i - | --id - : for id use the basename of MEDLEYDIR
|
||||
|
||||
-i -- | --id -- : for id use the basename of the parent directory of MEDLEYDIR
|
||||
|
||||
-m N | --mem N : set Medley memory size to N
|
||||
|
||||
-p FILE | --vmem FILE : use FILE as the Medley virtual memory store
|
||||
|
||||
-r FILE | --greet FILE : use FILE as the Medley greetfile
|
||||
|
||||
-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
|
||||
|
||||
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.
|
||||
|
||||
pass_args:
|
||||
All arguments after the "--" flag, are passed unaltered to lde via run-medley.
|
||||
|
||||
EOF
|
||||
|
||||
exit 1
|
||||
|
||||
}
|
||||
|
||||
133
scripts/medley/medley_utils.sh
Normal file
133
scripts/medley/medley_utils.sh
Normal file
@@ -0,0 +1,133 @@
|
||||
###############################################################################
|
||||
#
|
||||
# medley_utils.sh - script containing various useful functions for medley.sh script.
|
||||
#
|
||||
# !!!! This script is meant to be SOURCEd from the scripts/medley.sh script.
|
||||
# !!!! It should not be run as a standlone script.
|
||||
#
|
||||
# 2023-01-23 Frank Halasz
|
||||
#
|
||||
# Copyright 2023 Interlisp.org
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
is_tput=$(which tput)
|
||||
output_error_msg() {
|
||||
local lines=("$@")
|
||||
for line in "${lines[@]}"
|
||||
do
|
||||
if [ -n "${is_tput}" ];
|
||||
then
|
||||
echo "$(${is_tput} setab 1)$(${is_tput} setaf 7)${line}$(${is_tput} sgr0)"
|
||||
else
|
||||
echo "${line}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
check_for_dash_or_end() {
|
||||
local err_msg;
|
||||
if [[ -z "$2" || "$2" = "--" ]];
|
||||
then
|
||||
err_msg=(
|
||||
"Error: the flag \"$1\" requires a value."
|
||||
"Value is missing."
|
||||
)
|
||||
usage "${err_msg[@]}"
|
||||
elif [ "${2:0:1}" = "-" ];
|
||||
then
|
||||
err_msg=(
|
||||
"Error: either the value for flag \"${1}\" is missing OR"
|
||||
"the value begins with a \"-\", which is not allowed."
|
||||
)
|
||||
usage "${err_msg[@]}"
|
||||
fi
|
||||
}
|
||||
|
||||
check_file_writeable_or_creatable() {
|
||||
local msg_core="\"$2\" given as the value of the \"$1\" flag"
|
||||
local err_msg;
|
||||
if [[ -e "$%2" ]];
|
||||
then
|
||||
if [[ ! -f "$2" ]];
|
||||
then
|
||||
err_msg=(
|
||||
"Error: File ${msg_core} is not a regular file."
|
||||
"It is either a directory or a device file of some sort."
|
||||
"Exiting"
|
||||
)
|
||||
output_error_msg "${err_msg[@]}"
|
||||
exit 1
|
||||
elif [[ ! -w "$2" ]];
|
||||
then
|
||||
err_msg=(
|
||||
"Error: File ${msg_core} exists but is not writeable"
|
||||
"Exiting"
|
||||
)
|
||||
output_error_msg "${err_msg[@]}"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
if [[ ! -w "$(dirname -- $2)" ]];
|
||||
then
|
||||
err_msg=(
|
||||
"Error: File ${msg_core} cannot be created because"
|
||||
"its directory either doen't exist or is not writeable."
|
||||
"Exiting"
|
||||
)
|
||||
output_error_msg "${err_msg[@]}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
check_file_readable() {
|
||||
local msg_core="\"$2\" given as the value of the \"$1\" flag"
|
||||
if [[ ! -r "$2" ]];
|
||||
then
|
||||
err_msg=(
|
||||
"Error: File ${msg_core}"
|
||||
"either doesn't exist or is not readable."
|
||||
"Exiting"
|
||||
)
|
||||
output_error_msg "${err_msg[@]}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_dir_writeable_or_creatable() {
|
||||
local msg_core="\"$2\" given as the value of the \"$1\" flag"
|
||||
if [[ -e "$%2" ]];
|
||||
then
|
||||
if [[ ! -d "$2" ]];
|
||||
then
|
||||
err_msg=(
|
||||
"Error: Pathname ${msg_core} exists but is not a directory."
|
||||
"Exiting"
|
||||
)
|
||||
output_error_msg "${err_msg[@]}"
|
||||
exit 1
|
||||
elif [[ ! -w "$2" ]];
|
||||
then
|
||||
err_msg=(
|
||||
"Error: Directory ${msg_core} exists but is not writeable."
|
||||
"Exiting"
|
||||
)
|
||||
output_error_msg "${err_msg[@]}"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
if [[ ! -w "$(dirname -- $2)" ]];
|
||||
then
|
||||
err_msg=(
|
||||
"Error: Directory ${msg_core} cannot be created because"
|
||||
"its parent directory either doesn't exist or is not writeable."
|
||||
"Exiting"
|
||||
)
|
||||
output_error_msg "${err_msg[@]}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
154
scripts/medley/medley_vnc.sh
Executable file
154
scripts/medley/medley_vnc.sh
Executable file
@@ -0,0 +1,154 @@
|
||||
###############################################################################
|
||||
#
|
||||
# medley_vnc.sh - script for running Medley Interlisp on WSL using Xvnc
|
||||
# on the Linux side and a vncviewer on the Windows side.
|
||||
# This script run under Linux will start the right apps
|
||||
# on both the Linux and Windows sides.
|
||||
#
|
||||
# !!!! This script is meant to be SOURCEd from the scripts/medley.sh script.
|
||||
# !!!! It should not be run as a standlone script.
|
||||
#
|
||||
# 2023-01-12 Frank Halasz
|
||||
#
|
||||
# Copyright 2023 Interlisp.org
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
ip_addr() {
|
||||
ip -4 -br address show dev eth0 | awk '{print $3}' | sed 's-/.*$--'
|
||||
}
|
||||
|
||||
find_open_display() {
|
||||
local ctr=1
|
||||
local result=-1
|
||||
while [ ${ctr} -lt 64 ];
|
||||
do
|
||||
ss -a | grep -q "tmp/.X11-unix/X${ctr}[^0-9]"
|
||||
if [ $? -ne 0 ];
|
||||
then
|
||||
result=${ctr}
|
||||
break
|
||||
else
|
||||
(( ctr++ ))
|
||||
fi
|
||||
done
|
||||
echo ${result}
|
||||
}
|
||||
|
||||
find_open_port() {
|
||||
local ctr=5900
|
||||
local result=-1
|
||||
while [ ${ctr} -lt 6000 ];
|
||||
do
|
||||
ss -a | grep -q "LISTEN.*:${ctr}[^0-9]"
|
||||
if [ $? -ne 0 ];
|
||||
then
|
||||
result=${ctr}
|
||||
break
|
||||
else
|
||||
(( ctr++ ))
|
||||
fi
|
||||
done
|
||||
echo ${result}
|
||||
}
|
||||
|
||||
#
|
||||
# Make sure prequisites for vnc support 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 ]];
|
||||
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}" ];
|
||||
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' ]];
|
||||
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
|
||||
|
||||
#
|
||||
# Find an unused display, start Xvnc, run-medley, then start the vnc viewer on the windows side
|
||||
#
|
||||
#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 ];
|
||||
then
|
||||
echo "Error: cannot find an unused DISPLAY between 1 and 63"
|
||||
echo "Exiting"
|
||||
exit 33
|
||||
else
|
||||
echo "Using DISPLAY=${OPEN_DISPLAY}"
|
||||
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
|
||||
mkdir -p ${LOGINDIR}/logs
|
||||
/usr/bin/Xvnc ":${OPEN_DISPLAY}" \
|
||||
-rfbport ${VNC_PORT} \
|
||||
-geometry "${geometry#-g }" \
|
||||
-SecurityTypes None \
|
||||
-NeverShared \
|
||||
-DisconnectClients=0 \
|
||||
>> ${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
|
||||
Reference in New Issue
Block a user