Blame midipix.sh

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) 222d37
set -o noglob;
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
if [ -z "${PATH##/bin:*}"					\
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
-a   -z "${PATH##*:/bin:*}"					\
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
-a   -z "${PATH##*:/bin}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
	export PATH="/bin${PATH:+:${PATH}}";
Lucio Andrés Illanes Albornoz (arab, vxp) f42965
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
while getopts m __; do
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
case ${__} in
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
m)	MIDIPIX_DNAME_DIST=minipix; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
*)	echo "usage: $0 [-m] [Cygwin pathname to Midipix root]";
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
	echo "       -m: use Minipix distribution"; exit 0;
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
esac; done;
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
if [ -n "${1}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 3d1589
	MIDIPIX_PATH=$(cygpath -am "${1}"); cd ${MIDIPIX_PATH} || exit 1;
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
else
Lucio Andrés Illanes Albornoz (arab, vxp) 3d1589
	MIDIPIX_PATH=$(cygpath -am .);
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
fi;
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
printf "%-35s: %s\n" "Distribution name" "${MIDIPIX_DNAME_DIST:=native}";
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) 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 (arab, vxp) 222d37
	env PATH=${MIDIPIX_PATH}/${MIDIPIX_DNAME_DIST}/lib		\
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
	${MIDIPIX_DNAME_DIST}/bin/ntctty.exe -e				\
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
		${MIDIPIX_DNAME_DIST}/bin/chroot ${MIDIPIX_DNAME_DIST}	\
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
		/bin/env PATH=/bin:/lib bash" &
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