|
Lucio Andrés Illanes Albornoz (arab, vxp) |
92d6c5 |
#!/bin/sh
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
92d6c5 |
#
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
92d6c5 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
792796 |
prepend_path() {
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
792796 |
local _pname _pname_prepend="${1}" IFS=":";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
792796 |
for _pname in ${PATH}; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
792796 |
if [ "${_pname}" = "${_pname_prepend}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
792796 |
return;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
792796 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
792796 |
done; export PATH="${_pname_prepend}${PATH:+:${PATH}}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
792796 |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
792796 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
convert_links_ask() {
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
local _ _link_name _link_target;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
echo "Warning: ${MIDIPIX_PATH}/native/lib contains shared objects (library"
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
echo "images) that are symbolic links. This is not supported by Midipix at"
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
echo "present and commonly occurs if the binary distribution tarball was"
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
echo "extracted by an application that does not support symbolic links"
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
echo "correctly. This also occurs when a binary distribution was built locally."
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
printf "Convert all shared object symbolic links to hard links? (y|N) ";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
read _;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
case "${_}" in
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
[yY]) break; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
*) echo "Exiting."; exit 6; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
esac;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
for _link_name in $(find ${MIDIPIX_PATH}/native/lib \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
-maxdepth 1 -name \*.so -type l); do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
_link_target="$(readlink -- "${_link_name}")";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
if [ -f "${MIDIPIX_PATH}/native/lib/${_link_target}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
echo rm -f -- "${_link_name}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
rm -f -- "${_link_name}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
echo ln -f -- "${_link_target}" "${_link_name}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
ln -f -- "${_link_target}" "${_link_name}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
done;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
check_prereq_files() {
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
local _fname;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
for _fname in ${MIDIPIX_DNAME_ROOT}/bin/ntctty.exe \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
${MIDIPIX_DNAME_ROOT}/bin/chroot \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
${MIDIPIX_DNAME_ROOT}/bin/env \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
${MIDIPIX_DNAME_ROOT}/bin/bash; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
if [ ! -e ${MIDIPIX_PATH}/${_fname} ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
return 1;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
done;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
792796 |
prepend_path /bin;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
while [ ${#} -gt 0 ]; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
if [ "${1}" = -h ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
echo "usage: $0 [-h] [-l] [-m] [Cygwin pathname to Midipix root]";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
echo " -l: tail(1) -f libpsxscl.log";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
echo " -m: use Minipix root";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
exit 0;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
elif [ "${1}" = -l ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
ARG_TAILF_LOG=1; shift;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
elif [ "${1}" = -m ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
ARG_MINIPIX=1; shift;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
MIDIPIX_DNAME_ROOT=minipix;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
elif [ "${1#-}" = "${1}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
MIDIPIX_PATH="${1}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
done;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
if [ -z "${MIDIPIX_PATH}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
MIDIPIX_PATH="$(cygpath -am .)" || exit 1;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
92d6c5 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
792796 |
UNAME_OS="$(uname -o)" || exit 2;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
if [ "${MIDIPIX_PATH#*[ ]*}" != "${MIDIPIX_PATH}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
792796 |
echo "Error: drive_letter/dirname must not contain SP (\` ') or VT (\`\\\t') characters.";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
792796 |
exit 3;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
elif [ ! -d ${MIDIPIX_PATH} ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
92d6c5 |
echo "Error: Midipix path non-existent or invalid (\`${MIDIPIX_PATH}'.)";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
792796 |
exit 4;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
elif [ -z "${MIDIPIX_DNAME_ROOT}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
if [ -e ${MIDIPIX_PATH}/native ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
MIDIPIX_DNAME_ROOT=native;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
elif [ -e ${MIDIPIX_PATH}/minipix ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
MIDIPIX_DNAME_ROOT=minipix;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
echo "Error: neither \`${MIDIPIX_PATH}/native' nor \`${MIDIPIX_PATH}/minipix' exist.";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
exit 5;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
if [ \( "${ARG_MINIPIX:-0}" -eq 0 \) -a \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
\( -n "${NATIVE_LIB_LINKS:=$(find ${MIDIPIX_PATH}/native/lib -maxdepth 1 -name \*.so -type l -print -quit)}" \) ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
convert_links_ask || exit 7;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
92d6c5 |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
check_prereq_files || exit 8;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
820be1 |
if [ -f ${MIDIPIX_PATH}/libpsxscl.log ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
820be1 |
echo Found libpsxscl.log, copying to ${MIDIPIX_PATH}/libpsxscl.last.
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
cp -p -- ${MIDIPIX_PATH}/libpsxscl.log \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
${MIDIPIX_PATH}/libpsxscl.last || exit 9;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
92d6c5 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
92d6c5 |
echo "Absolute Midipix pathname: ${MIDIPIX_PATH}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
792796 |
if [ "${UNAME_OS}" = "Msys" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
792796 |
export MSYS2_ARG_CONV_EXCL="*";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
792796 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
mintty -h always -s 120,80 -e /bin/sh -c "
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
92d6c5 |
set -o errexit; stty raw -echo;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
cd ${MIDIPIX_PATH}; \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
env PATH=${MIDIPIX_PATH}/${MIDIPIX_DNAME_ROOT}/lib \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
${MIDIPIX_DNAME_ROOT}/bin/ntctty.exe -e \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
chroot ${MIDIPIX_DNAME_ROOT} \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
/bin/env PATH=/bin:/lib \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
bash" &
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
sleep 0.25;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
NTCTTY_PID="$(ps -W | awk '$NF ~ /ntctty\.exe$/{print $1}')";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
echo "ntctty PID : ${NTCTTY_PID}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
if [ ${ARG_TAILF_LOG:-0} -eq 1 ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f42965 |
tail -f ${MIDIPIX_PATH}/${MIDIPIX_DNAME_ROOT}/bin/libpsxscl.log;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
77171d |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
92d6c5 |
fi;
|