Conan_Kudo / build / midipix_build

Forked from build/midipix_build 4 years ago
Clone

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) 92d6c5
MIDIPIX_PATH_DEFAULTS="/c/Midipix /z";
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
if [ "${1}" = -h ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
        echo "usage: $0 [drive_letter [dirname]]";
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
        exit 1;
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
elif [ ${#} -eq 0 ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
for MIDIPIX_PATH in ${MIDIPIX_PATH_DEFAULTS}; do
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
	[ -d /cygdrive${MIDIPIX_PATH} ] || continue;
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
	MIDIPIX_DRIVE=${MIDIPIX_PATH#/};
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
	MIDIPIX_DRIVE=${MIDIPIX_DRIVE%%/*};
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
	MIDIPIX_PNAME=${MIDIPIX_PATH#/${MIDIPIX_DRIVE}};
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
	MIDIPIX_PNAME=${MIDIPIX_PNAME#/};
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
	break;
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
done;
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
else
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
	MIDIPIX_DRIVE="${1}"; MIDIPIX_PNAME="${2}";
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
	if [ "${MIDIPIX_DRIVE#*[ 	]*}" != "${MIDIPIX_DRIVE}" ]\
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
	|| [ "${MIDIPIX_PNAME#*[ 	]*}" != "${MIDIPIX_PNAME}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
		echo "Error: drive_letter/dirname must not contain SP (\` ') or VT (\`\\\t') characters.";
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
		exit 1;
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
MIDIPIX_PATH=/${MIDIPIX_DRIVE}${MIDIPIX_PNAME:+/${MIDIPIX_PNAME}};
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
if [ ! -d /cygdrive${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) 92d6c5
	exit 1;
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
else
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
	if [ -f /cygdrive${MIDIPIX_PATH}/bin/libpsxscl.log ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
		echo Found libpsxscl.log, copying to /cygdrive${MIDIPIX_PATH}/bin/libpsxscl.last.
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
		cp /cygdrive${MIDIPIX_PATH}/bin/libpsxscl.log	\
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
			/cygdrive${MIDIPIX_PATH}/bin/libpsxscl.last;
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
	echo "Midipix drive letter.....: ${MIDIPIX_DRIVE}";
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
	echo "Midipix pathname.........: ${MIDIPIX_PNAME}";
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
	echo "Absolute Midipix pathname: ${MIDIPIX_PATH}";
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
	echo --------------------------------------------------------
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
	echo WARNING: The cygdrive path prefix will be changed to /
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
	echo whilst the Midipix shell window is running. It will be
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
	echo reset to its original value of /cygdrive after it exits.
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
	echo --------------------------------------------------------
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
	mintty -h always -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) 92d6c5
		mount --change-cygdrive-prefix /;
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
		cd ${MIDIPIX_PATH}/native/bin;
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
		export PATH=${MIDIPIX_PATH}/native/bin:${MIDIPIX_PATH}/native/lib;
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
		./ntctty.exe -e chroot //${MIDIPIX_PATH#/}/native /bin/bash";
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
	echo --------------------------------------------------------
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
	echo Resetting cygdrive path prefix to /.
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
	echo --------------------------------------------------------
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
	mount --change-cygdrive-prefix /cygdrive;
Lucio Andrés Illanes Albornoz (arab, vxp) 92d6c5
fi;