Restore REM.CM to be separate file from greet file; Enable chaining of medley runs using REM.CM file (#2027)
- Fixed INTERPRET.REM.CM so that it no longer tries to load the file pointed to by LDEINIT and instead loads the file pointed to by LDEREMCM. LDEINIT remains the file used by greet. - Adjusted the medley script to have a new argument -cm (or --rem.cm) which sets LDEREMCM as appropriate before launching lde. - Updated the loadup scripts as required to use this new -cm argument when calling medley. Finally, added a new feature to the medley script -cc (or --repeat) whereby which when medley finishes it checks for a nonzero file given as the argument to -cc. If that file exists, medley is run again (i.e., repeated) with LDEREMCM set to that file. This repeats until this file no longer exists or is zero-length. The file can be found as the vale of LDEREPEATCM so that each invocation of medley can modify (or delete) this file so as to change the subsequent run of medley.
This commit is contained in:
@@ -32,10 +32,11 @@ main() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git_commit_ID "${NOTECARDSDIR}"
|
||||
NOTECARDS_COMMIT_ID="${COMMIT_ID}"
|
||||
export NOTECARDS_COMMIT_ID
|
||||
git_commit_ID "${NOTECARDSDIR}"
|
||||
NOTECARDS_COMMIT_ID="${COMMIT_ID}"
|
||||
export NOTECARDS_COMMIT_ID
|
||||
|
||||
initfile="-"
|
||||
cat >"${cmfile}" <<-"EOF"
|
||||
"
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ main() {
|
||||
|
||||
loadup_start
|
||||
|
||||
initfile="-"
|
||||
cat >"${cmfile}" <<-"EOF"
|
||||
"
|
||||
(PROG
|
||||
|
||||
@@ -13,6 +13,7 @@ main() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
initfile="-"
|
||||
cat >"${cmfile}" <<-"EOF"
|
||||
"
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ main() {
|
||||
|
||||
loadup_start
|
||||
|
||||
initfile="-"
|
||||
cat >"${cmfile}" <<-"EOF"
|
||||
"
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@ main() {
|
||||
|
||||
loadup_start
|
||||
|
||||
cat >"${cmfile}" <<-"EOF"
|
||||
cmfile="-"
|
||||
cat >"${initfile}" <<-"EOF"
|
||||
(* "make init files; this file is loaded as a 'greet' file by scripts/loadup-init.sh")
|
||||
|
||||
(SETQ MEDLEYDIR NIL)
|
||||
@@ -40,7 +41,7 @@ main() {
|
||||
(LOGOUT T)
|
||||
STOP
|
||||
EOF
|
||||
|
||||
|
||||
run_medley "${LOADUP_SOURCEDIR}/starter.sysout"
|
||||
|
||||
loadup_finish "init.dlinit" "init.*" "RDSYS*" "I-NEW*"
|
||||
|
||||
@@ -5,7 +5,8 @@ main() {
|
||||
. "${LOADUP_SCRIPTDIR}/loadup-setup.sh"
|
||||
|
||||
loadup_start
|
||||
|
||||
|
||||
initfile="-"
|
||||
cat >"${cmfile}" <<-"EOF"
|
||||
"
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ main() {
|
||||
|
||||
loadup_start
|
||||
|
||||
initfile="-"
|
||||
cat >"${cmfile}" <<-"EOF"
|
||||
"
|
||||
(MOVD? (QUOTE NILL) (QUOTE PROMPTPRINT))
|
||||
|
||||
@@ -72,6 +72,7 @@ touch "${LOADUP_WORKDIR}"/loadup.timestamp
|
||||
|
||||
script_name=$(basename "$0" ".sh")
|
||||
cmfile="${LOADUP_WORKDIR}/${script_name}.cm"
|
||||
initfile="${LOADUP_WORKDIR}/${script_name}.init"
|
||||
|
||||
# look thru args looking to see if oldschool was specified in args
|
||||
j=1
|
||||
@@ -153,13 +154,14 @@ loadup_finish () {
|
||||
run_medley () {
|
||||
if [ ! "${LOADUP_OLDSCHOOL}" = true ]
|
||||
then
|
||||
/bin/sh "${MEDLEYDIR}/scripts/medley/medley.command" \
|
||||
/bin/sh "${MEDLEYDIR}/scripts/medley/medley.command" \
|
||||
--config - \
|
||||
--id loadup_+ \
|
||||
--geometry "${geometry}" \
|
||||
--noscroll \
|
||||
--logindir "${LOADUP_LOGINDIR}" \
|
||||
--greet "${cmfile}" \
|
||||
--rem.cm "${cmfile}" \
|
||||
--greet "${initfile}" \
|
||||
--sysout "$1" \
|
||||
"$2" "$3" "$4" "$5" "$6" "$7" ;
|
||||
exit_code=$?
|
||||
|
||||
@@ -586,6 +586,13 @@ flags:
|
||||
|
||||
-x - | --logindir - : use MEDLEYDIR/logindir as LOGINDIR in Medley
|
||||
|
||||
-cm FILE | --rem.cm FILE : use FILE as the REM.CM when starting up Medley. FILE must be absolute pathname.
|
||||
|
||||
-cm - | --rem.cm - : do not use an REM.CM. Negate any prior setting, e.g., from config file.
|
||||
|
||||
-cc FILE | --repeat FILE : as long as FILE exists and is greater than 0 length, repeat Medley run
|
||||
using FILE as REM.CM
|
||||
|
||||
sysout:
|
||||
The pathname 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
|
||||
@@ -629,7 +636,8 @@ nh_mac_arg=""
|
||||
nh_debug_arg=""
|
||||
pixelscale_arg=""
|
||||
borderwidth_arg=""
|
||||
|
||||
remcm_arg="${LDEREMCM}"
|
||||
repeat_cm=""
|
||||
|
||||
# Add marker at end of args so we can accumulate pass-on args in args array
|
||||
set -- "$@" "--start_of_pass_args"
|
||||
@@ -648,6 +656,28 @@ do
|
||||
# already handled so just skip both flag and value
|
||||
shift;
|
||||
;;
|
||||
-cm | --rem.cm | --remcm)
|
||||
if [ "$2" = "-" ] || [ "$2" = "--" ]
|
||||
then
|
||||
remcm_arg=""
|
||||
else
|
||||
check_for_dash_or_end "$1" "$2"
|
||||
check_file_readable "$1" "$2"
|
||||
remcm_arg="$2"
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
-cc | --repeat.cm | --repeat)
|
||||
if [ "$2" = "-" ] || [ "$2" = "--" ]
|
||||
then
|
||||
repeat_cm=""
|
||||
else
|
||||
check_for_dash_or_end "$1" "$2"
|
||||
# check_file_readable "$1" "$2"
|
||||
repeat_cm="$2"
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
-d | --display)
|
||||
if [ "$2" = "-" ]
|
||||
then
|
||||
@@ -1219,6 +1249,10 @@ else
|
||||
fi
|
||||
export LDEINIT
|
||||
|
||||
# figure out rem.cm and repeat.cm situation
|
||||
export LDEREMCM="${remcm_arg}"
|
||||
export LDEREPEATCM="${repeat_cm}"
|
||||
|
||||
# figure out noscroll situation
|
||||
noscroll_arg=""
|
||||
if [ "${noscroll}" = true ]
|
||||
@@ -1415,12 +1449,24 @@ then
|
||||
fi
|
||||
|
||||
|
||||
# Run maiko either directly or with vnc
|
||||
if [ "${use_vnc}" = true ]
|
||||
then
|
||||
# do the vnc thing - if called for
|
||||
# shellcheck source=./medley_vnc.sh
|
||||
# . "${SCRIPTDIR}/medley_vnc.sh"
|
||||
# Repeatedly run medley as long as there is a repeat_cm file called for and it exists and is not zero length
|
||||
# In most cases, there will be no repeat_cm and hence medley will only run once
|
||||
|
||||
loop_ctr=0
|
||||
while [ ${loop_ctr} -eq 0 ] || { [ -n "${repeat_cm}" ] && [ -f "${repeat_cm}" ] && [ -s "${repeat_cm}" ] ; }
|
||||
do
|
||||
if [ ${loop_ctr} -eq 1 ]
|
||||
then
|
||||
LDEREMCM="${repeat_cm}"
|
||||
fi
|
||||
loop_ctr=1
|
||||
|
||||
# Run maiko either directly or with vnc
|
||||
if [ "${use_vnc}" = true ]
|
||||
then
|
||||
# do the vnc thing - if called for
|
||||
# shellcheck source=./medley_vnc.sh
|
||||
# . "${SCRIPTDIR}/medley_vnc.sh"
|
||||
# shellcheck shell=sh
|
||||
# shellcheck disable=SC2154,SC2162
|
||||
###############################################################################
|
||||
@@ -1658,9 +1704,15 @@ then
|
||||
true
|
||||
|
||||
#######################################
|
||||
else
|
||||
# If not using vnc, just exec maiko directly
|
||||
# handing over the pass-on args which are all thats left in the main args array
|
||||
start_maiko "$@"
|
||||
fi
|
||||
else
|
||||
# If not using vnc, just exec maiko directly
|
||||
# handing over the pass-on args which are all thats left in the main args array
|
||||
start_maiko "$@"
|
||||
fi
|
||||
if [ -n "${exit_code}" ] && [ ${exit_code} -ne 0 ]
|
||||
then
|
||||
exit ${exit_code}
|
||||
fi
|
||||
|
||||
done
|
||||
exit ${exit_code}
|
||||
|
||||
@@ -46,7 +46,8 @@ nh_mac_arg=""
|
||||
nh_debug_arg=""
|
||||
pixelscale_arg=""
|
||||
borderwidth_arg=""
|
||||
|
||||
remcm_arg="${LDEREMCM}"
|
||||
repeat_cm=""
|
||||
|
||||
# Add marker at end of args so we can accumulate pass-on args in args array
|
||||
set -- "$@" "--start_of_pass_args"
|
||||
@@ -65,6 +66,28 @@ do
|
||||
# already handled so just skip both flag and value
|
||||
shift;
|
||||
;;
|
||||
-cm | --rem.cm | --remcm)
|
||||
if [ "$2" = "-" ] || [ "$2" = "--" ]
|
||||
then
|
||||
remcm_arg=""
|
||||
else
|
||||
check_for_dash_or_end "$1" "$2"
|
||||
check_file_readable "$1" "$2"
|
||||
remcm_arg="$2"
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
-cc | --repeat.cm | --repeat)
|
||||
if [ "$2" = "-" ] || [ "$2" = "--" ]
|
||||
then
|
||||
repeat_cm=""
|
||||
else
|
||||
check_for_dash_or_end "$1" "$2"
|
||||
# check_file_readable "$1" "$2"
|
||||
repeat_cm="$2"
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
-d | --display)
|
||||
if [ "$2" = "-" ]
|
||||
then
|
||||
|
||||
@@ -130,6 +130,10 @@ else
|
||||
fi
|
||||
export LDEINIT
|
||||
|
||||
# figure out rem.cm and repeat.cm situation
|
||||
export LDEREMCM="${remcm_arg}"
|
||||
export LDEREPEATCM="${repeat_cm}"
|
||||
|
||||
# figure out noscroll situation
|
||||
noscroll_arg=""
|
||||
if [ "${noscroll}" = true ]
|
||||
@@ -326,15 +330,33 @@ then
|
||||
fi
|
||||
|
||||
|
||||
# Run maiko either directly or with vnc
|
||||
if [ "${use_vnc}" = true ]
|
||||
then
|
||||
# do the vnc thing - if called for
|
||||
# shellcheck source=./medley_vnc.sh
|
||||
. "${SCRIPTDIR}/medley_vnc.sh"
|
||||
else
|
||||
# If not using vnc, just exec maiko directly
|
||||
# handing over the pass-on args which are all thats left in the main args array
|
||||
start_maiko "$@"
|
||||
fi
|
||||
# Repeatedly run medley as long as there is a repeat_cm file called for and it exists and is not zero length
|
||||
# In most cases, there will be no repeat_cm and hence medley will only run once
|
||||
|
||||
loop_ctr=0
|
||||
while [ ${loop_ctr} -eq 0 ] || { [ -n "${repeat_cm}" ] && [ -f "${repeat_cm}" ] && [ -s "${repeat_cm}" ] ; }
|
||||
do
|
||||
if [ ${loop_ctr} -eq 1 ]
|
||||
then
|
||||
LDEREMCM="${repeat_cm}"
|
||||
fi
|
||||
loop_ctr=1
|
||||
|
||||
# Run maiko either directly or with vnc
|
||||
if [ "${use_vnc}" = true ]
|
||||
then
|
||||
# do the vnc thing - if called for
|
||||
# shellcheck source=./medley_vnc.sh
|
||||
. "${SCRIPTDIR}/medley_vnc.sh"
|
||||
else
|
||||
# If not using vnc, just exec maiko directly
|
||||
# handing over the pass-on args which are all thats left in the main args array
|
||||
start_maiko "$@"
|
||||
fi
|
||||
if [ -n "${exit_code}" ] && [ ${exit_code} -ne 0 ]
|
||||
then
|
||||
exit ${exit_code}
|
||||
fi
|
||||
|
||||
done
|
||||
exit ${exit_code}
|
||||
|
||||
@@ -115,6 +115,13 @@ flags:
|
||||
|
||||
-x - | --logindir - : use MEDLEYDIR/logindir as LOGINDIR in Medley
|
||||
|
||||
-cm FILE | --rem.cm FILE : use FILE as the REM.CM when starting up Medley. FILE must be absolute pathname.
|
||||
|
||||
-cm - | --rem.cm - : do not use an REM.CM. Negate any prior setting, e.g., from config file.
|
||||
|
||||
-cc FILE | --repeat FILE : as long as FILE exists and is greater than 0 length, repeat Medley run
|
||||
using FILE as REM.CM
|
||||
|
||||
sysout:
|
||||
The pathname 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
|
||||
|
||||
Reference in New Issue
Block a user