Skip to content

Commit

Permalink
env, path, service dot files casing (microsoft#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanmacfarlane authored Jun 12, 2016
1 parent 9e3226e commit 1c3de09
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/Misc/layoutbin/darwin.svc.sh.template
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ LAUNCH_PATH="${HOME}/Library/LaunchAgents"
PLIST_PATH="${LAUNCH_PATH}/${SVC_NAME}.plist"
TEMPLATE_PATH=./bin/vsts.agent.plist.template
TEMP_PATH=./bin/vsts.agent.plist.temp
CONFIG_PATH=.Service
CONFIG_PATH=.service

function failed()
{
Expand Down
10 changes: 5 additions & 5 deletions src/Misc/layoutbin/runsvc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
# for more info on how to propagate SIGTERM to a child process see: http://veithen.github.io/2014/11/16/sigterm-propagation.html
trap 'kill -INT $PID' TERM INT

if [ -f ".Env" ]; then
export $(cat .Env)
if [ -f ".env" ]; then
export $(cat .env)
fi

if [ -f ".Path" ]; then
if [ -f ".path" ]; then
# configure
export PATH=`cat .Path`
echo ".Path=${PATH}"
export PATH=`cat .path`
echo ".path=${PATH}"
fi

# insert anything to setup env when running as a service
Expand Down
2 changes: 1 addition & 1 deletion src/Misc/layoutbin/systemd.svc.sh.template
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ AGENT_ROOT=`pwd`
UNIT_PATH=/etc/systemd/system/${SVC_NAME}
TEMPLATE_PATH=./bin/vsts.agent.service.template
TEMP_PATH=./bin/vsts.agent.service.temp
CONFIG_PATH=.Service
CONFIG_PATH=.service

user_id=`id -u`

Expand Down
22 changes: 16 additions & 6 deletions src/Misc/layoutroot/env.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
#!/bin/bash

varCheckList=('LANG' 'JAVA_HOME' 'ANT_HOME' 'M2_HOME' 'ANDROID_HOME' 'GRADLE_HOME')
varCheckList=(
'LANG'
'JAVA_HOME'
'ANT_HOME'
'M2_HOME'
'ANDROID_HOME'
'GRADLE_HOME'
'NVM_BIN'
'NVM_PATH'
)

envContents=""

if [ -f ".Env" ]; then
envContents=`cat .Env`
if [ -f ".env" ]; then
envContents=`cat .env`
else
touch .Env
touch .env
fi

function writeVar()
Expand All @@ -16,12 +26,12 @@ function writeVar()
if test "${envContents#*$checkDelim}" = "$envContents"
then
if [ ! -z "${!checkVar}" ]; then
echo "${checkVar}=${!checkVar}">>.Env
echo "${checkVar}=${!checkVar}">>.env
fi
fi
}

echo $PATH>.Path
echo $PATH>.path

for var_name in ${varCheckList[@]}
do
Expand Down

0 comments on commit 1c3de09

Please sign in to comment.