"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/bin/apm" (8 Feb 2018, 1457 Bytes) of package /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/bash
    2 
    3 set -e
    4 
    5 initialCwd=`pwd -P`
    6 scriptDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
    7 
    8 apmPath=$0
    9 builtin cd "`dirname "$apmPath"`"
   10 binDir=`basename "$apmPath"`
   11 
   12 # Detect node binary name
   13 osName=`uname -s`
   14 if [ "${osName:0:10}" == 'MINGW32_NT' ]; then
   15   nodeBin="node.exe"
   16 elif [[ $(uname -r) == *-Microsoft ]]; then
   17   nodeBin="node.exe"
   18 else
   19   nodeBin="node"
   20 fi
   21 
   22 while [ -L "$binDir" ]
   23 do
   24   binDir=`readlink "$binDir"`
   25   builtin cd "`dirname "$binDir"`"
   26   binDir=`basename "$binDir"`
   27 done
   28 
   29 binDir=`pwd -P`
   30 
   31 maybe_node_gyp_path="$binDir"/../node_modules/.bin/node-gyp
   32 if [ -e "$maybe_node_gyp_path" ]
   33 then
   34   # Prevent vars like NODE_CONFIG_NODE_GYP from messing this up
   35   for var in $(env | grep -i ^npm_config_node_gyp=)
   36   do
   37     unset ${var%%=*}
   38   done
   39 
   40   export npm_config_node_gyp="$maybe_node_gyp_path"
   41 fi
   42 
   43 export ATOM_APM_ORIGINAL_PYTHON="${PYTHON:-}"
   44 
   45 # Assumption: env iterates through environment variables in the same order that
   46 # process.env iterates through properties within npm. So, we take the last match.
   47 for var in $(env | grep -i ^npm_config_python=)
   48 do
   49   ATOM_APM_ORIGINAL_PYTHON="${var#*=}"
   50   unset ${var%%=*}
   51 done
   52 
   53 export npm_config_python="${binDir}/python-interceptor.sh"
   54 
   55 cliPath="$binDir/../lib/cli.js"
   56 if [[ $(uname -r) == *-Microsoft ]]; then
   57   cliPath="$(echo $cliPath | sed 's/\/mnt\/\([a-z]*\)\(.*\)/\1:\2/')"
   58   cliPath="${cliPath////\\}"
   59 else
   60   builtin cd "$initialCwd"
   61 fi
   62 
   63 "$binDir/$nodeBin" "$cliPath" "$@"