Blame 399.midipix_sh.build

Lucio Andrés Illanes Albornoz (arab, vxp) 92254a
#
Lucio Andrés Illanes Albornoz (arab, vxp) 92254a
# . ./build.vars and set -o errexit are assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) 92254a
#
Lucio Andrés Illanes Albornoz (arab, vxp) 92254a
Lucio Andrés Illanes Albornoz (arab, vxp) 92254a
if ! is_build_script_done install; then
Lucio Andrés Illanes Albornoz (arab, vxp) 92254a
	IFS=""; cat <<EOF > ${PREFIX}/midipix.sh;
Lucio Andrés Illanes Albornoz (arab, vxp) 92254a
#!/bin/sh
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
#
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
MIDIPIX_PATH_DEFAULTS="/c/Midipix /z";
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
if [ "\${1}" = -h ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
        echo "usage: \$0 [drive_letter [dirname]]";
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
        exit 1;
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
elif [ \${#} -eq 0 ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
for MIDIPIX_PATH in \${MIDIPIX_PATH_DEFAULTS}; do
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
	[ -d /cygdrive\${MIDIPIX_PATH} ] || continue;
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
	MIDIPIX_DRIVE=\${MIDIPIX_PATH#/};
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
	MIDIPIX_DRIVE=\${MIDIPIX_DRIVE%%/*};
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
	MIDIPIX_PNAME=\${MIDIPIX_PATH#/\${MIDIPIX_DRIVE}};
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
	MIDIPIX_PNAME=\${MIDIPIX_PNAME#/};
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
	break;
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
done;
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
else
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
	MIDIPIX_DRIVE="\${1}"; MIDIPIX_PNAME="\${2}";
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
	if [ "\${MIDIPIX_DRIVE#*[ 	]*}" != "\${MIDIPIX_DRIVE}" ]\\
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
	|| [ "\${MIDIPIX_PNAME#*[ 	]*}" != "\${MIDIPIX_PNAME}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
		echo "Error: drive_letter/dirname must not contain SP (\\\` ') or VT (\\\`\\\\\t') characters.";
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
		exit 1;
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
MIDIPIX_PATH=/\${MIDIPIX_DRIVE}\${MIDIPIX_PNAME:+/\${MIDIPIX_PNAME}};
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
if [ ! -d /cygdrive\${MIDIPIX_PATH} ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
	echo "Error: Midipix path non-existent or invalid (\\\`\${MIDIPIX_PATH}'.)";
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
	exit 1;
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
else
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
	echo "Midipix drive letter.....: \${MIDIPIX_DRIVE}";
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
	echo "Midipix pathname.........: \${MIDIPIX_PNAME}";
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
	echo "Absolute Midipix pathname: \${MIDIPIX_PATH}";
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
	echo --------------------------------------------------------
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
	echo WARNING: The cygdrive path prefix will be changed to /
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
	echo whilst the Midipix shell window is running. It will be
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
	echo reset to its original value of /cygdrive after it exits.
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
	echo --------------------------------------------------------
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
	mintty -h always -e /bin/sh -c "
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
		set -o errexit; stty raw -echo;
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
		mount --change-cygdrive-prefix /;
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
		cd \${MIDIPIX_PATH}/native/bin;
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
		export PATH=\${MIDIPIX_PATH}/native/bin:\${MIDIPIX_PATH}/native/lib;
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
		./ntctty.exe -e chroot //\${MIDIPIX_PATH#/}/native /bin/bash";
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
	echo --------------------------------------------------------
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
	echo Resetting cygdrive path prefix to /.
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
	echo --------------------------------------------------------
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
	mount --change-cygdrive-prefix /cygdrive;
Lucio Andrés Illanes Albornoz (arab, vxp) 960d2e
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 92254a
EOF
Lucio Andrés Illanes Albornoz (arab, vxp) 92254a
	chmod +x ${PREFIX}/midipix.sh;
Lucio Andrés Illanes Albornoz (arab, vxp) 92254a
	set_build_script_done install finish;
Lucio Andrés Illanes Albornoz (arab, vxp) 92254a
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 92254a
Lucio Andrés Illanes Albornoz (arab, vxp) 92254a
# vim:filetype=sh