Response to Issue #2198: loadup and medley scripts can now store/retrieve loadup files to/from named subdirectories of MEDLEYDIR/loadups (#2200)
* Add to loadup and medley scripts a --branch argument whereby which loadup outputs are stored in MEDLEYDIR/loadups/branches/BRANCH, where BRANCH is the name of the currently active git branch of MEDLEYDIR (for loadup) or the name of a BRANCH whereby which a loadup had been run with the --branch option (for medley). Man pages updated accordingly. * Removed --git-branch synonym for --branch from both medley and loadup scripts. Added optional BRANCH argument to --branch in loadup script. If BRANCH is specified iot is used as the (pseudo)branch name instead of the current active git branch of MEDLEYDIR. If BRANCH is "-", the current git branch name is used. * When doing loadups, a file called gitinfo is created in the LOADUP_OUTDIR that contains the git commit, git branch and git status of MEDLEYDIR at the time of the loadup. Branch names in loadup and medley scripts now contain only alphanumerics, dahes, underscores, periods. Any other character is coerced to underscore. The branch name is now included in the window title. * Incorporate changes from PR#2208: Use the loadup step script names as the --id string. * Add loadups/gitinfo and loadups/branches to .gitignore
This commit is contained in:
@@ -3,9 +3,6 @@
|
||||
|
||||
main() {
|
||||
|
||||
# shellcheck source=./loadup-setup.sh
|
||||
. "${LOADUP_SCRIPTDIR}/loadup-setup.sh"
|
||||
|
||||
# process args
|
||||
start=""
|
||||
start_s=""
|
||||
@@ -20,6 +17,9 @@ main() {
|
||||
override_lock=false
|
||||
ignore_lock=false
|
||||
export LOADUP_USE_VNC="-"
|
||||
man_flg=false
|
||||
use_branch=""
|
||||
branch_requested=false
|
||||
|
||||
while [ "$#" -ne 0 ];
|
||||
do
|
||||
@@ -123,6 +123,22 @@ main() {
|
||||
end=1
|
||||
end_s=init
|
||||
;;
|
||||
-br | -branch | --branch)
|
||||
branch_requested=true
|
||||
if [ "$2" = "-" ]
|
||||
then
|
||||
use_branch="-"
|
||||
shift
|
||||
else
|
||||
if check_for_no_arg "$2"
|
||||
then
|
||||
use_branch="-"
|
||||
else
|
||||
use_branch="$2"
|
||||
shift
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
-nc | -nocopy | --nocopy)
|
||||
nocopy=true
|
||||
;;
|
||||
@@ -168,13 +184,7 @@ main() {
|
||||
force_vnc="+"
|
||||
;;
|
||||
-z | -man | --man )
|
||||
if [ "$(uname)" = "Darwin" ]
|
||||
then
|
||||
/usr/bin/man "${LOADUP_SOURCEDIR}/man-page/loadup.1.gz"
|
||||
else
|
||||
/usr/bin/man -l "${LOADUP_SOURCEDIR}/man-page/loadup.1.gz"
|
||||
fi
|
||||
exit 0
|
||||
man_flg=true
|
||||
;;
|
||||
*)
|
||||
output_error_msg "Error: unknown flag: $1${EOL}Exiting"
|
||||
@@ -184,6 +194,27 @@ main() {
|
||||
shift
|
||||
done
|
||||
|
||||
#
|
||||
# Source loadup-setup.sh script to set all the standard loadup env variables
|
||||
#
|
||||
|
||||
# shellcheck source=./loadup-setup.sh
|
||||
. "${LOADUP_SCRIPTDIR}/loadup-setup.sh"
|
||||
|
||||
#
|
||||
# if --man flag is set, then show man page and exit
|
||||
#
|
||||
if [ "${man_flg}" = true ]
|
||||
then
|
||||
if [ "$(uname)" = "Darwin" ]
|
||||
then
|
||||
/usr/bin/man "${LOADUP_SOURCEDIR}/man-page/loadup.1.gz"
|
||||
else
|
||||
/usr/bin/man -l "${LOADUP_SOURCEDIR}/man-page/loadup.1.gz"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#
|
||||
#
|
||||
# check arguments
|
||||
@@ -192,6 +223,12 @@ main() {
|
||||
|
||||
no_loadups=false
|
||||
|
||||
# check --branch is used correctly
|
||||
if [ "${branch_requested}" = true ] && [ -z "${use_branch}" ]
|
||||
then
|
||||
output_warn_msg "The --branch (-br) flag was used. But either git is not installed on this system or \"${LOADUP_SOURCEDIR}\" is not a git directory.${EOL}The --branch flag will be ignored"
|
||||
fi
|
||||
|
||||
#
|
||||
# check for no args or only maikodir arg and set defaults appropriately
|
||||
#
|
||||
@@ -299,6 +336,16 @@ main() {
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# Save git informatiom into LOADUP_OUTDIR
|
||||
#
|
||||
|
||||
if [ -n "${LOADUP_COMMIT_ID}" ]
|
||||
then
|
||||
echo "Commit: ${LOADUP_COMMIT_ID}" > "${LOADUP_OUTDIR}"/gitinfo
|
||||
git status >> "${LOADUP_OUTDIR}"/gitinfo
|
||||
fi
|
||||
|
||||
#
|
||||
# Do individual "stage" loadups as requested
|
||||
#
|
||||
@@ -433,7 +480,6 @@ main() {
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# OK we're done, exit cleanly
|
||||
#
|
||||
@@ -443,6 +489,43 @@ main() {
|
||||
|
||||
}
|
||||
|
||||
is_tput="$(command -v tput)"
|
||||
if [ -z "${is_tput}" ]
|
||||
then
|
||||
is_tput="$(command -v true)"
|
||||
fi
|
||||
|
||||
|
||||
EOL="
|
||||
"
|
||||
|
||||
output_error_msg() {
|
||||
local_oem_file="${TMPDIR:-/tmp}"/oem_$$
|
||||
echo "$1" >"${local_oem_file}"
|
||||
while read -r line
|
||||
do
|
||||
echo "$(${is_tput} setab 1)$(${is_tput} setaf 7)${line}$(${is_tput} sgr0)"
|
||||
done <"${local_oem_file}"
|
||||
rm -f "${local_oem_file}"
|
||||
}
|
||||
|
||||
check_for_no_arg() {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
return 0
|
||||
else
|
||||
case "$1" in
|
||||
-*)
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
# shellcheck disable=SC2164,SC2034
|
||||
if [ -z "${LOADUP_SCRIPTDIR}" ]
|
||||
|
||||
@@ -32,10 +32,20 @@ main() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git_commit_ID "${NOTECARDSDIR}"
|
||||
git_commit_info "${NOTECARDSDIR}"
|
||||
NOTECARDS_COMMIT_ID="${COMMIT_ID}"
|
||||
export NOTECARDS_COMMIT_ID
|
||||
|
||||
if [ -n "${NOTECARDS_COMMIT_ID}" ]
|
||||
then
|
||||
{
|
||||
echo ;
|
||||
echo "--------------------------------------------" ;
|
||||
echo "Notecards Commit: ${NOTECARDS_COMMIT_ID}" ;
|
||||
git -C "${NOTECARDSDIR}" status ;
|
||||
} >> "${LOADUP_OUTDIR}/gitinfo"
|
||||
fi
|
||||
|
||||
initfile="-"
|
||||
cat >"${cmfile}" <<-EOF
|
||||
"
|
||||
|
||||
@@ -12,10 +12,38 @@ then
|
||||
export LOADUP_SOURCEDIR
|
||||
fi
|
||||
|
||||
git_commit_info () {
|
||||
if [ -f "$(command -v git)" ] && [ -x "$(command -v git)" ]
|
||||
then
|
||||
if git -C "$1" rev-parse >/dev/null 2>/dev/null
|
||||
then
|
||||
# This does NOT indicate if there are any modified files!
|
||||
COMMIT_ID="$(git -C "$1" rev-parse --short HEAD)"
|
||||
BRANCH="$(git -C "$1" rev-parse --abbrev-ref HEAD)"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
git_commit_info "${LOADUP_SOURCEDIR}"
|
||||
export LOADUP_COMMIT_ID="${COMMIT_ID}"
|
||||
export LOADUP_BRANCH="${BRANCH}"
|
||||
|
||||
if [ "${use_branch}" = "-" ]
|
||||
then
|
||||
use_branch="${LOADUP_BRANCH}"
|
||||
fi
|
||||
|
||||
slash_branch=""
|
||||
if [ -n "${use_branch}" ]
|
||||
then
|
||||
use_branch="$(printf %s "${use_branch}" | sed "s/[^a-zA-Z0-9_.-]/_/g")"
|
||||
slash_branch="/branches/${use_branch}"
|
||||
fi
|
||||
|
||||
|
||||
if [ -z "${LOADUP_OUTDIR}" ]
|
||||
then
|
||||
LOADUP_OUTDIR="${MEDLEYDIR}/loadups"
|
||||
export LOADUP_OUTDIR
|
||||
export LOADUP_OUTDIR="${MEDLEYDIR}/loadups${slash_branch}"
|
||||
fi
|
||||
|
||||
if [ ! -d "${LOADUP_OUTDIR}" ];
|
||||
@@ -63,43 +91,13 @@ then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f "$(command -v git)" ] && [ -x "$(command -v git)" ]
|
||||
then
|
||||
export HAS_GIT=true
|
||||
else
|
||||
export HAS_GIT=false
|
||||
fi
|
||||
|
||||
is_git_dir () {
|
||||
if [ "${HAS_GIT}" = true ]
|
||||
then
|
||||
return "$(git -C "$1" rev-parse >/dev/null 2>/dev/null; echo $?)"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
git_commit_ID () {
|
||||
if [ "${HAS_GIT}" = true ]
|
||||
then
|
||||
if is_git_dir "$1"
|
||||
then
|
||||
# This does NOT indicate if there are any modified files!
|
||||
COMMIT_ID="$(git -C "$1" rev-parse --short HEAD)"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
git_commit_ID "${LOADUP_SOURCEDIR}"
|
||||
LOADUP_COMMIT_ID="${COMMIT_ID}"
|
||||
export LOADUP_COMMIT_ID
|
||||
|
||||
# obsolete? scr="-sc 1024x768 -g 1042x790"
|
||||
geometry=1024x768
|
||||
|
||||
touch "${LOADUP_WORKDIR}"/loadup.timestamp
|
||||
|
||||
script_name=$(basename "$0" ".sh")
|
||||
script_name_for_id=$(echo "${script_name}" | sed -e "s/-/_/g")
|
||||
cmfile="${LOADUP_WORKDIR}/${script_name}.cm"
|
||||
initfile="${LOADUP_WORKDIR}/${script_name}.init"
|
||||
|
||||
@@ -165,7 +163,7 @@ force_vnc="-"
|
||||
run_medley () {
|
||||
/bin/sh "${MEDLEYDIR}/scripts/medley/medley.command" \
|
||||
--config - \
|
||||
--id loadup_+ \
|
||||
--id "${script_name_for_id}_+" \
|
||||
--geometry "${geometry}" \
|
||||
--noscroll \
|
||||
--logindir "${LOADUP_LOGINDIR}" \
|
||||
@@ -187,6 +185,7 @@ fi
|
||||
|
||||
EOL="
|
||||
"
|
||||
|
||||
output_error_msg() {
|
||||
local_oem_file="${TMPDIR:-/tmp}"/oem_$$
|
||||
echo "$1" >"${local_oem_file}"
|
||||
|
||||
@@ -161,6 +161,9 @@ SCRIPTDIR="$(get_script_dir "$0")"
|
||||
|
||||
is_tput="$(command -v tput)"
|
||||
|
||||
export EOL="
|
||||
"
|
||||
|
||||
output_error_msg() {
|
||||
local_oem_file="${TMPDIR:-/tmp}"/oem_$$
|
||||
echo "$1" >"${local_oem_file}"
|
||||
@@ -176,6 +179,16 @@ output_error_msg() {
|
||||
rm -f "${local_oem_file}"
|
||||
}
|
||||
|
||||
output_warn_msg() {
|
||||
local_oem_file="${TMPDIR:-/tmp}"/oem_$$
|
||||
echo "$1" >"${local_oem_file}"
|
||||
while read -r line
|
||||
do
|
||||
echo "$(${is_tput} setab 3)$(${is_tput} setaf 4)${line}$(${is_tput} sgr0)"
|
||||
done <"${local_oem_file}"
|
||||
rm -f "${local_oem_file}"
|
||||
}
|
||||
|
||||
check_for_dash_or_end() {
|
||||
local_err_msg="";
|
||||
if [ -z "$2" ] || [ "$2" = "--" ]
|
||||
@@ -309,6 +322,19 @@ parse_nethub_data() {
|
||||
}
|
||||
|
||||
|
||||
git_commit_info () {
|
||||
if [ -f "$(command -v git)" ] && [ -x "$(command -v git)" ]
|
||||
then
|
||||
if git -C "$1" rev-parse >/dev/null 2>/dev/null
|
||||
then
|
||||
# This does NOT indicate if there are any modified files!
|
||||
COMMIT_ID="$(git -C "$1" rev-parse --short HEAD)"
|
||||
BRANCH="$(git -C "$1" rev-parse --abbrev-ref HEAD)"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
MEDLEYDIR="$(cd "${SCRIPTDIR}/../.."; pwd)"
|
||||
export MEDLEYDIR
|
||||
IL_DIR="$(cd "${MEDLEYDIR}/.."; pwd)"
|
||||
@@ -641,6 +667,7 @@ borderwidth_arg=""
|
||||
remcm_arg="${LDEREMCM}"
|
||||
repeat_cm=""
|
||||
automation=false
|
||||
use_branch=""
|
||||
|
||||
# Add marker at end of args so we can accumulate pass-on args in args array
|
||||
set -- "$@" "--start_of_pass_args"
|
||||
@@ -655,6 +682,16 @@ do
|
||||
sysout_arg="apps"
|
||||
sysout_stage="${args_stage}"
|
||||
;;
|
||||
-br | -branch | --branch)
|
||||
if [ "$2" = "-" ]
|
||||
then
|
||||
use_branch="-"
|
||||
else
|
||||
check_for_dash_or_end "$1" "$2"
|
||||
use_branch="$2"
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
-c | --config)
|
||||
# already handled so just skip both flag and value
|
||||
shift;
|
||||
@@ -1008,7 +1045,6 @@ do
|
||||
shift
|
||||
done
|
||||
|
||||
|
||||
# Process run_id
|
||||
# if it doesn't end in #, make sure that there is not another instance currently running with this same id
|
||||
# If it does end in #, find the right number to fill in for the #
|
||||
@@ -1098,9 +1134,69 @@ else
|
||||
fi
|
||||
export LDEDESTSYSOUT
|
||||
|
||||
# expand on use_branch, if needed
|
||||
|
||||
if [ "${use_branch}" = "-" ]
|
||||
then
|
||||
git_commit_info "${MEDLEYDIR}"
|
||||
use_branch="${BRANCH}"
|
||||
if [ -z "${use_branch}" ]
|
||||
then
|
||||
output_warn_msg "A \"--branch -\" (\"-br -\") argument was given on the command line.${EOL}But either there is no git installed on this system or MEDLEYDIR (\"${MEDLEYDIR}\") is not a git directory.${EOL}Ignoring --branch argument.${EOL}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# clean use_branch of no alphanumeric chars
|
||||
|
||||
if [ -n "${use_branch}" ]
|
||||
then
|
||||
use_branch="$(printf %s "${use_branch}" | sed "s/[^a-zA-Z0-9_.-]/_/g")"
|
||||
fi
|
||||
|
||||
# Figure out the branch/loadupsdir situation
|
||||
|
||||
slash_branch=""
|
||||
if [ -n "${use_branch}" ]
|
||||
then
|
||||
branches_dir="${MEDLEYDIR}/loadups/branches"
|
||||
mkdir -p "${branches_dir}"
|
||||
matches="$(cd "${branches_dir}" && ls -d "${use_branch}"*)"
|
||||
echo ${matches}
|
||||
if [ -z "${matches}" ]
|
||||
then
|
||||
output_error_msg "The \"--branch ${use_branch}\" argument was given on the command line${EOL}but a directory matching \"${branches_dir}/${use_branch}*\" does not exist.${EOL}Exiting."
|
||||
exit 1
|
||||
else
|
||||
count=0
|
||||
new_branch=""
|
||||
for match in ${matches}
|
||||
do
|
||||
if [ "${match}" = "${use_branch}" ]
|
||||
then
|
||||
new_branch="${match}"
|
||||
count=1
|
||||
break
|
||||
else
|
||||
new_branch="${match}"
|
||||
count=$((count + 1))
|
||||
fi
|
||||
done
|
||||
if [ "${count}" -ge 2 ]
|
||||
then
|
||||
output_error_msg "The \"--branch ${use_branch}\" argument was given on the command line${EOL}but more than one subdirectory in \"${branches_dir}\" matches \"${use_branch}*\".${EOL}Exiting."
|
||||
exit 1
|
||||
else
|
||||
use_branch="${new_branch}"
|
||||
fi
|
||||
slash_branch="/branches/${use_branch}"
|
||||
fi
|
||||
fi
|
||||
|
||||
loadups_dir="${MEDLEYDIR}/loadups${slash_branch}"
|
||||
export MEDLEY_LOADUPS_DIR="${loadups_dir}"
|
||||
|
||||
# Figure out the sysout situation
|
||||
|
||||
loadups_dir="${MEDLEYDIR}/loadups"
|
||||
if [ -z "${sysout_arg}" ]
|
||||
then
|
||||
if [ -f "${LDEDESTSYSOUT}" ]
|
||||
@@ -1119,7 +1215,7 @@ but the directory \"${loadups_dir}\" where ${sysout_arg}.sysout is supposed to b
|
||||
cannot be found.
|
||||
Exiting."
|
||||
output_error_msg "${err_msg}"
|
||||
exit 62
|
||||
exit 1
|
||||
fi
|
||||
src_sysout="${loadups_dir}/${sysout_arg}.sysout"
|
||||
;;
|
||||
@@ -1133,6 +1229,7 @@ then
|
||||
err_msg="Error: Cannot find the specified sysout file \"${src_sysout}\".
|
||||
Exiting."
|
||||
output_error_msg "${err_msg}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Figure out screensize and geometry based on arguments
|
||||
@@ -1313,15 +1410,21 @@ fi
|
||||
# figure out title situation
|
||||
if [ -z "${title}" ]
|
||||
then
|
||||
title="Medley Interlisp %i"
|
||||
title="Medley%b%i"
|
||||
fi
|
||||
if [ ! "${run_id}" = default ]
|
||||
if [ "${run_id}" = default ]
|
||||
then
|
||||
title="$(printf %s "${title}" | sed -e "s/%i/:: ${run_id}/")"
|
||||
else
|
||||
title="$(printf %s "${title}" | sed -e "s/%i//")"
|
||||
else
|
||||
title="$(printf %s "${title}" | sed -e "s/%i/::${run_id}/")"
|
||||
fi
|
||||
if [ -n "${use_branch}" ]
|
||||
then
|
||||
short_branch="$(printf "%0.16s" "${use_branch}")"
|
||||
title="$(printf %s "${title}" | sed -e "s/%b/::${short_branch}/")"
|
||||
else
|
||||
title="$(printf %s "${title}" | sed -e "s/%b//")"
|
||||
fi
|
||||
|
||||
|
||||
# Figure out the maiko executable name
|
||||
# used for loadups (ldeinit)
|
||||
|
||||
@@ -49,6 +49,7 @@ borderwidth_arg=""
|
||||
remcm_arg="${LDEREMCM}"
|
||||
repeat_cm=""
|
||||
automation=false
|
||||
use_branch=""
|
||||
|
||||
# Add marker at end of args so we can accumulate pass-on args in args array
|
||||
set -- "$@" "--start_of_pass_args"
|
||||
@@ -63,6 +64,16 @@ do
|
||||
sysout_arg="apps"
|
||||
sysout_stage="${args_stage}"
|
||||
;;
|
||||
-br | -branch | --branch)
|
||||
if [ "$2" = "-" ]
|
||||
then
|
||||
use_branch="-"
|
||||
else
|
||||
check_for_dash_or_end "$1" "$2"
|
||||
use_branch="$2"
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
-c | --config)
|
||||
# already handled so just skip both flag and value
|
||||
shift;
|
||||
@@ -415,4 +426,3 @@ do
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
|
||||
@@ -52,9 +52,69 @@ else
|
||||
fi
|
||||
export LDEDESTSYSOUT
|
||||
|
||||
# expand on use_branch, if needed
|
||||
|
||||
if [ "${use_branch}" = "-" ]
|
||||
then
|
||||
git_commit_info "${MEDLEYDIR}"
|
||||
use_branch="${BRANCH}"
|
||||
if [ -z "${use_branch}" ]
|
||||
then
|
||||
output_warn_msg "A \"--branch -\" (\"-br -\") argument was given on the command line.${EOL}But either there is no git installed on this system or MEDLEYDIR (\"${MEDLEYDIR}\") is not a git directory.${EOL}Ignoring --branch argument.${EOL}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# clean use_branch of no alphanumeric chars
|
||||
|
||||
if [ -n "${use_branch}" ]
|
||||
then
|
||||
use_branch="$(printf %s "${use_branch}" | sed "s/[^a-zA-Z0-9_.-]/_/g")"
|
||||
fi
|
||||
|
||||
# Figure out the branch/loadupsdir situation
|
||||
|
||||
slash_branch=""
|
||||
if [ -n "${use_branch}" ]
|
||||
then
|
||||
branches_dir="${MEDLEYDIR}/loadups/branches"
|
||||
mkdir -p "${branches_dir}"
|
||||
matches="$(cd "${branches_dir}" && ls -d "${use_branch}"*)"
|
||||
echo ${matches}
|
||||
if [ -z "${matches}" ]
|
||||
then
|
||||
output_error_msg "The \"--branch ${use_branch}\" argument was given on the command line${EOL}but a directory matching \"${branches_dir}/${use_branch}*\" does not exist.${EOL}Exiting."
|
||||
exit 1
|
||||
else
|
||||
count=0
|
||||
new_branch=""
|
||||
for match in ${matches}
|
||||
do
|
||||
if [ "${match}" = "${use_branch}" ]
|
||||
then
|
||||
new_branch="${match}"
|
||||
count=1
|
||||
break
|
||||
else
|
||||
new_branch="${match}"
|
||||
count=$((count + 1))
|
||||
fi
|
||||
done
|
||||
if [ "${count}" -ge 2 ]
|
||||
then
|
||||
output_error_msg "The \"--branch ${use_branch}\" argument was given on the command line${EOL}but more than one subdirectory in \"${branches_dir}\" matches \"${use_branch}*\".${EOL}Exiting."
|
||||
exit 1
|
||||
else
|
||||
use_branch="${new_branch}"
|
||||
fi
|
||||
slash_branch="/branches/${use_branch}"
|
||||
fi
|
||||
fi
|
||||
|
||||
loadups_dir="${MEDLEYDIR}/loadups${slash_branch}"
|
||||
export MEDLEY_LOADUPS_DIR="${loadups_dir}"
|
||||
|
||||
# Figure out the sysout situation
|
||||
|
||||
loadups_dir="${MEDLEYDIR}/loadups"
|
||||
if [ -z "${sysout_arg}" ]
|
||||
then
|
||||
if [ -f "${LDEDESTSYSOUT}" ]
|
||||
@@ -73,7 +133,7 @@ but the directory \"${loadups_dir}\" where ${sysout_arg}.sysout is supposed to b
|
||||
cannot be found.
|
||||
Exiting."
|
||||
output_error_msg "${err_msg}"
|
||||
exit 62
|
||||
exit 1
|
||||
fi
|
||||
src_sysout="${loadups_dir}/${sysout_arg}.sysout"
|
||||
;;
|
||||
@@ -87,6 +147,7 @@ then
|
||||
err_msg="Error: Cannot find the specified sysout file \"${src_sysout}\".
|
||||
Exiting."
|
||||
output_error_msg "${err_msg}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Figure out screensize and geometry based on arguments
|
||||
@@ -188,15 +249,21 @@ fi
|
||||
# figure out title situation
|
||||
if [ -z "${title}" ]
|
||||
then
|
||||
title="Medley Interlisp %i"
|
||||
title="Medley%b%i"
|
||||
fi
|
||||
if [ ! "${run_id}" = default ]
|
||||
if [ "${run_id}" = default ]
|
||||
then
|
||||
title="$(printf %s "${title}" | sed -e "s/%i/:: ${run_id}/")"
|
||||
else
|
||||
title="$(printf %s "${title}" | sed -e "s/%i//")"
|
||||
else
|
||||
title="$(printf %s "${title}" | sed -e "s/%i/::${run_id}/")"
|
||||
fi
|
||||
if [ -n "${use_branch}" ]
|
||||
then
|
||||
short_branch="$(printf "%0.16s" "${use_branch}")"
|
||||
title="$(printf %s "${title}" | sed -e "s/%b/::${short_branch}/")"
|
||||
else
|
||||
title="$(printf %s "${title}" | sed -e "s/%b//")"
|
||||
fi
|
||||
|
||||
|
||||
# Figure out the maiko executable name
|
||||
# used for loadups (ldeinit)
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
|
||||
is_tput="$(command -v tput)"
|
||||
|
||||
export EOL="
|
||||
"
|
||||
|
||||
output_error_msg() {
|
||||
local_oem_file="${TMPDIR:-/tmp}"/oem_$$
|
||||
echo "$1" >"${local_oem_file}"
|
||||
@@ -30,6 +33,16 @@ output_error_msg() {
|
||||
rm -f "${local_oem_file}"
|
||||
}
|
||||
|
||||
output_warn_msg() {
|
||||
local_oem_file="${TMPDIR:-/tmp}"/oem_$$
|
||||
echo "$1" >"${local_oem_file}"
|
||||
while read -r line
|
||||
do
|
||||
echo "$(${is_tput} setab 3)$(${is_tput} setaf 4)${line}$(${is_tput} sgr0)"
|
||||
done <"${local_oem_file}"
|
||||
rm -f "${local_oem_file}"
|
||||
}
|
||||
|
||||
check_for_dash_or_end() {
|
||||
local_err_msg="";
|
||||
if [ -z "$2" ] || [ "$2" = "--" ]
|
||||
@@ -162,3 +175,16 @@ parse_nethub_data() {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
git_commit_info () {
|
||||
if [ -f "$(command -v git)" ] && [ -x "$(command -v git)" ]
|
||||
then
|
||||
if git -C "$1" rev-parse >/dev/null 2>/dev/null
|
||||
then
|
||||
# This does NOT indicate if there are any modified files!
|
||||
COMMIT_ID="$(git -C "$1" rev-parse --short HEAD)"
|
||||
BRANCH="$(git -C "$1" rev-parse --abbrev-ref HEAD)"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user