From 92d6c53da043091982045518c738625116aece0c Mon Sep 17 00:00:00 2001 From: Lucio Andrés Illanes Albornoz (arab, vxp) Date: May 26 2016 12:50:06 +0000 Subject: Copy `midipix.sh' and `Create `Midipix mintty shell' shortcut.vbs' into $PREFIX. --- diff --git a/399.midipix_sh.build b/399.midipix_sh.build index 3bd0413..b2f4fcc 100644 --- a/399.midipix_sh.build +++ b/399.midipix_sh.build @@ -3,61 +3,10 @@ # if ! is_build_script_done install; then - IFS=""; cat < ${PREFIX}/midipix.sh; -#!/bin/sh -# -MIDIPIX_PATH_DEFAULTS="/c/Midipix /z"; - -if [ "\${1}" = -h ]; then - echo "usage: \$0 [drive_letter [dirname]]"; - exit 1; -elif [ \${#} -eq 0 ]; then -for MIDIPIX_PATH in \${MIDIPIX_PATH_DEFAULTS}; do - [ -d /cygdrive\${MIDIPIX_PATH} ] || continue; - MIDIPIX_DRIVE=\${MIDIPIX_PATH#/}; - MIDIPIX_DRIVE=\${MIDIPIX_DRIVE%%/*}; - MIDIPIX_PNAME=\${MIDIPIX_PATH#/\${MIDIPIX_DRIVE}}; - MIDIPIX_PNAME=\${MIDIPIX_PNAME#/}; - break; -done; -else - MIDIPIX_DRIVE="\${1}"; MIDIPIX_PNAME="\${2}"; - if [ "\${MIDIPIX_DRIVE#*[ ]*}" != "\${MIDIPIX_DRIVE}" ]\\ - || [ "\${MIDIPIX_PNAME#*[ ]*}" != "\${MIDIPIX_PNAME}" ]; then - echo "Error: drive_letter/dirname must not contain SP (\\\` ') or VT (\\\`\\\\\t') characters."; - exit 1; - fi; -fi; -MIDIPIX_PATH=/\${MIDIPIX_DRIVE}\${MIDIPIX_PNAME:+/\${MIDIPIX_PNAME}}; -if [ ! -d /cygdrive\${MIDIPIX_PATH} ]; then - echo "Error: Midipix path non-existent or invalid (\\\`\${MIDIPIX_PATH}'.)"; - exit 1; -else - if [ -f /cygdrive\${MIDIPIX_PATH}/bin/libpsxscl.log ]; then - echo Found libpsxscl.log, copying to /cygdrive\${MIDIPIX_PATH}/bin/libpsxscl.last. - cp /cygdrive\${MIDIPIX_PATH}/bin/libpsxscl.log \\ - /cygdrive\${MIDIPIX_PATH}/bin/libpsxscl.last; - fi; - echo "Midipix drive letter.....: \${MIDIPIX_DRIVE}"; - echo "Midipix pathname.........: \${MIDIPIX_PNAME}"; - echo "Absolute Midipix pathname: \${MIDIPIX_PATH}"; - echo -------------------------------------------------------- - echo WARNING: The cygdrive path prefix will be changed to / - echo whilst the Midipix shell window is running. It will be - echo reset to its original value of /cygdrive after it exits. - echo -------------------------------------------------------- - mintty -h always -e /bin/sh -c " - set -o errexit; stty raw -echo; - mount --change-cygdrive-prefix /; - cd \${MIDIPIX_PATH}/native/bin; - export PATH=\${MIDIPIX_PATH}/native/bin:\${MIDIPIX_PATH}/native/lib; - ./ntctty.exe -e chroot //\${MIDIPIX_PATH#/}/native /bin/bash"; - echo -------------------------------------------------------- - echo Resetting cygdrive path prefix to /. - echo -------------------------------------------------------- - mount --change-cygdrive-prefix /cygdrive; -fi; -EOF + (cd ${MIDIPIX_BUILD_PWD}; + tar -cpf - midipix.sh \ + 'Create `Midipix mintty shell'\'' shortcut.vbs' |\ + tar -C ${PREFIX} -xpf -); chmod +x ${PREFIX}/midipix.sh; set_build_script_done install finish; fi; diff --git a/Create `Midipix mintty shell' shortcut.vbs b/Create `Midipix mintty shell' shortcut.vbs new file mode 100644 index 0000000..ab0d3bb --- /dev/null +++ b/Create `Midipix mintty shell' shortcut.vbs @@ -0,0 +1,18 @@ +Set WshShell = CreateObject("WScript.Shell") +LinkPath = WshShell.CurrentDirectory + "\Midipix mintty shell.lnk" +If WScript.Arguments.Count = 0 Then + MinttyPath = "C:\cygwin64\bin\mintty.exe" +Else + MinttyPath = WScript.Arguments(0) +End If + +Set fso = CreateObject("Scripting.FileSystemObject") +If not (fso.FileExists(LinkPath)) Then + Set oMyShortCut = WshShell.CreateShortcut(LinkPath) + oMyShortCut.WindowStyle = 4 + oMyShortcut.IconLocation = MinttyPath + oMyShortCut.TargetPath = MinttyPath + oMyShortCut.Arguments = "-i /Cygwin-Terminal.ico -e sh midipix.sh" + oMyShortCut.WorkingDirectory = WshShell.CurrentDirectory + oMyShortCut.Save +End If diff --git a/build.sh b/build.sh index 09bba16..b8353ad 100755 --- a/build.sh +++ b/build.sh @@ -64,11 +64,11 @@ for BUILD_LVL in 0 1 2 3; do SCRIPT_FNAME=${BUILD_SCRIPT_FNAME}; \ SCRIPT_NAME=${SCRIPT_FNAME%%.build*}; \ export PREFIX_LVL="$(eval echo \${PREFIX_LVL${BUILD_LVL}})"; \ - _PWD=$(pwd); cd ${WORKDIR}; \ + export MIDIPIX_BUILD_PWD=$(pwd); cd ${WORKDIR}; \ for SCRIPT_SOURCE in build.subr ${SCRIPT_NAME}.vars \ ${BUILD_SCRIPT_FNAME}; do \ - [ -f ${_PWD}/${SCRIPT_SOURCE} ] && \ - . ${_PWD}/${SCRIPT_SOURCE}; \ + [ -f ${MIDIPIX_BUILD_PWD}/${SCRIPT_SOURCE} ] && \ + . ${MIDIPIX_BUILD_PWD}/${SCRIPT_SOURCE}; \ done); case ${BUILD_SCRIPT_RC:=${?}} in 0) log_msg succ "Finished build script \`${BUILD_SCRIPT_FNAME}'."; diff --git a/midipix.sh b/midipix.sh new file mode 100755 index 0000000..b6b8409 --- /dev/null +++ b/midipix.sh @@ -0,0 +1,53 @@ +#!/bin/sh +# +MIDIPIX_PATH_DEFAULTS="/c/Midipix /z"; + +if [ "${1}" = -h ]; then + echo "usage: $0 [drive_letter [dirname]]"; + exit 1; +elif [ ${#} -eq 0 ]; then +for MIDIPIX_PATH in ${MIDIPIX_PATH_DEFAULTS}; do + [ -d /cygdrive${MIDIPIX_PATH} ] || continue; + MIDIPIX_DRIVE=${MIDIPIX_PATH#/}; + MIDIPIX_DRIVE=${MIDIPIX_DRIVE%%/*}; + MIDIPIX_PNAME=${MIDIPIX_PATH#/${MIDIPIX_DRIVE}}; + MIDIPIX_PNAME=${MIDIPIX_PNAME#/}; + break; +done; +else + MIDIPIX_DRIVE="${1}"; MIDIPIX_PNAME="${2}"; + if [ "${MIDIPIX_DRIVE#*[ ]*}" != "${MIDIPIX_DRIVE}" ]\ + || [ "${MIDIPIX_PNAME#*[ ]*}" != "${MIDIPIX_PNAME}" ]; then + echo "Error: drive_letter/dirname must not contain SP (\` ') or VT (\`\\\t') characters."; + exit 1; + fi; +fi; +MIDIPIX_PATH=/${MIDIPIX_DRIVE}${MIDIPIX_PNAME:+/${MIDIPIX_PNAME}}; +if [ ! -d /cygdrive${MIDIPIX_PATH} ]; then + echo "Error: Midipix path non-existent or invalid (\`${MIDIPIX_PATH}'.)"; + exit 1; +else + if [ -f /cygdrive${MIDIPIX_PATH}/bin/libpsxscl.log ]; then + echo Found libpsxscl.log, copying to /cygdrive${MIDIPIX_PATH}/bin/libpsxscl.last. + cp /cygdrive${MIDIPIX_PATH}/bin/libpsxscl.log \ + /cygdrive${MIDIPIX_PATH}/bin/libpsxscl.last; + fi; + echo "Midipix drive letter.....: ${MIDIPIX_DRIVE}"; + echo "Midipix pathname.........: ${MIDIPIX_PNAME}"; + echo "Absolute Midipix pathname: ${MIDIPIX_PATH}"; + echo -------------------------------------------------------- + echo WARNING: The cygdrive path prefix will be changed to / + echo whilst the Midipix shell window is running. It will be + echo reset to its original value of /cygdrive after it exits. + echo -------------------------------------------------------- + mintty -h always -e /bin/sh -c " + set -o errexit; stty raw -echo; + mount --change-cygdrive-prefix /; + cd ${MIDIPIX_PATH}/native/bin; + export PATH=${MIDIPIX_PATH}/native/bin:${MIDIPIX_PATH}/native/lib; + ./ntctty.exe -e chroot //${MIDIPIX_PATH#/}/native /bin/bash"; + echo -------------------------------------------------------- + echo Resetting cygdrive path prefix to /. + echo -------------------------------------------------------- + mount --change-cygdrive-prefix /cygdrive; +fi;