Merge branch 'master' into fgh_fix-maikodir_msg
This commit is contained in:
@@ -1,35 +1,151 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -x run-medley ] ; then
|
||||
echo run from MEDLEYDIR
|
||||
exit 1
|
||||
main() {
|
||||
# shellcheck source=./loadup-setup.sh
|
||||
. "${LOADUP_SCRIPTDIR}/loadup-setup.sh"
|
||||
|
||||
echo ">>>>> START ${script_name}"
|
||||
|
||||
/bin/sh "${LOADUP_SCRIPTDIR}/cpv" "${LOADUP_WORKDIR}"/full.sysout "${LOADUP_OUTDIR}" \
|
||||
| sed -e "s#${MEDLEYDIR}/##g"
|
||||
/bin/sh "${LOADUP_SCRIPTDIR}/cpv" "${LOADUP_WORKDIR}"/lisp.sysout "${LOADUP_OUTDIR}" \
|
||||
| sed -e "s#${MEDLEYDIR}/##g"
|
||||
|
||||
if [ "${1}" = "-apps" ]; then
|
||||
/bin/sh "${LOADUP_SCRIPTDIR}/cpv" "${LOADUP_WORKDIR}"/apps.sysout "${LOADUP_OUTDIR}" \
|
||||
| sed -e "s#${MEDLEYDIR}/##g"
|
||||
fi
|
||||
|
||||
/bin/sh "${LOADUP_SCRIPTDIR}/cpv" "${LOADUP_WORKDIR}"/whereis.hash "${LOADUP_OUTDIR}" \
|
||||
| sed -e "s#${MEDLEYDIR}/##g"
|
||||
/bin/sh "${LOADUP_SCRIPTDIR}/cpv" "${LOADUP_WORKDIR}"/exports.all "${LOADUP_OUTDIR}" \
|
||||
| sed -e "s#${MEDLEYDIR}/##g"
|
||||
|
||||
/bin/sh "${LOADUP_SCRIPTDIR}/cpv" "${LOADUP_WORKDIR}"/init.dribble "${LOADUP_OUTDIR}" \
|
||||
| sed -e "s#${MEDLEYDIR}/##g"
|
||||
/bin/sh "${LOADUP_SCRIPTDIR}/cpv" "${LOADUP_WORKDIR}"/lisp.dribble "${LOADUP_OUTDIR}" \
|
||||
| sed -e "s#${MEDLEYDIR}/##g"
|
||||
/bin/sh "${LOADUP_SCRIPTDIR}/cpv" "${LOADUP_WORKDIR}"/full.dribble "${LOADUP_OUTDIR}" \
|
||||
| sed -e "s#${MEDLEYDIR}/##g"
|
||||
/bin/sh "${LOADUP_SCRIPTDIR}/cpv" "${LOADUP_WORKDIR}"/whereis.dribble "${LOADUP_OUTDIR}" \
|
||||
| sed -e "s#${MEDLEYDIR}/##g"
|
||||
|
||||
if [ "${1}" = "-apps" ]; then
|
||||
/bin/sh "${LOADUP_SCRIPTDIR}/cpv" "${LOADUP_WORKDIR}"/apps.dribble "${LOADUP_OUTDIR}" \
|
||||
| sed -e "s#${MEDLEYDIR}/##g"
|
||||
fi
|
||||
|
||||
|
||||
/bin/sh "${LOADUP_SCRIPTDIR}/cpv" "${LOADUP_WORKDIR}"/RDSYS library \
|
||||
| sed -e "s#${MEDLEYDIR}/##g"
|
||||
/bin/sh "${LOADUP_SCRIPTDIR}/cpv" "${LOADUP_WORKDIR}"/RDSYS.LCOM library \
|
||||
| sed -e "s#${MEDLEYDIR}/##g"
|
||||
|
||||
|
||||
echo "<<<<< END ${script_name}"
|
||||
echo ""
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
||||
|
||||
# shellcheck disable=SC2164,SC2034
|
||||
if [ -z "${LOADUP_SCRIPTDIR}" ]
|
||||
then
|
||||
#
|
||||
#
|
||||
# Some functions to determine what directory this script is being executed from
|
||||
#
|
||||
#
|
||||
get_abs_filename() {
|
||||
# $1 : relative filename
|
||||
echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
|
||||
}
|
||||
|
||||
# This function taken from
|
||||
# https://stackoverflow.com/questions/29832037/how-to-get-script-directory-in-posix-sh
|
||||
rreadlink() (
|
||||
|
||||
# Execute this function in a *subshell* to localize variables and the effect of `cd`.
|
||||
|
||||
target=$1
|
||||
fname=
|
||||
targetDir=
|
||||
CDPATH=
|
||||
|
||||
# Try to make the execution environment as predictable as possible:
|
||||
# All commands below are invoked via `command`, so we must make sure that `command`
|
||||
# itself is not redefined as an alias or shell function.
|
||||
# (Note that command is too inconsistent across shells, so we don't use it.)
|
||||
# `command` is a *builtin* in bash, dash, ksh, zsh, and some platforms do not even have
|
||||
# an external utility version of it (e.g, Ubuntu).
|
||||
# `command` bypasses aliases and shell functions and also finds builtins
|
||||
# in bash, dash, and ksh. In zsh, option POSIX_BUILTINS must be turned on for that
|
||||
# to happen.
|
||||
{ \unalias command; \unset -f command; } >/dev/null 2>&1
|
||||
[ -n "$ZSH_VERSION" ] && options[POSIX_BUILTINS]=on # make zsh find *builtins* with `command` too.
|
||||
|
||||
while :; do # Resolve potential symlinks until the ultimate target is found.
|
||||
[ -L "$target" ] || [ -e "$target" ] || { command printf '%s\n' "ERROR: '$target' does not exist." >&2; return 1; }
|
||||
command cd "$(command dirname -- "$target")" # Change to target dir; necessary for correct resolution of target path.
|
||||
fname=$(command basename -- "$target") # Extract filename.
|
||||
[ "$fname" = '/' ] && fname='' # !! curiously, `basename /` returns '/'
|
||||
if [ -L "$fname" ]; then
|
||||
# Extract [next] target path, which may be defined
|
||||
# *relative* to the symlink's own directory.
|
||||
# Note: We parse `ls -l` output to find the symlink target
|
||||
# which is the only POSIX-compliant, albeit somewhat fragile, way.
|
||||
target=$(command ls -l "$fname")
|
||||
target=${target#* -> }
|
||||
continue # Resolve [next] symlink target.
|
||||
fi
|
||||
break # Ultimate target reached.
|
||||
done
|
||||
targetDir=$(command pwd -P) # Get canonical dir. path
|
||||
# Output the ultimate target's canonical path.
|
||||
# Note that we manually resolve paths ending in /. and /.. to make sure we have a normalized path.
|
||||
if [ "$fname" = '.' ]; then
|
||||
command printf '%s\n' "${targetDir%/}"
|
||||
elif [ "$fname" = '..' ]; then
|
||||
# Caveat: something like /var/.. will resolve to /private (assuming /var@ -> /private/var), i.e. the '..' is applied
|
||||
# AFTER canonicalization.
|
||||
command printf '%s\n' "$(command dirname -- "${targetDir}")"
|
||||
else
|
||||
command printf '%s\n' "${targetDir%/}/$fname"
|
||||
fi
|
||||
)
|
||||
|
||||
get_script_dir() {
|
||||
|
||||
# call this with $0 (from main script) as its (only) parameter
|
||||
# if you need to preserve cwd, run this is a subshell since
|
||||
# it can change cwd
|
||||
|
||||
# set -x
|
||||
|
||||
local_SCRIPT_PATH="$( get_abs_filename "$1" )";
|
||||
|
||||
while [ -h "$local_SCRIPT_PATH" ];
|
||||
do
|
||||
cd "$( dirname -- "$local_SCRIPT_PATH"; )";
|
||||
local_SCRIPT_PATH="$( rreadlink "$local_SCRIPT_PATH" )";
|
||||
done
|
||||
|
||||
cd "$( dirname -- "$local_SCRIPT_PATH"; )" > '/dev/null';
|
||||
local_SCRIPT_PATH="$( pwd; )";
|
||||
|
||||
# set +x
|
||||
|
||||
echo "${local_SCRIPT_PATH}"
|
||||
}
|
||||
|
||||
# end of script directory functions
|
||||
###############################################################################
|
||||
|
||||
# figure out the script dir
|
||||
LOADUP_SCRIPTDIR="$(get_script_dir "$0")"
|
||||
export LOADUP_SCRIPTDIR
|
||||
|
||||
fi
|
||||
|
||||
. scripts/loadup-setup.sh
|
||||
|
||||
echo ">>>>> START ${script_name}"
|
||||
|
||||
./scripts/cpv "${LOADUP_WORKDIR}"/full.sysout "${LOADUP_OUTDIR}" | sed -e "s#${MEDLEYDIR}/##g"
|
||||
./scripts/cpv "${LOADUP_WORKDIR}"/lisp.sysout "${LOADUP_OUTDIR}" | sed -e "s#${MEDLEYDIR}/##g"
|
||||
if [ "${1}" = "-apps" ]; then
|
||||
./scripts/cpv "${LOADUP_WORKDIR}"/apps.sysout "${LOADUP_OUTDIR}" | sed -e "s#${MEDLEYDIR}/##g"
|
||||
fi
|
||||
|
||||
./scripts/cpv "${LOADUP_WORKDIR}"/whereis.hash "${LOADUP_OUTDIR}" | sed -e "s#${MEDLEYDIR}/##g"
|
||||
./scripts/cpv "${LOADUP_WORKDIR}"/exports.all "${LOADUP_OUTDIR}" | sed -e "s#${MEDLEYDIR}/##g"
|
||||
|
||||
./scripts/cpv "${LOADUP_WORKDIR}"/init.dribble "${LOADUP_OUTDIR}" | sed -e "s#${MEDLEYDIR}/##g"
|
||||
./scripts/cpv "${LOADUP_WORKDIR}"/lisp.dribble "${LOADUP_OUTDIR}" | sed -e "s#${MEDLEYDIR}/##g"
|
||||
./scripts/cpv "${LOADUP_WORKDIR}"/full.dribble "${LOADUP_OUTDIR}" | sed -e "s#${MEDLEYDIR}/##g"
|
||||
./scripts/cpv "${LOADUP_WORKDIR}"/whereis.dribble "${LOADUP_OUTDIR}" | sed -e "s#${MEDLEYDIR}/##g"
|
||||
if [ "${1}" = "-apps" ]; then
|
||||
./scripts/cpv "${LOADUP_WORKDIR}"/apps.dribble "${LOADUP_OUTDIR}" | sed -e "s#${MEDLEYDIR}/##g"
|
||||
fi
|
||||
|
||||
|
||||
./scripts/cpv "${LOADUP_WORKDIR}"/RDSYS library | sed -e "s#${MEDLEYDIR}/##g"
|
||||
./scripts/cpv "${LOADUP_WORKDIR}"/RDSYS.LCOM library | sed -e "s#${MEDLEYDIR}/##g"
|
||||
|
||||
echo "<<<<< END ${script_name}"
|
||||
echo ""
|
||||
exit 0
|
||||
main "$@"
|
||||
|
||||
@@ -1,17 +1,118 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -x run-medley ] ; then
|
||||
echo run from MEDLEYDIR
|
||||
exit 1
|
||||
main() {
|
||||
|
||||
# shellcheck source=./loadup-setup.sh
|
||||
. "${LOADUP_SCRIPTDIR}/loadup-setup.sh"
|
||||
|
||||
echo ">>>>> START ${script_name}"
|
||||
|
||||
/bin/sh "${LOADUP_SCRIPTDIR}/cpv" "${LOADUP_WORKDIR}"/fuller.database "${LOADUP_OUTDIR}"
|
||||
/bin/sh "${LOADUP_SCRIPTDIR}/cpv" "${LOADUP_WORKDIR}"/fuller.dribble "${LOADUP_OUTDIR}"
|
||||
|
||||
echo "<<<<< END ${script_name}"
|
||||
echo ""
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
||||
# shellcheck disable=SC2164,SC2034
|
||||
if [ -z "${LOADUP_SCRIPTDIR}" ]
|
||||
then
|
||||
#
|
||||
#
|
||||
# Some functions to determine what directory this script is being executed from
|
||||
#
|
||||
#
|
||||
get_abs_filename() {
|
||||
# $1 : relative filename
|
||||
echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
|
||||
}
|
||||
|
||||
# This function taken from
|
||||
# https://stackoverflow.com/questions/29832037/how-to-get-script-directory-in-posix-sh
|
||||
rreadlink() (
|
||||
|
||||
# Execute this function in a *subshell* to localize variables and the effect of `cd`.
|
||||
|
||||
target=$1
|
||||
fname=
|
||||
targetDir=
|
||||
CDPATH=
|
||||
|
||||
# Try to make the execution environment as predictable as possible:
|
||||
# All commands below are invoked via `command`, so we must make sure that `command`
|
||||
# itself is not redefined as an alias or shell function.
|
||||
# (Note that command is too inconsistent across shells, so we don't use it.)
|
||||
# `command` is a *builtin* in bash, dash, ksh, zsh, and some platforms do not even have
|
||||
# an external utility version of it (e.g, Ubuntu).
|
||||
# `command` bypasses aliases and shell functions and also finds builtins
|
||||
# in bash, dash, and ksh. In zsh, option POSIX_BUILTINS must be turned on for that
|
||||
# to happen.
|
||||
{ \unalias command; \unset -f command; } >/dev/null 2>&1
|
||||
[ -n "$ZSH_VERSION" ] && options[POSIX_BUILTINS]=on # make zsh find *builtins* with `command` too.
|
||||
|
||||
while :; do # Resolve potential symlinks until the ultimate target is found.
|
||||
[ -L "$target" ] || [ -e "$target" ] || { command printf '%s\n' "ERROR: '$target' does not exist." >&2; return 1; }
|
||||
command cd "$(command dirname -- "$target")" # Change to target dir; necessary for correct resolution of target path.
|
||||
fname=$(command basename -- "$target") # Extract filename.
|
||||
[ "$fname" = '/' ] && fname='' # !! curiously, `basename /` returns '/'
|
||||
if [ -L "$fname" ]; then
|
||||
# Extract [next] target path, which may be defined
|
||||
# *relative* to the symlink's own directory.
|
||||
# Note: We parse `ls -l` output to find the symlink target
|
||||
# which is the only POSIX-compliant, albeit somewhat fragile, way.
|
||||
target=$(command ls -l "$fname")
|
||||
target=${target#* -> }
|
||||
continue # Resolve [next] symlink target.
|
||||
fi
|
||||
break # Ultimate target reached.
|
||||
done
|
||||
targetDir=$(command pwd -P) # Get canonical dir. path
|
||||
# Output the ultimate target's canonical path.
|
||||
# Note that we manually resolve paths ending in /. and /.. to make sure we have a normalized path.
|
||||
if [ "$fname" = '.' ]; then
|
||||
command printf '%s\n' "${targetDir%/}"
|
||||
elif [ "$fname" = '..' ]; then
|
||||
# Caveat: something like /var/.. will resolve to /private (assuming /var@ -> /private/var), i.e. the '..' is applied
|
||||
# AFTER canonicalization.
|
||||
command printf '%s\n' "$(command dirname -- "${targetDir}")"
|
||||
else
|
||||
command printf '%s\n' "${targetDir%/}/$fname"
|
||||
fi
|
||||
)
|
||||
|
||||
get_script_dir() {
|
||||
|
||||
# call this with $0 (from main script) as its (only) parameter
|
||||
# if you need to preserve cwd, run this is a subshell since
|
||||
# it can change cwd
|
||||
|
||||
# set -x
|
||||
|
||||
local_SCRIPT_PATH="$( get_abs_filename "$1" )";
|
||||
|
||||
while [ -h "$local_SCRIPT_PATH" ];
|
||||
do
|
||||
cd "$( dirname -- "$local_SCRIPT_PATH"; )";
|
||||
local_SCRIPT_PATH="$( rreadlink "$local_SCRIPT_PATH" )";
|
||||
done
|
||||
|
||||
cd "$( dirname -- "$local_SCRIPT_PATH"; )" > '/dev/null';
|
||||
local_SCRIPT_PATH="$( pwd; )";
|
||||
|
||||
# set +x
|
||||
|
||||
echo "${local_SCRIPT_PATH}"
|
||||
}
|
||||
|
||||
# end of script directory functions
|
||||
###############################################################################
|
||||
|
||||
# figure out the script dir
|
||||
LOADUP_SCRIPTDIR="$(get_script_dir "$0")"
|
||||
export LOADUP_SCRIPTDIR
|
||||
|
||||
fi
|
||||
|
||||
. scripts/loadup-setup.sh
|
||||
|
||||
echo ">>>>> START ${script_name}"
|
||||
|
||||
./scripts/cpv "${LOADUP_WORKDIR}"/fuller.database "${LOADUP_OUTDIR}"
|
||||
./scripts/cpv "${LOADUP_WORKDIR}"/fuller.dribble "${LOADUP_OUTDIR}"
|
||||
|
||||
echo "<<<<< END ${script_name}"
|
||||
echo ""
|
||||
exit 0
|
||||
main "$@"
|
||||
|
||||
@@ -1,24 +1,130 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -x run-medley ] ; then
|
||||
echo run from MEDLEYDIR
|
||||
exit 1
|
||||
main() {
|
||||
# shellcheck source=./loadup-setup.sh
|
||||
. "${LOADUP_SCRIPTDIR}/loadup-setup.sh"
|
||||
|
||||
echo ">>>>> START ${script_name}"
|
||||
|
||||
/bin/sh "${LOADUP_SCRIPTDIR}/cpv" "${LOADUP_WORKDIR}"/full.sysout "${LOADUP_OUTDIR}" \
|
||||
| sed -e "s#${MEDLEYDIR}/##g"
|
||||
/bin/sh "${LOADUP_SCRIPTDIR}/cpv" "${LOADUP_WORKDIR}"/lisp.sysout "${LOADUP_OUTDIR}" \
|
||||
| sed -e "s#${MEDLEYDIR}/##g"
|
||||
|
||||
/bin/sh "${LOADUP_SCRIPTDIR}/cpv" "${LOADUP_WORKDIR}"/init.dribble "${LOADUP_OUTDIR}" \
|
||||
| sed -e "s#${MEDLEYDIR}/##g"
|
||||
/bin/sh "${LOADUP_SCRIPTDIR}/cpv" "${LOADUP_WORKDIR}"/lisp.dribble "${LOADUP_OUTDIR}" \
|
||||
| sed -e "s#${MEDLEYDIR}/##g"
|
||||
/bin/sh "${LOADUP_SCRIPTDIR}/cpv" "${LOADUP_WORKDIR}"/full.dribble "${LOADUP_OUTDIR}" \
|
||||
| sed -e "s#${MEDLEYDIR}/##g"
|
||||
|
||||
/bin/sh "${LOADUP_SCRIPTDIR}/cpv" "${LOADUP_WORKDIR}"/RDSYS library \
|
||||
| sed -e "s#${MEDLEYDIR}/##g"
|
||||
/bin/sh "${LOADUP_SCRIPTDIR}/cpv" "${LOADUP_WORKDIR}"/RDSYS.LCOM library \
|
||||
| sed -e "s#${MEDLEYDIR}/##g"
|
||||
|
||||
echo "<<<<< END ${script_name}"
|
||||
echo ""
|
||||
exit 0
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2164,SC2034
|
||||
if [ -z "${LOADUP_SCRIPTDIR}" ]
|
||||
then
|
||||
#
|
||||
#
|
||||
# Some functions to determine what directory this script is being executed from
|
||||
#
|
||||
#
|
||||
get_abs_filename() {
|
||||
# $1 : relative filename
|
||||
echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
|
||||
}
|
||||
|
||||
# This function taken from
|
||||
# https://stackoverflow.com/questions/29832037/how-to-get-script-directory-in-posix-sh
|
||||
rreadlink() (
|
||||
|
||||
# Execute this function in a *subshell* to localize variables and the effect of `cd`.
|
||||
|
||||
target=$1
|
||||
fname=
|
||||
targetDir=
|
||||
CDPATH=
|
||||
|
||||
# Try to make the execution environment as predictable as possible:
|
||||
# All commands below are invoked via `command`, so we must make sure that `command`
|
||||
# itself is not redefined as an alias or shell function.
|
||||
# (Note that command is too inconsistent across shells, so we don't use it.)
|
||||
# `command` is a *builtin* in bash, dash, ksh, zsh, and some platforms do not even have
|
||||
# an external utility version of it (e.g, Ubuntu).
|
||||
# `command` bypasses aliases and shell functions and also finds builtins
|
||||
# in bash, dash, and ksh. In zsh, option POSIX_BUILTINS must be turned on for that
|
||||
# to happen.
|
||||
{ \unalias command; \unset -f command; } >/dev/null 2>&1
|
||||
[ -n "$ZSH_VERSION" ] && options[POSIX_BUILTINS]=on # make zsh find *builtins* with `command` too.
|
||||
|
||||
while :; do # Resolve potential symlinks until the ultimate target is found.
|
||||
[ -L "$target" ] || [ -e "$target" ] || { command printf '%s\n' "ERROR: '$target' does not exist." >&2; return 1; }
|
||||
command cd "$(command dirname -- "$target")" # Change to target dir; necessary for correct resolution of target path.
|
||||
fname=$(command basename -- "$target") # Extract filename.
|
||||
[ "$fname" = '/' ] && fname='' # !! curiously, `basename /` returns '/'
|
||||
if [ -L "$fname" ]; then
|
||||
# Extract [next] target path, which may be defined
|
||||
# *relative* to the symlink's own directory.
|
||||
# Note: We parse `ls -l` output to find the symlink target
|
||||
# which is the only POSIX-compliant, albeit somewhat fragile, way.
|
||||
target=$(command ls -l "$fname")
|
||||
target=${target#* -> }
|
||||
continue # Resolve [next] symlink target.
|
||||
fi
|
||||
break # Ultimate target reached.
|
||||
done
|
||||
targetDir=$(command pwd -P) # Get canonical dir. path
|
||||
# Output the ultimate target's canonical path.
|
||||
# Note that we manually resolve paths ending in /. and /.. to make sure we have a normalized path.
|
||||
if [ "$fname" = '.' ]; then
|
||||
command printf '%s\n' "${targetDir%/}"
|
||||
elif [ "$fname" = '..' ]; then
|
||||
# Caveat: something like /var/.. will resolve to /private (assuming /var@ -> /private/var), i.e. the '..' is applied
|
||||
# AFTER canonicalization.
|
||||
command printf '%s\n' "$(command dirname -- "${targetDir}")"
|
||||
else
|
||||
command printf '%s\n' "${targetDir%/}/$fname"
|
||||
fi
|
||||
)
|
||||
|
||||
get_script_dir() {
|
||||
|
||||
# call this with $0 (from main script) as its (only) parameter
|
||||
# if you need to preserve cwd, run this is a subshell since
|
||||
# it can change cwd
|
||||
|
||||
# set -x
|
||||
|
||||
local_SCRIPT_PATH="$( get_abs_filename "$1" )";
|
||||
|
||||
while [ -h "$local_SCRIPT_PATH" ];
|
||||
do
|
||||
cd "$( dirname -- "$local_SCRIPT_PATH"; )";
|
||||
local_SCRIPT_PATH="$( rreadlink "$local_SCRIPT_PATH" )";
|
||||
done
|
||||
|
||||
cd "$( dirname -- "$local_SCRIPT_PATH"; )" > '/dev/null';
|
||||
local_SCRIPT_PATH="$( pwd; )";
|
||||
|
||||
# set +x
|
||||
|
||||
echo "${local_SCRIPT_PATH}"
|
||||
}
|
||||
|
||||
# end of script directory functions
|
||||
###############################################################################
|
||||
|
||||
# figure out the script dir
|
||||
LOADUP_SCRIPTDIR="$(get_script_dir "$0")"
|
||||
export LOADUP_SCRIPTDIR
|
||||
|
||||
fi
|
||||
|
||||
. scripts/loadup-setup.sh
|
||||
|
||||
echo ">>>>> START ${script_name}"
|
||||
|
||||
./scripts/cpv "${LOADUP_WORKDIR}"/full.sysout "${LOADUP_OUTDIR}" | sed -e "s#${MEDLEYDIR}/##g"
|
||||
./scripts/cpv "${LOADUP_WORKDIR}"/lisp.sysout "${LOADUP_OUTDIR}" | sed -e "s#${MEDLEYDIR}/##g"
|
||||
|
||||
./scripts/cpv "${LOADUP_WORKDIR}"/init.dribble "${LOADUP_OUTDIR}" | sed -e "s#${MEDLEYDIR}/##g"
|
||||
./scripts/cpv "${LOADUP_WORKDIR}"/lisp.dribble "${LOADUP_OUTDIR}" | sed -e "s#${MEDLEYDIR}/##g"
|
||||
./scripts/cpv "${LOADUP_WORKDIR}"/full.dribble "${LOADUP_OUTDIR}" | sed -e "s#${MEDLEYDIR}/##g"
|
||||
|
||||
./scripts/cpv "${LOADUP_WORKDIR}"/RDSYS library | sed -e "s#${MEDLEYDIR}/##g"
|
||||
./scripts/cpv "${LOADUP_WORKDIR}"/RDSYS.LCOM library | sed -e "s#${MEDLEYDIR}/##g"
|
||||
|
||||
echo "<<<<< END ${script_name}"
|
||||
echo ""
|
||||
exit 0
|
||||
main "$@"
|
||||
|
||||
@@ -1,50 +1,146 @@
|
||||
#!/bin/sh
|
||||
# shellcheck disable=SC2181
|
||||
|
||||
if [ ! -h ./medley ] || [ ! -d ./lispusers ]
|
||||
main() {
|
||||
|
||||
# shellcheck source=./loadup-setup.sh
|
||||
. "${LOADUP_SCRIPTDIR}/loadup-setup.sh"
|
||||
|
||||
# look thru args looking to see if -apps, --apps, or -a was specified in args
|
||||
apps=""
|
||||
j=1
|
||||
jmax=$#
|
||||
while [ "$j" -le "$jmax" ]
|
||||
do
|
||||
if [ "$(eval "printf %s \${${j}}")" = "-a" ] || \
|
||||
[ "$(eval "printf %s \${${j}}")" = "-apps" ] || \
|
||||
[ "$(eval "printf %s \${${j}}")" = "--apps" ]
|
||||
then
|
||||
apps="-apps"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Do loadup components
|
||||
/bin/sh "${LOADUP_SCRIPTDIR}/loadup-init.sh" \
|
||||
&& /bin/sh "${LOADUP_SCRIPTDIR}/loadup-mid-from-init.sh" \
|
||||
&& /bin/sh "${LOADUP_SCRIPTDIR}/loadup-lisp-from-mid.sh" \
|
||||
&& /bin/sh "${LOADUP_SCRIPTDIR}/loadup-full-from-lisp.sh" \
|
||||
&& { \
|
||||
if [ -n "${apps}" ]; \
|
||||
then \
|
||||
/bin/sh "${LOADUP_SCRIPTDIR}/loadup-apps-from-full.sh"; \
|
||||
fi; \
|
||||
} \
|
||||
&& /bin/sh "${LOADUP_SCRIPTDIR}/loadup-aux.sh" \
|
||||
&& /bin/sh "${LOADUP_SCRIPTDIR}/copy-all.sh" "${apps}"
|
||||
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
echo "+++++ loadup-all.sh: SUCCESS +++++"
|
||||
else
|
||||
echo "----- loadup-all.sh: FAILURE -----"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2164,SC2034
|
||||
if [ -z "${LOADUP_SCRIPTDIR}" ]
|
||||
then
|
||||
echo "*** ERROR ***"
|
||||
echo "You must run $(basename "$0") while the cwd is a Medley top-level directory."
|
||||
echo "The cwd ($(pwd)) is not a Medley top-level directory."
|
||||
echo "Exiting."
|
||||
exit 1
|
||||
#
|
||||
#
|
||||
# Some functions to determine what directory this script is being executed from
|
||||
#
|
||||
#
|
||||
get_abs_filename() {
|
||||
# $1 : relative filename
|
||||
echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
|
||||
}
|
||||
|
||||
# This function taken from
|
||||
# https://stackoverflow.com/questions/29832037/how-to-get-script-directory-in-posix-sh
|
||||
rreadlink() (
|
||||
|
||||
# Execute this function in a *subshell* to localize variables and the effect of `cd`.
|
||||
|
||||
target=$1
|
||||
fname=
|
||||
targetDir=
|
||||
CDPATH=
|
||||
|
||||
# Try to make the execution environment as predictable as possible:
|
||||
# All commands below are invoked via `command`, so we must make sure that `command`
|
||||
# itself is not redefined as an alias or shell function.
|
||||
# (Note that command is too inconsistent across shells, so we don't use it.)
|
||||
# `command` is a *builtin* in bash, dash, ksh, zsh, and some platforms do not even have
|
||||
# an external utility version of it (e.g, Ubuntu).
|
||||
# `command` bypasses aliases and shell functions and also finds builtins
|
||||
# in bash, dash, and ksh. In zsh, option POSIX_BUILTINS must be turned on for that
|
||||
# to happen.
|
||||
{ \unalias command; \unset -f command; } >/dev/null 2>&1
|
||||
[ -n "$ZSH_VERSION" ] && options[POSIX_BUILTINS]=on # make zsh find *builtins* with `command` too.
|
||||
|
||||
while :; do # Resolve potential symlinks until the ultimate target is found.
|
||||
[ -L "$target" ] || [ -e "$target" ] || { command printf '%s\n' "ERROR: '$target' does not exist." >&2; return 1; }
|
||||
command cd "$(command dirname -- "$target")" # Change to target dir; necessary for correct resolution of target path.
|
||||
fname=$(command basename -- "$target") # Extract filename.
|
||||
[ "$fname" = '/' ] && fname='' # !! curiously, `basename /` returns '/'
|
||||
if [ -L "$fname" ]; then
|
||||
# Extract [next] target path, which may be defined
|
||||
# *relative* to the symlink's own directory.
|
||||
# Note: We parse `ls -l` output to find the symlink target
|
||||
# which is the only POSIX-compliant, albeit somewhat fragile, way.
|
||||
target=$(command ls -l "$fname")
|
||||
target=${target#* -> }
|
||||
continue # Resolve [next] symlink target.
|
||||
fi
|
||||
break # Ultimate target reached.
|
||||
done
|
||||
targetDir=$(command pwd -P) # Get canonical dir. path
|
||||
# Output the ultimate target's canonical path.
|
||||
# Note that we manually resolve paths ending in /. and /.. to make sure we have a normalized path.
|
||||
if [ "$fname" = '.' ]; then
|
||||
command printf '%s\n' "${targetDir%/}"
|
||||
elif [ "$fname" = '..' ]; then
|
||||
# Caveat: something like /var/.. will resolve to /private (assuming /var@ -> /private/var), i.e. the '..' is applied
|
||||
# AFTER canonicalization.
|
||||
command printf '%s\n' "$(command dirname -- "${targetDir}")"
|
||||
else
|
||||
command printf '%s\n' "${targetDir%/}/$fname"
|
||||
fi
|
||||
)
|
||||
|
||||
get_script_dir() {
|
||||
|
||||
# call this with $0 (from main script) as its (only) parameter
|
||||
# if you need to preserve cwd, run this is a subshell since
|
||||
# it can change cwd
|
||||
|
||||
# set -x
|
||||
|
||||
local_SCRIPT_PATH="$( get_abs_filename "$1" )";
|
||||
|
||||
while [ -h "$local_SCRIPT_PATH" ];
|
||||
do
|
||||
cd "$( dirname -- "$local_SCRIPT_PATH"; )";
|
||||
local_SCRIPT_PATH="$( rreadlink "$local_SCRIPT_PATH" )";
|
||||
done
|
||||
|
||||
cd "$( dirname -- "$local_SCRIPT_PATH"; )" > '/dev/null';
|
||||
local_SCRIPT_PATH="$( pwd; )";
|
||||
|
||||
# set +x
|
||||
|
||||
echo "${local_SCRIPT_PATH}"
|
||||
}
|
||||
|
||||
# end of script directory functions
|
||||
###############################################################################
|
||||
|
||||
# figure out the script dir
|
||||
LOADUP_SCRIPTDIR="$(get_script_dir "$0")"
|
||||
export LOADUP_SCRIPTDIR
|
||||
|
||||
fi
|
||||
|
||||
# shellcheck source=./loadup-setup.sh
|
||||
. scripts/loadup-setup.sh
|
||||
|
||||
# look thru args looking to see if -apps, --apps, or -a was specified in args
|
||||
apps=true
|
||||
j=1
|
||||
jmax=$#
|
||||
while [ "$j" -le "$jmax" ]
|
||||
do
|
||||
if [ "$(eval "printf %s \${${j}}")" = "-a" ] || \
|
||||
[ "$(eval "printf %s \${${j}}")" = "-apps" ] || \
|
||||
[ "$(eval "printf %s \${${j}}")" = "--apps" ]
|
||||
then
|
||||
apps="./scripts/loadup-apps-from-full.sh"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Do loadup components
|
||||
./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 "$1"
|
||||
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
echo "+++++ loadup-all.sh: SUCCESS +++++"
|
||||
else
|
||||
echo "----- loadup-all.sh: FAILURE -----"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
main "$@"
|
||||
|
||||
@@ -1,76 +1,171 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -h ./medley ] || [ ! -d ./lispusers ]
|
||||
main() {
|
||||
# shellcheck source=./loadup-setup.sh
|
||||
. "${LOADUP_SCRIPTDIR}/loadup-setup.sh"
|
||||
|
||||
loadup_start
|
||||
|
||||
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 "${NOTECARDSDIR}" ]
|
||||
then
|
||||
echo "Error: Cannot find the Notecards directory"
|
||||
echo "It should be located at ${MEDLEYDIR}/../notecards or"
|
||||
echo "${MEDLEYDIR}/../../notecards. But its not."
|
||||
echo "Exiting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat >"${cmfile}" <<-"EOF"
|
||||
"
|
||||
|
||||
(PROGN
|
||||
(IL:MEDLEY-INIT-VARS 'IL:GREET)
|
||||
(IL:DRIBBLE (IL:CONCAT (QUOTE {DSK})(IL:UNIX-GETENV(QUOTE LOADUP_WORKDIR))(IL:L-CASE (QUOTE /apps.dribble))))
|
||||
(IL:LOAD (IL:CONCAT (QUOTE {DSK}) (IL:UNIX-GETENV(QUOTE ROOMSDIR))(QUOTE /ROOMS)) 'IL:SYSLOAD)
|
||||
(IL:LOAD (IL:CONCAT (QUOTE {DSK}) (IL:UNIX-GETENV(QUOTE NOTECARDSDIR))(QUOTE |/system/NOTECARDS.LCOM|)) 'IL:SYSLOAD)
|
||||
(IL:LOAD (IL:CONCAT (QUOTE {DSK}) (IL:UNIX-GETENV(QUOTE CLOSDIR))(QUOTE /DEFSYS.DFASL)) 'IL:SYSLOAD)
|
||||
(IL:LOAD (IL:CONCAT (QUOTE {DSK}) (IL:UNIX-GETENV(QUOTE MEDLEYDIR))(QUOTE |lispusers/BUTTONS.LCOM|)) 'IL:SYSLOAD)
|
||||
(IL:LOAD
|
||||
(IL:CONCAT (QUOTE {DSK}) (IL:UNIX-GETENV (QUOTE LOADUP_SOURCEDIR)) (QUOTE /LOADUP-APPS.LCOM))
|
||||
'IL:SYSLOAD
|
||||
)
|
||||
(IL:HARDRESET)
|
||||
)
|
||||
SHH
|
||||
(PROGN
|
||||
(IL:ENDLOADUP)
|
||||
(CLOS::LOAD-CLOS)
|
||||
(IL:|Apps.LOADUP|)
|
||||
(IL:DRIBBLE)
|
||||
(IL:MAKESYS
|
||||
(IL:CONCAT (QUOTE {DSK})(IL:UNIX-GETENV(QUOTE LOADUP_WORKDIR))(IL:L-CASE (QUOTE /apps.sysout)))
|
||||
:APPS)
|
||||
)
|
||||
(IL:LOGOUT T)
|
||||
|
||||
"
|
||||
EOF
|
||||
|
||||
run_medley "${LOADUP_WORKDIR}/full.sysout"
|
||||
|
||||
loadup_finish "apps.sysout" "apps.*"
|
||||
}
|
||||
|
||||
|
||||
# shellcheck disable=SC2164,SC2034
|
||||
if [ -z "${LOADUP_SCRIPTDIR}" ]
|
||||
then
|
||||
echo "*** ERROR ***"
|
||||
echo "You must run $(basename "$0") while the cwd is a Medley top-level directory."
|
||||
echo "The cwd ($(pwd)) is not a Medley top-level directory."
|
||||
echo "Exiting."
|
||||
exit 1
|
||||
#
|
||||
#
|
||||
# Some functions to determine what directory this script is being executed from
|
||||
#
|
||||
#
|
||||
get_abs_filename() {
|
||||
# $1 : relative filename
|
||||
echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
|
||||
}
|
||||
|
||||
# This function taken from
|
||||
# https://stackoverflow.com/questions/29832037/how-to-get-script-directory-in-posix-sh
|
||||
rreadlink() (
|
||||
|
||||
# Execute this function in a *subshell* to localize variables and the effect of `cd`.
|
||||
|
||||
target=$1
|
||||
fname=
|
||||
targetDir=
|
||||
CDPATH=
|
||||
|
||||
# Try to make the execution environment as predictable as possible:
|
||||
# All commands below are invoked via `command`, so we must make sure that `command`
|
||||
# itself is not redefined as an alias or shell function.
|
||||
# (Note that command is too inconsistent across shells, so we don't use it.)
|
||||
# `command` is a *builtin* in bash, dash, ksh, zsh, and some platforms do not even have
|
||||
# an external utility version of it (e.g, Ubuntu).
|
||||
# `command` bypasses aliases and shell functions and also finds builtins
|
||||
# in bash, dash, and ksh. In zsh, option POSIX_BUILTINS must be turned on for that
|
||||
# to happen.
|
||||
{ \unalias command; \unset -f command; } >/dev/null 2>&1
|
||||
[ -n "$ZSH_VERSION" ] && options[POSIX_BUILTINS]=on # make zsh find *builtins* with `command` too.
|
||||
|
||||
while :; do # Resolve potential symlinks until the ultimate target is found.
|
||||
[ -L "$target" ] || [ -e "$target" ] || { command printf '%s\n' "ERROR: '$target' does not exist." >&2; return 1; }
|
||||
command cd "$(command dirname -- "$target")" # Change to target dir; necessary for correct resolution of target path.
|
||||
fname=$(command basename -- "$target") # Extract filename.
|
||||
[ "$fname" = '/' ] && fname='' # !! curiously, `basename /` returns '/'
|
||||
if [ -L "$fname" ]; then
|
||||
# Extract [next] target path, which may be defined
|
||||
# *relative* to the symlink's own directory.
|
||||
# Note: We parse `ls -l` output to find the symlink target
|
||||
# which is the only POSIX-compliant, albeit somewhat fragile, way.
|
||||
target=$(command ls -l "$fname")
|
||||
target=${target#* -> }
|
||||
continue # Resolve [next] symlink target.
|
||||
fi
|
||||
break # Ultimate target reached.
|
||||
done
|
||||
targetDir=$(command pwd -P) # Get canonical dir. path
|
||||
# Output the ultimate target's canonical path.
|
||||
# Note that we manually resolve paths ending in /. and /.. to make sure we have a normalized path.
|
||||
if [ "$fname" = '.' ]; then
|
||||
command printf '%s\n' "${targetDir%/}"
|
||||
elif [ "$fname" = '..' ]; then
|
||||
# Caveat: something like /var/.. will resolve to /private (assuming /var@ -> /private/var), i.e. the '..' is applied
|
||||
# AFTER canonicalization.
|
||||
command printf '%s\n' "$(command dirname -- "${targetDir}")"
|
||||
else
|
||||
command printf '%s\n' "${targetDir%/}/$fname"
|
||||
fi
|
||||
)
|
||||
|
||||
get_script_dir() {
|
||||
|
||||
# call this with $0 (from main script) as its (only) parameter
|
||||
# if you need to preserve cwd, run this is a subshell since
|
||||
# it can change cwd
|
||||
|
||||
# set -x
|
||||
|
||||
local_SCRIPT_PATH="$( get_abs_filename "$1" )";
|
||||
|
||||
while [ -h "$local_SCRIPT_PATH" ];
|
||||
do
|
||||
cd "$( dirname -- "$local_SCRIPT_PATH"; )";
|
||||
local_SCRIPT_PATH="$( rreadlink "$local_SCRIPT_PATH" )";
|
||||
done
|
||||
|
||||
cd "$( dirname -- "$local_SCRIPT_PATH"; )" > '/dev/null';
|
||||
local_SCRIPT_PATH="$( pwd; )";
|
||||
|
||||
# set +x
|
||||
|
||||
echo "${local_SCRIPT_PATH}"
|
||||
}
|
||||
|
||||
# end of script directory functions
|
||||
###############################################################################
|
||||
|
||||
# figure out the script dir
|
||||
LOADUP_SCRIPTDIR="$(get_script_dir "$0")"
|
||||
export LOADUP_SCRIPTDIR
|
||||
|
||||
fi
|
||||
|
||||
# shellcheck source=./loadup-setup.sh
|
||||
. scripts/loadup-setup.sh
|
||||
|
||||
loadup_start
|
||||
|
||||
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 "${NOTECARDSDIR}" ]
|
||||
then
|
||||
echo "Error: Cannot find the Notecards directory"
|
||||
echo "It should be located at ${MEDLEYDIR}/../notecards or"
|
||||
echo "${MEDLEYDIR}/../../notecards. But its not."
|
||||
echo "Exiting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat >"${cmfile}" <<"EOF"
|
||||
"
|
||||
|
||||
(PROGN
|
||||
(IL:MEDLEY-INIT-VARS 'IL:GREET)
|
||||
(IL:DRIBBLE (IL:CONCAT (QUOTE {DSK})(IL:UNIX-GETENV(QUOTE LOADUP_WORKDIR))(IL:L-CASE (QUOTE /apps.dribble))))
|
||||
(IL:LOAD (IL:CONCAT (QUOTE {DSK}) (IL:UNIX-GETENV(QUOTE ROOMSDIR))(QUOTE /ROOMS)) 'IL:SYSLOAD)
|
||||
(IL:LOAD (IL:CONCAT (QUOTE {DSK}) (IL:UNIX-GETENV(QUOTE NOTECARDSDIR))(QUOTE |/system/NOTECARDS.LCOM|)) 'IL:SYSLOAD)
|
||||
(IL:LOAD (IL:CONCAT (QUOTE {DSK}) (IL:UNIX-GETENV(QUOTE CLOSDIR))(QUOTE /DEFSYS.DFASL)) 'IL:SYSLOAD)
|
||||
(IL:LOAD (IL:CONCAT (QUOTE {DSK}) (IL:UNIX-GETENV(QUOTE MEDLEYDIR))(QUOTE |lispusers/BUTTONS.LCOM|)) 'IL:SYSLOAD)
|
||||
(IL:LOAD
|
||||
(IL:CONCAT (QUOTE {DSK}) (IL:UNIX-GETENV (QUOTE LOADUP_SOURCEDIR)) (QUOTE /LOADUP-APPS.LCOM))
|
||||
'IL:SYSLOAD
|
||||
)
|
||||
(IL:HARDRESET)
|
||||
)
|
||||
SHH
|
||||
(PROGN
|
||||
(IL:ENDLOADUP)
|
||||
(CLOS::LOAD-CLOS)
|
||||
(IL:|Apps.LOADUP|)
|
||||
(IL:DRIBBLE)
|
||||
(IL:MAKESYS
|
||||
(IL:CONCAT (QUOTE {DSK})(IL:UNIX-GETENV(QUOTE LOADUP_WORKDIR))(IL:L-CASE (QUOTE /apps.sysout)))
|
||||
:APPS)
|
||||
)
|
||||
(IL:LOGOUT T)
|
||||
|
||||
"
|
||||
EOF
|
||||
|
||||
run_medley "${LOADUP_WORKDIR}/full.sysout"
|
||||
|
||||
loadup_finish "apps.sysout" "apps.*"
|
||||
main "$@"
|
||||
|
||||
@@ -1,36 +1,135 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -h ./medley ] || [ ! -d ./lispusers ]
|
||||
main() {
|
||||
|
||||
# shellcheck source=./loadup-setup.sh
|
||||
. "${LOADUP_SCRIPTDIR}/loadup-setup.sh"
|
||||
|
||||
|
||||
loadup_start
|
||||
|
||||
cat >"${cmfile}" <<-"EOF"
|
||||
"
|
||||
(PROG
|
||||
((WORKDIR (IL:CONCAT (QUOTE {DSK}) (IL:UNIX-GETENV (QUOTE LOADUP_WORKDIR)) (QUOTE /))))
|
||||
(IL:MEDLEY-INIT-VARS)
|
||||
(IL:LOAD(QUOTE MEDLEY-UTILS))
|
||||
(DRIBBLE (QUOTE {DSK}<TMP>FOOBAR))
|
||||
(IL:MAKE-EXPORTS-ALL (IL:CONCAT WORKDIR (IL:L-CASE (QUOTE exports.all))))
|
||||
(DRIBBLE)
|
||||
(IL:MAKE-WHEREIS-HASH
|
||||
(IL:CONCAT WORKDIR (IL:L-CASE (QUOTE whereis.dribble)))
|
||||
(IL:CONCAT WORKDIR (IL:L-CASE (QUOTE whereis.hash-tmp)))
|
||||
(IL:CONCAT WORKDIR (IL:L-CASE (QUOTE whereis.hash)))
|
||||
)
|
||||
(IL:LOGOUT T)
|
||||
)
|
||||
"
|
||||
EOF
|
||||
|
||||
run_medley "${LOADUP_WORKDIR}/full.sysout"
|
||||
|
||||
loadup_finish "whereis.hash" "whereis.hash" "exports.all"
|
||||
}
|
||||
|
||||
|
||||
# shellcheck disable=SC2164,SC2034
|
||||
if [ -z "${LOADUP_SCRIPTDIR}" ]
|
||||
then
|
||||
echo "*** ERROR ***"
|
||||
echo "You must run $(basename "$0") while the cwd is a Medley top-level directory."
|
||||
echo "The cwd ($(pwd)) is not a Medley top-level directory."
|
||||
echo "Exiting."
|
||||
exit 1
|
||||
#
|
||||
#
|
||||
# Some functions to determine what directory this script is being executed from
|
||||
#
|
||||
#
|
||||
get_abs_filename() {
|
||||
# $1 : relative filename
|
||||
echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
|
||||
}
|
||||
|
||||
# This function taken from
|
||||
# https://stackoverflow.com/questions/29832037/how-to-get-script-directory-in-posix-sh
|
||||
rreadlink() (
|
||||
|
||||
# Execute this function in a *subshell* to localize variables and the effect of `cd`.
|
||||
|
||||
target=$1
|
||||
fname=
|
||||
targetDir=
|
||||
CDPATH=
|
||||
|
||||
# Try to make the execution environment as predictable as possible:
|
||||
# All commands below are invoked via `command`, so we must make sure that `command`
|
||||
# itself is not redefined as an alias or shell function.
|
||||
# (Note that command is too inconsistent across shells, so we don't use it.)
|
||||
# `command` is a *builtin* in bash, dash, ksh, zsh, and some platforms do not even have
|
||||
# an external utility version of it (e.g, Ubuntu).
|
||||
# `command` bypasses aliases and shell functions and also finds builtins
|
||||
# in bash, dash, and ksh. In zsh, option POSIX_BUILTINS must be turned on for that
|
||||
# to happen.
|
||||
{ \unalias command; \unset -f command; } >/dev/null 2>&1
|
||||
[ -n "$ZSH_VERSION" ] && options[POSIX_BUILTINS]=on # make zsh find *builtins* with `command` too.
|
||||
|
||||
while :; do # Resolve potential symlinks until the ultimate target is found.
|
||||
[ -L "$target" ] || [ -e "$target" ] || { command printf '%s\n' "ERROR: '$target' does not exist." >&2; return 1; }
|
||||
command cd "$(command dirname -- "$target")" # Change to target dir; necessary for correct resolution of target path.
|
||||
fname=$(command basename -- "$target") # Extract filename.
|
||||
[ "$fname" = '/' ] && fname='' # !! curiously, `basename /` returns '/'
|
||||
if [ -L "$fname" ]; then
|
||||
# Extract [next] target path, which may be defined
|
||||
# *relative* to the symlink's own directory.
|
||||
# Note: We parse `ls -l` output to find the symlink target
|
||||
# which is the only POSIX-compliant, albeit somewhat fragile, way.
|
||||
target=$(command ls -l "$fname")
|
||||
target=${target#* -> }
|
||||
continue # Resolve [next] symlink target.
|
||||
fi
|
||||
break # Ultimate target reached.
|
||||
done
|
||||
targetDir=$(command pwd -P) # Get canonical dir. path
|
||||
# Output the ultimate target's canonical path.
|
||||
# Note that we manually resolve paths ending in /. and /.. to make sure we have a normalized path.
|
||||
if [ "$fname" = '.' ]; then
|
||||
command printf '%s\n' "${targetDir%/}"
|
||||
elif [ "$fname" = '..' ]; then
|
||||
# Caveat: something like /var/.. will resolve to /private (assuming /var@ -> /private/var), i.e. the '..' is applied
|
||||
# AFTER canonicalization.
|
||||
command printf '%s\n' "$(command dirname -- "${targetDir}")"
|
||||
else
|
||||
command printf '%s\n' "${targetDir%/}/$fname"
|
||||
fi
|
||||
)
|
||||
|
||||
get_script_dir() {
|
||||
|
||||
# call this with $0 (from main script) as its (only) parameter
|
||||
# if you need to preserve cwd, run this is a subshell since
|
||||
# it can change cwd
|
||||
|
||||
# set -x
|
||||
|
||||
local_SCRIPT_PATH="$( get_abs_filename "$1" )";
|
||||
|
||||
while [ -h "$local_SCRIPT_PATH" ];
|
||||
do
|
||||
cd "$( dirname -- "$local_SCRIPT_PATH"; )";
|
||||
local_SCRIPT_PATH="$( rreadlink "$local_SCRIPT_PATH" )";
|
||||
done
|
||||
|
||||
cd "$( dirname -- "$local_SCRIPT_PATH"; )" > '/dev/null';
|
||||
local_SCRIPT_PATH="$( pwd; )";
|
||||
|
||||
# set +x
|
||||
|
||||
echo "${local_SCRIPT_PATH}"
|
||||
}
|
||||
|
||||
# end of script directory functions
|
||||
###############################################################################
|
||||
|
||||
# figure out the script dir
|
||||
LOADUP_SCRIPTDIR="$(get_script_dir "$0")"
|
||||
export LOADUP_SCRIPTDIR
|
||||
|
||||
fi
|
||||
|
||||
# shellcheck source=./loadup-setup.sh
|
||||
. scripts/loadup-setup.sh
|
||||
|
||||
loadup_start
|
||||
|
||||
cat >"${cmfile}" <<"EOF"
|
||||
"
|
||||
(PROG
|
||||
((WORKDIR (IL:CONCAT (QUOTE {DSK}) (IL:UNIX-GETENV (QUOTE LOADUP_WORKDIR)) (QUOTE /))))
|
||||
(IL:MEDLEY-INIT-VARS)
|
||||
(IL:LOAD(QUOTE MEDLEY-UTILS))
|
||||
(IL:MAKE-EXPORTS-ALL (IL:CONCAT WORKDIR (IL:L-CASE (QUOTE exports.all))))
|
||||
(IL:MAKE-WHEREIS-HASH
|
||||
(IL:CONCAT WORKDIR (IL:L-CASE (QUOTE whereis.dribble)))
|
||||
(IL:CONCAT WORKDIR (IL:L-CASE (QUOTE whereis.hash-tmp)))
|
||||
(IL:CONCAT WORKDIR (IL:L-CASE (QUOTE whereis.hash)))
|
||||
)
|
||||
(IL:LOGOUT T)
|
||||
)
|
||||
"
|
||||
EOF
|
||||
|
||||
run_medley "${LOADUP_WORKDIR}/full.sysout"
|
||||
|
||||
loadup_finish "whereis.hash" "whereis.hash" "exports.all"
|
||||
main "$@"
|
||||
|
||||
@@ -1,46 +1,141 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -h ./medley ] || [ ! -d ./lispusers ]
|
||||
main() {
|
||||
# shellcheck source=./loadup-setup.sh
|
||||
. "${LOADUP_SCRIPTDIR}/loadup-setup.sh"
|
||||
|
||||
loadup_start
|
||||
|
||||
SYSOUT="${MEDLEYDIR}/loadups/full.sysout"
|
||||
if [ ! -f "${SYSOUT}" ];
|
||||
then
|
||||
echo "Error: cannot find ${SYSOUT}. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat >"${cmfile}" <<-"EOF"
|
||||
"
|
||||
|
||||
(PROG
|
||||
((WORKDIR (IL:CONCAT (QUOTE {DSK}) (IL:UNIX-GETENV (QUOTE LOADUP_WORKDIR)) (QUOTE /))))
|
||||
(IL:MEDLEY-INIT-VARS)
|
||||
(IL:FILESLOAD MEDLEY-UTILS)
|
||||
(SETQ IL:DIRECTORIES (CONS (IL:UNIX-GETENV (QUOTE LOADUP_SOURCEDIR)) IL:DIRECTORIES))
|
||||
(IL:MAKE-FULLER-DB
|
||||
(IL:CONCAT WORKDIR (IL:L-CASE (QUOTE fuller.dribble)))
|
||||
(IL:CONCAT WORKDIR (IL:L-CASE (QUOTE fuller.database)))
|
||||
(IL:CONCAT WORKDIR (IL:L-CASE (QUOTE fuller.sysout)))
|
||||
)
|
||||
(IL:LOGOUT T)
|
||||
)
|
||||
|
||||
"
|
||||
EOF
|
||||
|
||||
run_medley "${SYSOUT}"
|
||||
|
||||
loadup_finish "fuller.database" "fuller*"
|
||||
}
|
||||
|
||||
|
||||
|
||||
# shellcheck disable=SC2164,SC2034
|
||||
if [ -z "${LOADUP_SCRIPTDIR}" ]
|
||||
then
|
||||
echo "*** ERROR ***"
|
||||
echo "You must run $(basename "$0") while the cwd is a Medley top-level directory."
|
||||
echo "The cwd ($(pwd)) is not a Medley top-level directory."
|
||||
echo "Exiting."
|
||||
exit 1
|
||||
#
|
||||
#
|
||||
# Some functions to determine what directory this script is being executed from
|
||||
#
|
||||
#
|
||||
get_abs_filename() {
|
||||
# $1 : relative filename
|
||||
echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
|
||||
}
|
||||
|
||||
# This function taken from
|
||||
# https://stackoverflow.com/questions/29832037/how-to-get-script-directory-in-posix-sh
|
||||
rreadlink() (
|
||||
|
||||
# Execute this function in a *subshell* to localize variables and the effect of `cd`.
|
||||
|
||||
target=$1
|
||||
fname=
|
||||
targetDir=
|
||||
CDPATH=
|
||||
|
||||
# Try to make the execution environment as predictable as possible:
|
||||
# All commands below are invoked via `command`, so we must make sure that `command`
|
||||
# itself is not redefined as an alias or shell function.
|
||||
# (Note that command is too inconsistent across shells, so we don't use it.)
|
||||
# `command` is a *builtin* in bash, dash, ksh, zsh, and some platforms do not even have
|
||||
# an external utility version of it (e.g, Ubuntu).
|
||||
# `command` bypasses aliases and shell functions and also finds builtins
|
||||
# in bash, dash, and ksh. In zsh, option POSIX_BUILTINS must be turned on for that
|
||||
# to happen.
|
||||
{ \unalias command; \unset -f command; } >/dev/null 2>&1
|
||||
[ -n "$ZSH_VERSION" ] && options[POSIX_BUILTINS]=on # make zsh find *builtins* with `command` too.
|
||||
|
||||
while :; do # Resolve potential symlinks until the ultimate target is found.
|
||||
[ -L "$target" ] || [ -e "$target" ] || { command printf '%s\n' "ERROR: '$target' does not exist." >&2; return 1; }
|
||||
command cd "$(command dirname -- "$target")" # Change to target dir; necessary for correct resolution of target path.
|
||||
fname=$(command basename -- "$target") # Extract filename.
|
||||
[ "$fname" = '/' ] && fname='' # !! curiously, `basename /` returns '/'
|
||||
if [ -L "$fname" ]; then
|
||||
# Extract [next] target path, which may be defined
|
||||
# *relative* to the symlink's own directory.
|
||||
# Note: We parse `ls -l` output to find the symlink target
|
||||
# which is the only POSIX-compliant, albeit somewhat fragile, way.
|
||||
target=$(command ls -l "$fname")
|
||||
target=${target#* -> }
|
||||
continue # Resolve [next] symlink target.
|
||||
fi
|
||||
break # Ultimate target reached.
|
||||
done
|
||||
targetDir=$(command pwd -P) # Get canonical dir. path
|
||||
# Output the ultimate target's canonical path.
|
||||
# Note that we manually resolve paths ending in /. and /.. to make sure we have a normalized path.
|
||||
if [ "$fname" = '.' ]; then
|
||||
command printf '%s\n' "${targetDir%/}"
|
||||
elif [ "$fname" = '..' ]; then
|
||||
# Caveat: something like /var/.. will resolve to /private (assuming /var@ -> /private/var), i.e. the '..' is applied
|
||||
# AFTER canonicalization.
|
||||
command printf '%s\n' "$(command dirname -- "${targetDir}")"
|
||||
else
|
||||
command printf '%s\n' "${targetDir%/}/$fname"
|
||||
fi
|
||||
)
|
||||
|
||||
get_script_dir() {
|
||||
|
||||
# call this with $0 (from main script) as its (only) parameter
|
||||
# if you need to preserve cwd, run this is a subshell since
|
||||
# it can change cwd
|
||||
|
||||
# set -x
|
||||
|
||||
local_SCRIPT_PATH="$( get_abs_filename "$1" )";
|
||||
|
||||
while [ -h "$local_SCRIPT_PATH" ];
|
||||
do
|
||||
cd "$( dirname -- "$local_SCRIPT_PATH"; )";
|
||||
local_SCRIPT_PATH="$( rreadlink "$local_SCRIPT_PATH" )";
|
||||
done
|
||||
|
||||
cd "$( dirname -- "$local_SCRIPT_PATH"; )" > '/dev/null';
|
||||
local_SCRIPT_PATH="$( pwd; )";
|
||||
|
||||
# set +x
|
||||
|
||||
echo "${local_SCRIPT_PATH}"
|
||||
}
|
||||
|
||||
# end of script directory functions
|
||||
###############################################################################
|
||||
|
||||
# figure out the script dir
|
||||
LOADUP_SCRIPTDIR="$(get_script_dir "$0")"
|
||||
export LOADUP_SCRIPTDIR
|
||||
|
||||
fi
|
||||
|
||||
# shellcheck source=./loadup-setup.sh
|
||||
. scripts/loadup-setup.sh
|
||||
|
||||
loadup_start
|
||||
|
||||
SYSOUT="${MEDLEYDIR}/loadups/full.sysout"
|
||||
if [ ! -f "${SYSOUT}" ];
|
||||
then
|
||||
echo "Error: cannot find ${SYSOUT}. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat >"${cmfile}" <<"EOF"
|
||||
"
|
||||
|
||||
(PROG
|
||||
((WORKDIR (IL:CONCAT (QUOTE {DSK}) (IL:UNIX-GETENV (QUOTE LOADUP_WORKDIR)) (QUOTE /))))
|
||||
(IL:MEDLEY-INIT-VARS)
|
||||
(IL:FILESLOAD MEDLEY-UTILS)
|
||||
(SETQ IL:DIRECTORIES (CONS (IL:UNIX-GETENV (QUOTE LOADUP_SOURCEDIR)) IL:DIRECTORIES))
|
||||
(IL:MAKE-FULLER-DB
|
||||
(IL:CONCAT WORKDIR (IL:L-CASE (QUOTE fuller.dribble)))
|
||||
(IL:CONCAT WORKDIR (IL:L-CASE (QUOTE fuller.database)))
|
||||
(IL:CONCAT WORKDIR (IL:L-CASE (QUOTE fuller.sysout)))
|
||||
)
|
||||
(IL:LOGOUT T)
|
||||
)
|
||||
|
||||
"
|
||||
EOF
|
||||
|
||||
run_medley "${SYSOUT}"
|
||||
|
||||
loadup_finish "fuller.database" "fuller*"
|
||||
|
||||
main "$@"
|
||||
|
||||
@@ -1,26 +1,121 @@
|
||||
#!/bin/sh
|
||||
# shellcheck disable=SC2181
|
||||
|
||||
if [ ! -h ./medley ] || [ ! -d ./lispusers ]
|
||||
main () {
|
||||
# shellcheck source=./loadup-setup.sh
|
||||
. "${LOADUP_SCRIPTDIR}/loadup-setup.sh"
|
||||
|
||||
/bin/sh "${LOADUP_SCRIPTDIR}/loadup-db-from-full.sh" \
|
||||
&& /bin/sh "${LOADUP_SCRIPTDIR}/copy-db.sh"
|
||||
|
||||
# shellcheck disable=SC2181
|
||||
if [ $? -eq 0 ];
|
||||
then
|
||||
echo "+++++ loadup-db.sh: SUCCESS +++++"
|
||||
else
|
||||
echo "----- loadup-db.sh: FAILURE -----"
|
||||
fi
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2164,SC2034
|
||||
if [ -z "${LOADUP_SCRIPTDIR}" ]
|
||||
then
|
||||
echo "*** ERROR ***"
|
||||
echo "You must run $(basename "$0") while the cwd is a Medley top-level directory."
|
||||
echo "The cwd ($(pwd)) is not a Medley top-level directory."
|
||||
echo "Exiting."
|
||||
exit 1
|
||||
#
|
||||
#
|
||||
# Some functions to determine what directory this script is being executed from
|
||||
#
|
||||
#
|
||||
get_abs_filename() {
|
||||
# $1 : relative filename
|
||||
echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
|
||||
}
|
||||
|
||||
# This function taken from
|
||||
# https://stackoverflow.com/questions/29832037/how-to-get-script-directory-in-posix-sh
|
||||
rreadlink() (
|
||||
|
||||
# Execute this function in a *subshell* to localize variables and the effect of `cd`.
|
||||
|
||||
target=$1
|
||||
fname=
|
||||
targetDir=
|
||||
CDPATH=
|
||||
|
||||
# Try to make the execution environment as predictable as possible:
|
||||
# All commands below are invoked via `command`, so we must make sure that `command`
|
||||
# itself is not redefined as an alias or shell function.
|
||||
# (Note that command is too inconsistent across shells, so we don't use it.)
|
||||
# `command` is a *builtin* in bash, dash, ksh, zsh, and some platforms do not even have
|
||||
# an external utility version of it (e.g, Ubuntu).
|
||||
# `command` bypasses aliases and shell functions and also finds builtins
|
||||
# in bash, dash, and ksh. In zsh, option POSIX_BUILTINS must be turned on for that
|
||||
# to happen.
|
||||
{ \unalias command; \unset -f command; } >/dev/null 2>&1
|
||||
[ -n "$ZSH_VERSION" ] && options[POSIX_BUILTINS]=on # make zsh find *builtins* with `command` too.
|
||||
|
||||
while :; do # Resolve potential symlinks until the ultimate target is found.
|
||||
[ -L "$target" ] || [ -e "$target" ] || { command printf '%s\n' "ERROR: '$target' does not exist." >&2; return 1; }
|
||||
command cd "$(command dirname -- "$target")" # Change to target dir; necessary for correct resolution of target path.
|
||||
fname=$(command basename -- "$target") # Extract filename.
|
||||
[ "$fname" = '/' ] && fname='' # !! curiously, `basename /` returns '/'
|
||||
if [ -L "$fname" ]; then
|
||||
# Extract [next] target path, which may be defined
|
||||
# *relative* to the symlink's own directory.
|
||||
# Note: We parse `ls -l` output to find the symlink target
|
||||
# which is the only POSIX-compliant, albeit somewhat fragile, way.
|
||||
target=$(command ls -l "$fname")
|
||||
target=${target#* -> }
|
||||
continue # Resolve [next] symlink target.
|
||||
fi
|
||||
break # Ultimate target reached.
|
||||
done
|
||||
targetDir=$(command pwd -P) # Get canonical dir. path
|
||||
# Output the ultimate target's canonical path.
|
||||
# Note that we manually resolve paths ending in /. and /.. to make sure we have a normalized path.
|
||||
if [ "$fname" = '.' ]; then
|
||||
command printf '%s\n' "${targetDir%/}"
|
||||
elif [ "$fname" = '..' ]; then
|
||||
# Caveat: something like /var/.. will resolve to /private (assuming /var@ -> /private/var), i.e. the '..' is applied
|
||||
# AFTER canonicalization.
|
||||
command printf '%s\n' "$(command dirname -- "${targetDir}")"
|
||||
else
|
||||
command printf '%s\n' "${targetDir%/}/$fname"
|
||||
fi
|
||||
)
|
||||
|
||||
get_script_dir() {
|
||||
|
||||
# call this with $0 (from main script) as its (only) parameter
|
||||
# if you need to preserve cwd, run this is a subshell since
|
||||
# it can change cwd
|
||||
|
||||
# set -x
|
||||
|
||||
local_SCRIPT_PATH="$( get_abs_filename "$1" )";
|
||||
|
||||
while [ -h "$local_SCRIPT_PATH" ];
|
||||
do
|
||||
cd "$( dirname -- "$local_SCRIPT_PATH"; )";
|
||||
local_SCRIPT_PATH="$( rreadlink "$local_SCRIPT_PATH" )";
|
||||
done
|
||||
|
||||
cd "$( dirname -- "$local_SCRIPT_PATH"; )" > '/dev/null';
|
||||
local_SCRIPT_PATH="$( pwd; )";
|
||||
|
||||
# set +x
|
||||
|
||||
echo "${local_SCRIPT_PATH}"
|
||||
}
|
||||
|
||||
# end of script directory functions
|
||||
###############################################################################
|
||||
|
||||
# figure out the script dir
|
||||
LOADUP_SCRIPTDIR="$(get_script_dir "$0")"
|
||||
export LOADUP_SCRIPTDIR
|
||||
|
||||
fi
|
||||
|
||||
# shellcheck source=./loadup-setup.sh
|
||||
. scripts/loadup-setup.sh
|
||||
|
||||
./scripts/loadup-db-from-full.sh && ./scripts/copy-db.sh
|
||||
|
||||
if [ $? -eq 0 ];
|
||||
then
|
||||
echo "+++++ loadup-db.sh: SUCCESS +++++"
|
||||
else
|
||||
echo "----- loadup-db.sh: FAILURE -----"
|
||||
fi
|
||||
main "$@"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,38 +1,132 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -h ./medley ] || [ ! -d ./lispusers ]
|
||||
main() {
|
||||
# shellcheck source=./loadup-setup.sh
|
||||
. "${LOADUP_SCRIPTDIR}/loadup-setup.sh"
|
||||
|
||||
loadup_start
|
||||
|
||||
cat >"${cmfile}" <<-"EOF"
|
||||
"
|
||||
|
||||
(PROGN
|
||||
(IL:LOAD (IL:CONCAT (QUOTE {DSK}) (IL:UNIX-GETENV (QUOTE LOADUP_SOURCEDIR))(QUOTE /LOADUP-FULL.LCOM)))
|
||||
(IL:LOADUP-FULL (IL:CONCAT (QUOTE {DSK}) (IL:UNIX-GETENV(QUOTE LOADUP_WORKDIR))(IL:L-CASE (QUOTE /full.dribble))))
|
||||
(IL:HARDRESET)
|
||||
)
|
||||
SHH
|
||||
(PROGN
|
||||
(IL:ENDLOADUP)
|
||||
(IL:MAKESYS (IL:CONCAT (QUOTE {DSK})(IL:UNIX-GETENV(QUOTE LOADUP_WORKDIR))(IL:L-CASE (QUOTE /full.sysout))) :FULL))
|
||||
(IL:LOGOUT T)
|
||||
)
|
||||
|
||||
"
|
||||
EOF
|
||||
|
||||
run_medley "${LOADUP_WORKDIR}/lisp.sysout"
|
||||
|
||||
loadup_finish "full.sysout" "full.*"
|
||||
}
|
||||
|
||||
|
||||
# shellcheck disable=SC2164,SC2034
|
||||
if [ -z "${LOADUP_SCRIPTDIR}" ]
|
||||
then
|
||||
echo "*** ERROR ***"
|
||||
echo "You must run $(basename "$0") while the cwd is a Medley top-level directory."
|
||||
echo "The cwd ($(pwd)) is not a Medley top-level directory."
|
||||
echo "Exiting."
|
||||
exit 1
|
||||
#
|
||||
#
|
||||
# Some functions to determine what directory this script is being executed from
|
||||
#
|
||||
#
|
||||
get_abs_filename() {
|
||||
# $1 : relative filename
|
||||
echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
|
||||
}
|
||||
|
||||
# This function taken from
|
||||
# https://stackoverflow.com/questions/29832037/how-to-get-script-directory-in-posix-sh
|
||||
rreadlink() (
|
||||
|
||||
# Execute this function in a *subshell* to localize variables and the effect of `cd`.
|
||||
|
||||
target=$1
|
||||
fname=
|
||||
targetDir=
|
||||
CDPATH=
|
||||
|
||||
# Try to make the execution environment as predictable as possible:
|
||||
# All commands below are invoked via `command`, so we must make sure that `command`
|
||||
# itself is not redefined as an alias or shell function.
|
||||
# (Note that command is too inconsistent across shells, so we don't use it.)
|
||||
# `command` is a *builtin* in bash, dash, ksh, zsh, and some platforms do not even have
|
||||
# an external utility version of it (e.g, Ubuntu).
|
||||
# `command` bypasses aliases and shell functions and also finds builtins
|
||||
# in bash, dash, and ksh. In zsh, option POSIX_BUILTINS must be turned on for that
|
||||
# to happen.
|
||||
{ \unalias command; \unset -f command; } >/dev/null 2>&1
|
||||
[ -n "$ZSH_VERSION" ] && options[POSIX_BUILTINS]=on # make zsh find *builtins* with `command` too.
|
||||
|
||||
while :; do # Resolve potential symlinks until the ultimate target is found.
|
||||
[ -L "$target" ] || [ -e "$target" ] || { command printf '%s\n' "ERROR: '$target' does not exist." >&2; return 1; }
|
||||
command cd "$(command dirname -- "$target")" # Change to target dir; necessary for correct resolution of target path.
|
||||
fname=$(command basename -- "$target") # Extract filename.
|
||||
[ "$fname" = '/' ] && fname='' # !! curiously, `basename /` returns '/'
|
||||
if [ -L "$fname" ]; then
|
||||
# Extract [next] target path, which may be defined
|
||||
# *relative* to the symlink's own directory.
|
||||
# Note: We parse `ls -l` output to find the symlink target
|
||||
# which is the only POSIX-compliant, albeit somewhat fragile, way.
|
||||
target=$(command ls -l "$fname")
|
||||
target=${target#* -> }
|
||||
continue # Resolve [next] symlink target.
|
||||
fi
|
||||
break # Ultimate target reached.
|
||||
done
|
||||
targetDir=$(command pwd -P) # Get canonical dir. path
|
||||
# Output the ultimate target's canonical path.
|
||||
# Note that we manually resolve paths ending in /. and /.. to make sure we have a normalized path.
|
||||
if [ "$fname" = '.' ]; then
|
||||
command printf '%s\n' "${targetDir%/}"
|
||||
elif [ "$fname" = '..' ]; then
|
||||
# Caveat: something like /var/.. will resolve to /private (assuming /var@ -> /private/var), i.e. the '..' is applied
|
||||
# AFTER canonicalization.
|
||||
command printf '%s\n' "$(command dirname -- "${targetDir}")"
|
||||
else
|
||||
command printf '%s\n' "${targetDir%/}/$fname"
|
||||
fi
|
||||
)
|
||||
|
||||
get_script_dir() {
|
||||
|
||||
# call this with $0 (from main script) as its (only) parameter
|
||||
# if you need to preserve cwd, run this is a subshell since
|
||||
# it can change cwd
|
||||
|
||||
# set -x
|
||||
|
||||
local_SCRIPT_PATH="$( get_abs_filename "$1" )";
|
||||
|
||||
while [ -h "$local_SCRIPT_PATH" ];
|
||||
do
|
||||
cd "$( dirname -- "$local_SCRIPT_PATH"; )";
|
||||
local_SCRIPT_PATH="$( rreadlink "$local_SCRIPT_PATH" )";
|
||||
done
|
||||
|
||||
cd "$( dirname -- "$local_SCRIPT_PATH"; )" > '/dev/null';
|
||||
local_SCRIPT_PATH="$( pwd; )";
|
||||
|
||||
# set +x
|
||||
|
||||
echo "${local_SCRIPT_PATH}"
|
||||
}
|
||||
|
||||
# end of script directory functions
|
||||
###############################################################################
|
||||
|
||||
# figure out the script dir
|
||||
LOADUP_SCRIPTDIR="$(get_script_dir "$0")"
|
||||
export LOADUP_SCRIPTDIR
|
||||
|
||||
fi
|
||||
|
||||
# shellcheck source=./loadup-setup.sh
|
||||
. scripts/loadup-setup.sh
|
||||
|
||||
loadup_start
|
||||
|
||||
cat >"${cmfile}" <<"EOF"
|
||||
"
|
||||
|
||||
(PROGN
|
||||
(IL:LOAD (IL:CONCAT (QUOTE {DSK}) (IL:UNIX-GETENV (QUOTE LOADUP_SOURCEDIR))(QUOTE /LOADUP-FULL.LCOM)))
|
||||
(IL:LOADUP-FULL (IL:CONCAT (QUOTE {DSK}) (IL:UNIX-GETENV(QUOTE LOADUP_WORKDIR))(IL:L-CASE (QUOTE /full.dribble))))
|
||||
(IL:HARDRESET)
|
||||
)
|
||||
SHH
|
||||
(PROGN
|
||||
(IL:ENDLOADUP)
|
||||
(IL:MAKESYS (IL:CONCAT (QUOTE {DSK})(IL:UNIX-GETENV(QUOTE LOADUP_WORKDIR))(IL:L-CASE (QUOTE /full.sysout))) :FULL))
|
||||
(IL:LOGOUT T)
|
||||
)
|
||||
|
||||
"
|
||||
EOF
|
||||
|
||||
run_medley "${LOADUP_WORKDIR}/lisp.sysout"
|
||||
|
||||
loadup_finish "full.sysout" "full.*"
|
||||
|
||||
main "$@"
|
||||
|
||||
@@ -1,29 +1,121 @@
|
||||
#!/bin/sh
|
||||
# shellcheck disable=SC2181
|
||||
|
||||
if [ ! -h ./medley ] || [ ! -d ./lispusers ]
|
||||
main() {
|
||||
# shellcheck source=./loadup-setup.sh
|
||||
. "${LOADUP_SCRIPTDIR}/loadup-setup.sh"
|
||||
|
||||
/bin/sh "${LOADUP_SCRIPTDIR}/loadup-init.sh" \
|
||||
&& /bin/sh "${LOADUP_SCRIPTDIR}/loadup-mid-from-init.sh" \
|
||||
&& /bin/sh "${LOADUP_SCRIPTDIR}/loadup-lisp-from-mid.sh" \
|
||||
&& /bin/sh "${LOADUP_SCRIPTDIR}/loadup-full-from-lisp.sh" \
|
||||
&& /bin/sh "${LOADUP_SCRIPTDIR}/copy-full.sh" ;
|
||||
|
||||
# shellcheck disable=SC2181
|
||||
if [ $? -eq 0 ];
|
||||
then
|
||||
echo "+++++ loadup-full.sh: SUCCESS +++++"
|
||||
else
|
||||
echo "----- loadup-full.sh: FAILURE -----"
|
||||
fi
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2164,SC2034
|
||||
if [ -z "${LOADUP_SCRIPTDIR}" ]
|
||||
then
|
||||
echo "*** ERROR ***"
|
||||
echo "You must run $(basename "$0") while the cwd is a Medley top-level directory."
|
||||
echo "The cwd ($(pwd)) is not a Medley top-level directory."
|
||||
echo "Exiting."
|
||||
exit 1
|
||||
#
|
||||
#
|
||||
# Some functions to determine what directory this script is being executed from
|
||||
#
|
||||
#
|
||||
get_abs_filename() {
|
||||
# $1 : relative filename
|
||||
echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
|
||||
}
|
||||
|
||||
# This function taken from
|
||||
# https://stackoverflow.com/questions/29832037/how-to-get-script-directory-in-posix-sh
|
||||
rreadlink() (
|
||||
|
||||
# Execute this function in a *subshell* to localize variables and the effect of `cd`.
|
||||
|
||||
target=$1
|
||||
fname=
|
||||
targetDir=
|
||||
CDPATH=
|
||||
|
||||
# Try to make the execution environment as predictable as possible:
|
||||
# All commands below are invoked via `command`, so we must make sure that `command`
|
||||
# itself is not redefined as an alias or shell function.
|
||||
# (Note that command is too inconsistent across shells, so we don't use it.)
|
||||
# `command` is a *builtin* in bash, dash, ksh, zsh, and some platforms do not even have
|
||||
# an external utility version of it (e.g, Ubuntu).
|
||||
# `command` bypasses aliases and shell functions and also finds builtins
|
||||
# in bash, dash, and ksh. In zsh, option POSIX_BUILTINS must be turned on for that
|
||||
# to happen.
|
||||
{ \unalias command; \unset -f command; } >/dev/null 2>&1
|
||||
[ -n "$ZSH_VERSION" ] && options[POSIX_BUILTINS]=on # make zsh find *builtins* with `command` too.
|
||||
|
||||
while :; do # Resolve potential symlinks until the ultimate target is found.
|
||||
[ -L "$target" ] || [ -e "$target" ] || { command printf '%s\n' "ERROR: '$target' does not exist." >&2; return 1; }
|
||||
command cd "$(command dirname -- "$target")" # Change to target dir; necessary for correct resolution of target path.
|
||||
fname=$(command basename -- "$target") # Extract filename.
|
||||
[ "$fname" = '/' ] && fname='' # !! curiously, `basename /` returns '/'
|
||||
if [ -L "$fname" ]; then
|
||||
# Extract [next] target path, which may be defined
|
||||
# *relative* to the symlink's own directory.
|
||||
# Note: We parse `ls -l` output to find the symlink target
|
||||
# which is the only POSIX-compliant, albeit somewhat fragile, way.
|
||||
target=$(command ls -l "$fname")
|
||||
target=${target#* -> }
|
||||
continue # Resolve [next] symlink target.
|
||||
fi
|
||||
break # Ultimate target reached.
|
||||
done
|
||||
targetDir=$(command pwd -P) # Get canonical dir. path
|
||||
# Output the ultimate target's canonical path.
|
||||
# Note that we manually resolve paths ending in /. and /.. to make sure we have a normalized path.
|
||||
if [ "$fname" = '.' ]; then
|
||||
command printf '%s\n' "${targetDir%/}"
|
||||
elif [ "$fname" = '..' ]; then
|
||||
# Caveat: something like /var/.. will resolve to /private (assuming /var@ -> /private/var), i.e. the '..' is applied
|
||||
# AFTER canonicalization.
|
||||
command printf '%s\n' "$(command dirname -- "${targetDir}")"
|
||||
else
|
||||
command printf '%s\n' "${targetDir%/}/$fname"
|
||||
fi
|
||||
)
|
||||
|
||||
get_script_dir() {
|
||||
|
||||
# call this with $0 (from main script) as its (only) parameter
|
||||
# if you need to preserve cwd, run this is a subshell since
|
||||
# it can change cwd
|
||||
|
||||
# set -x
|
||||
|
||||
local_SCRIPT_PATH="$( get_abs_filename "$1" )";
|
||||
|
||||
while [ -h "$local_SCRIPT_PATH" ];
|
||||
do
|
||||
cd "$( dirname -- "$local_SCRIPT_PATH"; )";
|
||||
local_SCRIPT_PATH="$( rreadlink "$local_SCRIPT_PATH" )";
|
||||
done
|
||||
|
||||
cd "$( dirname -- "$local_SCRIPT_PATH"; )" > '/dev/null';
|
||||
local_SCRIPT_PATH="$( pwd; )";
|
||||
|
||||
# set +x
|
||||
|
||||
echo "${local_SCRIPT_PATH}"
|
||||
}
|
||||
|
||||
# end of script directory functions
|
||||
###############################################################################
|
||||
|
||||
# figure out the script dir
|
||||
LOADUP_SCRIPTDIR="$(get_script_dir "$0")"
|
||||
export LOADUP_SCRIPTDIR
|
||||
|
||||
fi
|
||||
|
||||
# shellcheck source=./loadup-setup.sh
|
||||
. ./scripts/loadup-setup.sh
|
||||
|
||||
./scripts/loadup-init.sh && \
|
||||
./scripts/loadup-mid-from-init.sh && \
|
||||
./scripts/loadup-lisp-from-mid.sh && \
|
||||
./scripts/loadup-full-from-lisp.sh && \
|
||||
./scripts/copy-full.sh
|
||||
|
||||
if [ $? -eq 0 ];
|
||||
then
|
||||
echo "+++++ loadup-full.sh: SUCCESS +++++"
|
||||
else
|
||||
echo "----- loadup-full.sh: FAILURE -----"
|
||||
fi
|
||||
|
||||
|
||||
main "$@"
|
||||
|
||||
@@ -1,50 +1,145 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -h ./medley ] || [ ! -d ./lispusers ]
|
||||
main() {
|
||||
# shellcheck source=./loadup-setup.sh
|
||||
. "${LOADUP_SCRIPTDIR}/loadup-setup.sh"
|
||||
|
||||
loadup_start
|
||||
|
||||
cat >"${cmfile}" <<-"EOF"
|
||||
(* "make init files; this file is loaded as a 'greet' file by scripts/loadup-init.sh")
|
||||
|
||||
(SETQ MEDLEYDIR NIL)
|
||||
(LOAD (CONCAT (UNIX-GETENV "MEDLEYDIR") "/sources/MEDLEYDIR.LCOM"))
|
||||
(MEDLEY-INIT-VARS)
|
||||
(CNDIR (UNIX-GETENV "LOADUP_WORKDIR"))
|
||||
(DRIBBLE "init.dribble")
|
||||
|
||||
(UNADVISE)
|
||||
(ADVISE 'PAGEFULLFN '(RETURN))
|
||||
(ADVISE '(ERROR IN \DO-DEFINE-FILE-INFO) '(RETURN))
|
||||
(MOVD? 'NILL 'SETTEMPLATE)
|
||||
(DEFINEQ (RRE (LAMBDA (X Y) Y)))
|
||||
(MOVD? 'RRE 'READ-READER-ENVIRONMENT)
|
||||
|
||||
(LOAD (CONCAT "{DSK}" (UNIX-GETENV "LOADUP_SOURCEDIR") "/" "MAKEINIT.LCOM"))
|
||||
(PROG
|
||||
((WORKDIR (CONCAT "{DSK}" (UNIX-GETENV "LOADUP_WORKDIR") "/"))
|
||||
(LOADUP-SOURCE-DIR (CONCAT "{DSK}" (UNIX-GETENV "LOADUP_SOURCEDIR") "/"))
|
||||
)
|
||||
(SETQ DIRECTORIES (CONS LOADUP-SOURCE-DIR DIRECTORIES))
|
||||
(RESETLST (RESETSAVE OK.TO.MODIFY.FNS T)
|
||||
(MAKEINITGREET (CONCAT WORKDIR "init.sysout") (CONCAT WORKDIR "init.dlinit"))
|
||||
)
|
||||
)
|
||||
(DRIBBLE)
|
||||
(LOGOUT T)
|
||||
STOP
|
||||
EOF
|
||||
|
||||
run_medley "${LOADUP_SOURCEDIR}/starter.sysout"
|
||||
|
||||
loadup_finish "init.dlinit" "init.*" "RDSYS*" "I-NEW*"
|
||||
}
|
||||
|
||||
|
||||
# shellcheck disable=SC2164,SC2034
|
||||
if [ -z "${LOADUP_SCRIPTDIR}" ]
|
||||
then
|
||||
echo "*** ERROR ***"
|
||||
echo "You must run $(basename "$0") while the cwd is a Medley top-level directory."
|
||||
echo "The cwd ($(pwd)) is not a Medley top-level directory."
|
||||
echo "Exiting."
|
||||
exit 1
|
||||
#
|
||||
#
|
||||
# Some functions to determine what directory this script is being executed from
|
||||
#
|
||||
#
|
||||
get_abs_filename() {
|
||||
# $1 : relative filename
|
||||
echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
|
||||
}
|
||||
|
||||
# This function taken from
|
||||
# https://stackoverflow.com/questions/29832037/how-to-get-script-directory-in-posix-sh
|
||||
rreadlink() (
|
||||
|
||||
# Execute this function in a *subshell* to localize variables and the effect of `cd`.
|
||||
|
||||
target=$1
|
||||
fname=
|
||||
targetDir=
|
||||
CDPATH=
|
||||
|
||||
# Try to make the execution environment as predictable as possible:
|
||||
# All commands below are invoked via `command`, so we must make sure that `command`
|
||||
# itself is not redefined as an alias or shell function.
|
||||
# (Note that command is too inconsistent across shells, so we don't use it.)
|
||||
# `command` is a *builtin* in bash, dash, ksh, zsh, and some platforms do not even have
|
||||
# an external utility version of it (e.g, Ubuntu).
|
||||
# `command` bypasses aliases and shell functions and also finds builtins
|
||||
# in bash, dash, and ksh. In zsh, option POSIX_BUILTINS must be turned on for that
|
||||
# to happen.
|
||||
{ \unalias command; \unset -f command; } >/dev/null 2>&1
|
||||
[ -n "$ZSH_VERSION" ] && options[POSIX_BUILTINS]=on # make zsh find *builtins* with `command` too.
|
||||
|
||||
while :; do # Resolve potential symlinks until the ultimate target is found.
|
||||
[ -L "$target" ] || [ -e "$target" ] || { command printf '%s\n' "ERROR: '$target' does not exist." >&2; return 1; }
|
||||
command cd "$(command dirname -- "$target")" # Change to target dir; necessary for correct resolution of target path.
|
||||
fname=$(command basename -- "$target") # Extract filename.
|
||||
[ "$fname" = '/' ] && fname='' # !! curiously, `basename /` returns '/'
|
||||
if [ -L "$fname" ]; then
|
||||
# Extract [next] target path, which may be defined
|
||||
# *relative* to the symlink's own directory.
|
||||
# Note: We parse `ls -l` output to find the symlink target
|
||||
# which is the only POSIX-compliant, albeit somewhat fragile, way.
|
||||
target=$(command ls -l "$fname")
|
||||
target=${target#* -> }
|
||||
continue # Resolve [next] symlink target.
|
||||
fi
|
||||
break # Ultimate target reached.
|
||||
done
|
||||
targetDir=$(command pwd -P) # Get canonical dir. path
|
||||
# Output the ultimate target's canonical path.
|
||||
# Note that we manually resolve paths ending in /. and /.. to make sure we have a normalized path.
|
||||
if [ "$fname" = '.' ]; then
|
||||
command printf '%s\n' "${targetDir%/}"
|
||||
elif [ "$fname" = '..' ]; then
|
||||
# Caveat: something like /var/.. will resolve to /private (assuming /var@ -> /private/var), i.e. the '..' is applied
|
||||
# AFTER canonicalization.
|
||||
command printf '%s\n' "$(command dirname -- "${targetDir}")"
|
||||
else
|
||||
command printf '%s\n' "${targetDir%/}/$fname"
|
||||
fi
|
||||
)
|
||||
|
||||
get_script_dir() {
|
||||
|
||||
# call this with $0 (from main script) as its (only) parameter
|
||||
# if you need to preserve cwd, run this is a subshell since
|
||||
# it can change cwd
|
||||
|
||||
# set -x
|
||||
|
||||
local_SCRIPT_PATH="$( get_abs_filename "$1" )";
|
||||
|
||||
while [ -h "$local_SCRIPT_PATH" ];
|
||||
do
|
||||
cd "$( dirname -- "$local_SCRIPT_PATH"; )";
|
||||
local_SCRIPT_PATH="$( rreadlink "$local_SCRIPT_PATH" )";
|
||||
done
|
||||
|
||||
cd "$( dirname -- "$local_SCRIPT_PATH"; )" > '/dev/null';
|
||||
local_SCRIPT_PATH="$( pwd; )";
|
||||
|
||||
# set +x
|
||||
|
||||
echo "${local_SCRIPT_PATH}"
|
||||
}
|
||||
|
||||
# end of script directory functions
|
||||
###############################################################################
|
||||
|
||||
# figure out the script dir
|
||||
LOADUP_SCRIPTDIR="$(get_script_dir "$0")"
|
||||
export LOADUP_SCRIPTDIR
|
||||
|
||||
fi
|
||||
|
||||
# shellcheck source=./loadup-setup.sh
|
||||
. scripts/loadup-setup.sh
|
||||
|
||||
loadup_start
|
||||
|
||||
cat >"${cmfile}" <<"EOF"
|
||||
(* "make init files; this file is loaded as a 'greet' file by scripts/loadup-init.sh")
|
||||
|
||||
(SETQ MEDLEYDIR NIL)
|
||||
(LOAD (CONCAT (UNIX-GETENV "MEDLEYDIR") "/sources/MEDLEYDIR.LCOM"))
|
||||
(MEDLEY-INIT-VARS)
|
||||
(CNDIR (UNIX-GETENV "LOADUP_WORKDIR"))
|
||||
(DRIBBLE "init.dribble")
|
||||
|
||||
(UNADVISE)
|
||||
(ADVISE 'PAGEFULLFN '(RETURN))
|
||||
(ADVISE '(ERROR IN \DO-DEFINE-FILE-INFO) '(RETURN))
|
||||
(MOVD? 'NILL 'SETTEMPLATE)
|
||||
(DEFINEQ (RRE (LAMBDA (X Y) Y)))
|
||||
(MOVD? 'RRE 'READ-READER-ENVIRONMENT)
|
||||
|
||||
(LOAD (CONCAT "{DSK}" (UNIX-GETENV "LOADUP_SOURCEDIR") "/" "MAKEINIT.LCOM"))
|
||||
(PROG
|
||||
((WORKDIR (CONCAT "{DSK}" (UNIX-GETENV "LOADUP_WORKDIR") "/"))
|
||||
(LOADUP-SOURCE-DIR (CONCAT "{DSK}" (UNIX-GETENV "LOADUP_SOURCEDIR") "/"))
|
||||
)
|
||||
(SETQ DIRECTORIES (CONS LOADUP-SOURCE-DIR DIRECTORIES))
|
||||
(RESETLST (RESETSAVE OK.TO.MODIFY.FNS T)
|
||||
(MAKEINITGREET (CONCAT WORKDIR "init.sysout") (CONCAT WORKDIR "init.dlinit"))
|
||||
)
|
||||
)
|
||||
(DRIBBLE)
|
||||
(LOGOUT T)
|
||||
STOP
|
||||
EOF
|
||||
|
||||
run_medley "${LOADUP_SOURCEDIR}/starter.sysout"
|
||||
|
||||
loadup_finish "init.dlinit" "init.*" "RDSYS*" "I-NEW*"
|
||||
main "$@"
|
||||
|
||||
@@ -1,39 +1,134 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -h ./medley ] || [ ! -d ./lispusers ]
|
||||
main() {
|
||||
# shellcheck source=./loadup-setup.sh
|
||||
. "${LOADUP_SCRIPTDIR}/loadup-setup.sh"
|
||||
|
||||
loadup_start
|
||||
|
||||
cat >"${cmfile}" <<-"EOF"
|
||||
"
|
||||
|
||||
(PROGN
|
||||
(LOAD (CONCAT (QUOTE {DSK}) (UNIX-GETENV (QUOTE MEDLEYDIR)) (QUOTE /sources/MEDLEYDIR.LCOM)))
|
||||
(MEDLEY-INIT-VARS)
|
||||
(LOAD (CONCAT (QUOTE {DSK}) (UNIX-GETENV (QUOTE LOADUP_SOURCEDIR)) (QUOTE /LOADUP-LISP.LCOM)))
|
||||
(LOADUP-LISP (CONCAT (QUOTE {DSK}) (UNIX-GETENV (QUOTE LOADUP_WORKDIR)) (QUOTE /lisp.dribble)))
|
||||
(HARDRESET)
|
||||
)
|
||||
SHH
|
||||
(PROGN
|
||||
(IL:ENDLOADUP)
|
||||
(IL:MAKESYS (IL:CONCAT (QUOTE {DSK}) (IL:UNIX-GETENV(QUOTE LOADUP_WORKDIR)) (IL:L-CASE (QUOTE /lisp.sysout))) :LISP)
|
||||
(IL:LOGOUT T)
|
||||
)
|
||||
|
||||
"
|
||||
EOF
|
||||
|
||||
run_medley "${LOADUP_WORKDIR}/init-mid.sysout"
|
||||
|
||||
loadup_finish "lisp.sysout" "lisp.*"
|
||||
}
|
||||
|
||||
|
||||
# shellcheck disable=SC2164,SC2034
|
||||
if [ -z "${LOADUP_SCRIPTDIR}" ]
|
||||
then
|
||||
echo "*** ERROR ***"
|
||||
echo "You must run $(basename "$0") while the cwd is a Medley top-level directory."
|
||||
echo "The cwd ($(pwd)) is not a Medley top-level directory."
|
||||
echo "Exiting."
|
||||
exit 1
|
||||
#
|
||||
#
|
||||
# Some functions to determine what directory this script is being executed from
|
||||
#
|
||||
#
|
||||
get_abs_filename() {
|
||||
# $1 : relative filename
|
||||
echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
|
||||
}
|
||||
|
||||
# This function taken from
|
||||
# https://stackoverflow.com/questions/29832037/how-to-get-script-directory-in-posix-sh
|
||||
rreadlink() (
|
||||
|
||||
# Execute this function in a *subshell* to localize variables and the effect of `cd`.
|
||||
|
||||
target=$1
|
||||
fname=
|
||||
targetDir=
|
||||
CDPATH=
|
||||
|
||||
# Try to make the execution environment as predictable as possible:
|
||||
# All commands below are invoked via `command`, so we must make sure that `command`
|
||||
# itself is not redefined as an alias or shell function.
|
||||
# (Note that command is too inconsistent across shells, so we don't use it.)
|
||||
# `command` is a *builtin* in bash, dash, ksh, zsh, and some platforms do not even have
|
||||
# an external utility version of it (e.g, Ubuntu).
|
||||
# `command` bypasses aliases and shell functions and also finds builtins
|
||||
# in bash, dash, and ksh. In zsh, option POSIX_BUILTINS must be turned on for that
|
||||
# to happen.
|
||||
{ \unalias command; \unset -f command; } >/dev/null 2>&1
|
||||
[ -n "$ZSH_VERSION" ] && options[POSIX_BUILTINS]=on # make zsh find *builtins* with `command` too.
|
||||
|
||||
while :; do # Resolve potential symlinks until the ultimate target is found.
|
||||
[ -L "$target" ] || [ -e "$target" ] || { command printf '%s\n' "ERROR: '$target' does not exist." >&2; return 1; }
|
||||
command cd "$(command dirname -- "$target")" # Change to target dir; necessary for correct resolution of target path.
|
||||
fname=$(command basename -- "$target") # Extract filename.
|
||||
[ "$fname" = '/' ] && fname='' # !! curiously, `basename /` returns '/'
|
||||
if [ -L "$fname" ]; then
|
||||
# Extract [next] target path, which may be defined
|
||||
# *relative* to the symlink's own directory.
|
||||
# Note: We parse `ls -l` output to find the symlink target
|
||||
# which is the only POSIX-compliant, albeit somewhat fragile, way.
|
||||
target=$(command ls -l "$fname")
|
||||
target=${target#* -> }
|
||||
continue # Resolve [next] symlink target.
|
||||
fi
|
||||
break # Ultimate target reached.
|
||||
done
|
||||
targetDir=$(command pwd -P) # Get canonical dir. path
|
||||
# Output the ultimate target's canonical path.
|
||||
# Note that we manually resolve paths ending in /. and /.. to make sure we have a normalized path.
|
||||
if [ "$fname" = '.' ]; then
|
||||
command printf '%s\n' "${targetDir%/}"
|
||||
elif [ "$fname" = '..' ]; then
|
||||
# Caveat: something like /var/.. will resolve to /private (assuming /var@ -> /private/var), i.e. the '..' is applied
|
||||
# AFTER canonicalization.
|
||||
command printf '%s\n' "$(command dirname -- "${targetDir}")"
|
||||
else
|
||||
command printf '%s\n' "${targetDir%/}/$fname"
|
||||
fi
|
||||
)
|
||||
|
||||
get_script_dir() {
|
||||
|
||||
# call this with $0 (from main script) as its (only) parameter
|
||||
# if you need to preserve cwd, run this is a subshell since
|
||||
# it can change cwd
|
||||
|
||||
# set -x
|
||||
|
||||
local_SCRIPT_PATH="$( get_abs_filename "$1" )";
|
||||
|
||||
while [ -h "$local_SCRIPT_PATH" ];
|
||||
do
|
||||
cd "$( dirname -- "$local_SCRIPT_PATH"; )";
|
||||
local_SCRIPT_PATH="$( rreadlink "$local_SCRIPT_PATH" )";
|
||||
done
|
||||
|
||||
cd "$( dirname -- "$local_SCRIPT_PATH"; )" > '/dev/null';
|
||||
local_SCRIPT_PATH="$( pwd; )";
|
||||
|
||||
# set +x
|
||||
|
||||
echo "${local_SCRIPT_PATH}"
|
||||
}
|
||||
|
||||
# end of script directory functions
|
||||
###############################################################################
|
||||
|
||||
# figure out the script dir
|
||||
LOADUP_SCRIPTDIR="$(get_script_dir "$0")"
|
||||
export LOADUP_SCRIPTDIR
|
||||
|
||||
fi
|
||||
|
||||
# shellcheck source=./loadup-setup.sh
|
||||
. scripts/loadup-setup.sh
|
||||
|
||||
loadup_start
|
||||
|
||||
cat >"${cmfile}" <<"EOF"
|
||||
"
|
||||
|
||||
(PROGN
|
||||
(LOAD (CONCAT (QUOTE {DSK}) (UNIX-GETENV (QUOTE MEDLEYDIR)) (QUOTE /sources/MEDLEYDIR.LCOM)))
|
||||
(MEDLEY-INIT-VARS)
|
||||
(LOAD (CONCAT (QUOTE {DSK}) (UNIX-GETENV (QUOTE LOADUP_SOURCEDIR)) (QUOTE /LOADUP-LISP.LCOM)))
|
||||
(LOADUP-LISP (CONCAT (QUOTE {DSK}) (UNIX-GETENV (QUOTE LOADUP_WORKDIR)) (QUOTE /lisp.dribble)))
|
||||
(HARDRESET)
|
||||
)
|
||||
SHH
|
||||
(PROGN
|
||||
(IL:ENDLOADUP)
|
||||
(IL:MAKESYS (IL:CONCAT (QUOTE {DSK}) (IL:UNIX-GETENV(QUOTE LOADUP_WORKDIR)) (IL:L-CASE (QUOTE /lisp.sysout))) :LISP)
|
||||
(IL:LOGOUT T)
|
||||
)
|
||||
|
||||
"
|
||||
EOF
|
||||
|
||||
run_medley "${LOADUP_WORKDIR}/init-mid.sysout"
|
||||
|
||||
loadup_finish "lisp.sysout" "lisp.*"
|
||||
main "$@"
|
||||
|
||||
@@ -1,30 +1,131 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -h ./medley ] || [ ! -d ./lispusers ]
|
||||
main() {
|
||||
# shellcheck source=./loadup-setup.sh
|
||||
. "${LOADUP_SCRIPTDIR}/loadup-setup.sh"
|
||||
|
||||
loadup_start
|
||||
|
||||
cat >"${cmfile}" <<-"EOF"
|
||||
"
|
||||
(MOVD? (QUOTE NILL) (QUOTE PROMPTPRINT))
|
||||
(MOVD? (QUOTE NILL) (QUOTE CURSORP))
|
||||
(MOVD? (QUOTE NILL) (QUOTE CHANGEBACKGROUNDBORDER))
|
||||
(LOGOUT)
|
||||
"
|
||||
EOF
|
||||
|
||||
run_medley "${LOADUP_WORKDIR}/init.dlinit" -NF -prog ldeinit --vmem "${LOADUP_WORKDIR}/init-mid.sysout"
|
||||
if [ "${exit_code}" -eq 54 ]
|
||||
then
|
||||
echo "NOTE: The loadup script $0 requires the ldeinit executable"
|
||||
echo "in addition to the lde executable be available in MAIKODIR."
|
||||
echo "The ldeinit executable could not be found."
|
||||
fi
|
||||
|
||||
echo " "
|
||||
|
||||
loadup_finish "init-mid.sysout" "init-mid.sysout"
|
||||
}
|
||||
|
||||
|
||||
# shellcheck disable=SC2164,SC2034
|
||||
if [ -z "${LOADUP_SCRIPTDIR}" ]
|
||||
then
|
||||
echo "*** ERROR ***"
|
||||
echo "You must run $(basename "$0") while the cwd is a Medley top-level directory."
|
||||
echo "The cwd ($(pwd)) is not a Medley top-level directory."
|
||||
echo "Exiting."
|
||||
exit 1
|
||||
#
|
||||
#
|
||||
# Some functions to determine what directory this script is being executed from
|
||||
#
|
||||
#
|
||||
get_abs_filename() {
|
||||
# $1 : relative filename
|
||||
echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
|
||||
}
|
||||
|
||||
# This function taken from
|
||||
# https://stackoverflow.com/questions/29832037/how-to-get-script-directory-in-posix-sh
|
||||
rreadlink() (
|
||||
|
||||
# Execute this function in a *subshell* to localize variables and the effect of `cd`.
|
||||
|
||||
target=$1
|
||||
fname=
|
||||
targetDir=
|
||||
CDPATH=
|
||||
|
||||
# Try to make the execution environment as predictable as possible:
|
||||
# All commands below are invoked via `command`, so we must make sure that `command`
|
||||
# itself is not redefined as an alias or shell function.
|
||||
# (Note that command is too inconsistent across shells, so we don't use it.)
|
||||
# `command` is a *builtin* in bash, dash, ksh, zsh, and some platforms do not even have
|
||||
# an external utility version of it (e.g, Ubuntu).
|
||||
# `command` bypasses aliases and shell functions and also finds builtins
|
||||
# in bash, dash, and ksh. In zsh, option POSIX_BUILTINS must be turned on for that
|
||||
# to happen.
|
||||
{ \unalias command; \unset -f command; } >/dev/null 2>&1
|
||||
[ -n "$ZSH_VERSION" ] && options[POSIX_BUILTINS]=on # make zsh find *builtins* with `command` too.
|
||||
|
||||
while :; do # Resolve potential symlinks until the ultimate target is found.
|
||||
[ -L "$target" ] || [ -e "$target" ] || { command printf '%s\n' "ERROR: '$target' does not exist." >&2; return 1; }
|
||||
command cd "$(command dirname -- "$target")" # Change to target dir; necessary for correct resolution of target path.
|
||||
fname=$(command basename -- "$target") # Extract filename.
|
||||
[ "$fname" = '/' ] && fname='' # !! curiously, `basename /` returns '/'
|
||||
if [ -L "$fname" ]; then
|
||||
# Extract [next] target path, which may be defined
|
||||
# *relative* to the symlink's own directory.
|
||||
# Note: We parse `ls -l` output to find the symlink target
|
||||
# which is the only POSIX-compliant, albeit somewhat fragile, way.
|
||||
target=$(command ls -l "$fname")
|
||||
target=${target#* -> }
|
||||
continue # Resolve [next] symlink target.
|
||||
fi
|
||||
break # Ultimate target reached.
|
||||
done
|
||||
targetDir=$(command pwd -P) # Get canonical dir. path
|
||||
# Output the ultimate target's canonical path.
|
||||
# Note that we manually resolve paths ending in /. and /.. to make sure we have a normalized path.
|
||||
if [ "$fname" = '.' ]; then
|
||||
command printf '%s\n' "${targetDir%/}"
|
||||
elif [ "$fname" = '..' ]; then
|
||||
# Caveat: something like /var/.. will resolve to /private (assuming /var@ -> /private/var), i.e. the '..' is applied
|
||||
# AFTER canonicalization.
|
||||
command printf '%s\n' "$(command dirname -- "${targetDir}")"
|
||||
else
|
||||
command printf '%s\n' "${targetDir%/}/$fname"
|
||||
fi
|
||||
)
|
||||
|
||||
get_script_dir() {
|
||||
|
||||
# call this with $0 (from main script) as its (only) parameter
|
||||
# if you need to preserve cwd, run this is a subshell since
|
||||
# it can change cwd
|
||||
|
||||
# set -x
|
||||
|
||||
local_SCRIPT_PATH="$( get_abs_filename "$1" )";
|
||||
|
||||
while [ -h "$local_SCRIPT_PATH" ];
|
||||
do
|
||||
cd "$( dirname -- "$local_SCRIPT_PATH"; )";
|
||||
local_SCRIPT_PATH="$( rreadlink "$local_SCRIPT_PATH" )";
|
||||
done
|
||||
|
||||
cd "$( dirname -- "$local_SCRIPT_PATH"; )" > '/dev/null';
|
||||
local_SCRIPT_PATH="$( pwd; )";
|
||||
|
||||
# set +x
|
||||
|
||||
echo "${local_SCRIPT_PATH}"
|
||||
}
|
||||
|
||||
# end of script directory functions
|
||||
###############################################################################
|
||||
|
||||
# figure out the script dir
|
||||
LOADUP_SCRIPTDIR="$(get_script_dir "$0")"
|
||||
export LOADUP_SCRIPTDIR
|
||||
|
||||
fi
|
||||
|
||||
# shellcheck source=./loadup-setup.sh
|
||||
. scripts/loadup-setup.sh
|
||||
|
||||
loadup_start
|
||||
|
||||
cat >"${cmfile}" <<"EOF"
|
||||
"
|
||||
(MOVD? (QUOTE NILL) (QUOTE PROMPTPRINT))
|
||||
(MOVD? (QUOTE NILL) (QUOTE CURSORP))
|
||||
(MOVD? (QUOTE NILL) (QUOTE CHANGEBACKGROUNDBORDER))
|
||||
(LOGOUT)
|
||||
"
|
||||
EOF
|
||||
|
||||
run_medley "${LOADUP_WORKDIR}/init.dlinit" -NF -prog ldeinit --vmem "${LOADUP_WORKDIR}/init-mid.sysout"
|
||||
|
||||
echo " "
|
||||
|
||||
loadup_finish "init-mid.sysout" "init-mid.sysout"
|
||||
main "$@"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!sh
|
||||
#!to_be_sourced_only
|
||||
# shellcheck shell=sh
|
||||
|
||||
MEDLEYDIR="$(pwd)"
|
||||
MEDLEYDIR=$(cd "${LOADUP_SCRIPTDIR}/.."; pwd)
|
||||
export MEDLEYDIR
|
||||
|
||||
if [ -z "${LOADUP_WORKDIR}" ]
|
||||
@@ -141,18 +141,19 @@ loadup_finish () {
|
||||
run_medley () {
|
||||
if [ ! "${LOADUP_OLDSCHOOL}" = true ]
|
||||
then
|
||||
./medley --config - \
|
||||
--id loadup_+ \
|
||||
--geometry "${geometry}" \
|
||||
--noscroll \
|
||||
--logindir "${LOADUP_LOGINDIR}" \
|
||||
--greet "${cmfile}" \
|
||||
--sysout "$1" \
|
||||
"$2" "$3" "$4" "$5" "$6" "$7" ;
|
||||
/bin/sh "${MEDLEYDIR}/scripts/medley/medley.command" \
|
||||
--config - \
|
||||
--id loadup_+ \
|
||||
--geometry "${geometry}" \
|
||||
--noscroll \
|
||||
--logindir "${LOADUP_LOGINDIR}" \
|
||||
--greet "${cmfile}" \
|
||||
--sysout "$1" \
|
||||
"$2" "$3" "$4" "$5" "$6" "$7" ;
|
||||
exit_code=$?
|
||||
else
|
||||
# shellcheck disable=SC2086
|
||||
./run-medley ${scr} $2 $3 $4 $5 $6 $7 -loadup "${cmfile}" "$1"
|
||||
"${MEDLEYDIR}/run-medley" ${scr} $2 $3 $4 $5 $6 $7 -loadup "${cmfile}" "$1"
|
||||
exit_code=$?
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user