|
Lucio Andrés Illanes Albornoz (arab, vxp) |
307fd5 |
#!/bin/sh -f
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
307fd5 |
# Prepend /bin to ${PATH} if it does not contain it.
|
|
Lucio Andrés Illanes Albornoz |
0a1831 |
case "${PATH}" in
|
|
Lucio Andrés Illanes Albornoz |
0a1831 |
/bin:*|*:/bin:*|*:/bin) ;;
|
|
Lucio Andrés Illanes Albornoz |
0a1831 |
*) export PATH="/bin${PATH:+:${PATH}}"; ;;
|
|
Lucio Andrés Illanes Albornoz |
0a1831 |
esac;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
307fd5 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
307fd5 |
#
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
307fd5 |
# Process -h/${#} > 1. Set and cd into ${MIDIPIX_PATH} from either
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
307fd5 |
# ${1} or `native,' prepended w/ ${PWD}.
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
307fd5 |
if [ "x${1}" = "x-h" ]\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
307fd5 |
|| [ ${#} -gt 1 ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
307fd5 |
echo "usage: $0 [-h] [path]";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
307fd5 |
echo "path: absolute or relative Cygwin pathname to Midipix root, e.g. minipix or native.";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
307fd5 |
exit 0;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
307fd5 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
307fd5 |
MIDIPIX_PATH="${1:-native}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
307fd5 |
if [ "${1#/}" = "${1}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
307fd5 |
MIDIPIX_PATH="${PWD}/${MIDIPIX_PATH}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
222d37 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
307fd5 |
cd ${MIDIPIX_PATH} || exit 1;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
307fd5 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
307fd5 |
#
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
307fd5 |
# Log variables and backup the last libpsxscl.log to libpsxscl.last.
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
307fd5 |
# Launch chroot(1)ed bash(1) inside ntctty and mintty. Obtain and
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
307fd5 |
# log the PID of the ntctty process for convenience.
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
222d37 |
printf "%-35s: %s\n" "Absolute Midipix pathname" "${MIDIPIX_PATH}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
222d37 |
if [ -f libpsxscl.log ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
222d37 |
echo Found libpsxscl.log, copying to libpsxscl.last.
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
222d37 |
if ! cp -p -- libpsxscl.log libpsxscl.last; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
222d37 |
echo "(cp(1) returned ${?}, ignored.)";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
92d6c5 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
222d37 |
if [ "$(uname -o)" = "Msys" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
307fd5 |
# MingW workaround (via Elieux.)
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
222d37 |
export MSYS2_ARG_CONV_EXCL="*";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
222d37 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
222d37 |
mintty -h always -s 120,80 -e /bin/sh -c "
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
222d37 |
set -o errexit;
|
|
Lucio Andrés Illanes Albornoz |
06cf4b |
stty raw -echo;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
307fd5 |
env PATH=${MIDIPIX_PATH}/lib \
|
|
Lucio Andrés Illanes Albornoz |
06cf4b |
bin/ntctty.exe -p -e \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
307fd5 |
bin/chroot . \
|
|
Lucio Andrés Illanes Albornoz |
06cf4b |
/bin/env PATH=/bin:/lib bash -l" &
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
222d37 |
sleep ${SLEEP_DELAY:=0.25};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
222d37 |
printf "%-35s: %s\n" "ntctty PID" "$(ps -W | awk '$NF ~ /ntctty\.exe$/{print $1}')";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
222d37 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
222d37 |
# vim:filetype=sh
|