From ab7c656cf51d06da88cbe36523461693edbe7f8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=9F=E9=85=8C=20=E9=B5=AC=E5=85=84?= Date: Tue, 30 Aug 2022 17:56:49 +0900 Subject: [PATCH] Auto select node & nmap --- bash/sources/23_win-binaries | 43 ++++++++++++++++++++++++++++++++++++ bash/sources/23_win-vsenv | 33 --------------------------- 2 files changed, 43 insertions(+), 33 deletions(-) create mode 100755 bash/sources/23_win-binaries delete mode 100755 bash/sources/23_win-vsenv diff --git a/bash/sources/23_win-binaries b/bash/sources/23_win-binaries new file mode 100755 index 0000000..78ff83d --- /dev/null +++ b/bash/sources/23_win-binaries @@ -0,0 +1,43 @@ +#!/bin/bash + +for i in $( find /opt/ -maxdepth 1 -name node-v\*-win-x64 -type d ); do + echo " Selected node binary @$i" + export PATH=$PATH:"$i" + break +done + +for i in $( find /opt/ -maxdepth 1 -name nmap-\* -type d ); do + echo " Selected nmap binary @$i" + export PATH=$PATH:"$i" + break +done + +if [ -n "$FrameworkVersion" ]; then + alias vsshell='echo "FrameworkVersion $FrameworkVersion"' + return +fi + +BAT_DIR=~/.local/lib/bat +mkdir -p $BAT_DIR + +VS_SHELL_BAT=$BAT_DIR/vs-env.bat + +function vsshell { + _SHELL=$( cygpath -w -a $VS_SHELL_BAT ) + cmd /c "$_SHELL" + exit +} + +if [ -f "$VS_SHELL_BAT" ]; then + _PATH=$( cygpath "$( grep -o "^@REM FILE_PATH: .\+" "$VS_SHELL_BAT" | cut -c 17- )" ) + if [ ! -f "$_PATH" ]; then + START_MENU="$( cygpath $ProgramData )/Microsoft/Windows/Start Menu/" + + _PATH=$( find "$START_MENU" -name "*Command Prompt*" | grep "Visual Studio" | grep x64 | grep Native | xargs -I % readshortcut % -r | grep -o "\"\([^\"]\+\)\"" ) + + echo "@echo off" > "$VS_SHELL_BAT" + echo "@REM FILE_PATH: ${_PATH:1:-1}" >> "$VS_SHELL_BAT" + echo "CALL $_PATH" >> "$VS_SHELL_BAT" + echo "START $( where mintty ) -i /Cygwin-Terminal.ico -" >> "$VS_SHELL_BAT" + fi +fi diff --git a/bash/sources/23_win-vsenv b/bash/sources/23_win-vsenv deleted file mode 100755 index 7aea5eb..0000000 --- a/bash/sources/23_win-vsenv +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -if [ -n "$FrameworkVersion" ]; then - alias vsshell='echo "FrameworkVersion $FrameworkVersion"' - return -fi - -BAT_DIR=~/.local/lib/bat -mkdir -p $BAT_DIR - -VS_SHELL_BAT=$BAT_DIR/vs-env.bat - -function vsshell { - _SHELL=$( cygpath -w -a $VS_SHELL_BAT ) - cmd /c "$_SHELL" - exit -} - -if [ -f "$VS_SHELL_BAT" ]; then - _PATH=$( cygpath "$( grep -o "^@REM FILE_PATH: .\+" "$VS_SHELL_BAT" | cut -c 17- )" ) - if [ -f "$_PATH" ]; then - return - fi -fi - -START_MENU="$( cygpath $ProgramData )/Microsoft/Windows/Start Menu/" - -_PATH=$( find "$START_MENU" -name "*Command Prompt*" | grep "Visual Studio" | grep x64 | grep Native | xargs -I % readshortcut % -r | grep -o "\"\([^\"]\+\)\"" ) - -echo "@echo off" > "$VS_SHELL_BAT" -echo "@REM FILE_PATH: ${_PATH:1:-1}" >> "$VS_SHELL_BAT" -echo "CALL $_PATH" >> "$VS_SHELL_BAT" -echo "START $( where mintty ) -i /Cygwin-Terminal.ico -" >> "$VS_SHELL_BAT"