Skip to content
This repository
Browse code

Merge pull request #70 from jvliwanag/hooksfix

Support running hooks.sh from non-base dir
  • Loading branch information...
commit 12d6437b00ba03a154822f04d50c5d1dc1236327 2 parents 52ac4bf + f17a945
Micah lordnull authored

Showing 1 changed file with 26 additions and 19 deletions. Show diff stats Hide diff stats

  1. +26 19 hooks.sh
45 hooks.sh
... ... @@ -1,13 +1,15 @@
1   -#! /usr/bin/env bash
  1 +#!/usr/bin/env bash
2 2
3   -function do_included_apps {
4   - initDir=`pwd`
5   - for file in include_apps/*
  3 +BASEDIR="$( cd "$( dirname "$0" )" && pwd)"
  4 +REBAR="$BASEDIR/rebar"
  5 +
  6 +function do_included_apps {
  7 + for file in "$BASEDIR"/include_apps/*
6 8 do
7 9 echo "das file: $file"
8   - cd $file
9   - ../../rebar $1
10   - cd $initDir
  10 + cd "$file"
  11 + $REBAR "$1"
  12 + cd "$BASEDIR"
11 13 done
12 14 }
13 15
@@ -16,11 +18,13 @@ function post_compile {
16 18 }
17 19
18 20 function pre_compile {
19   - if [ ! -d ebin ]; then
20   - mkdir ebin
  21 + ebinDir="$BASEDIR/ebin"
  22 +
  23 + if [ ! -d "$ebinDir" ]; then
  24 + mkdir "$ebinDir"
21 25 fi
22 26
23   - for file in proto_src/*.proto
  27 + for file in "$BASEDIR"/proto_src/*.proto
24 28 do
25 29 nameBase=`echo "$file" | sed -e "s/^proto_src\///"`
26 30 nameBase="src/${nameBase}"
@@ -33,13 +37,14 @@ function pre_compile {
33 37 # hack for include_apps
34 38
35 39 # hack for reltool
36   - if [ ! -d OpenACD ]; then
37   - mkdir OpenACD
38   - ln -sf ../ebin OpenACD/ebin
39   - ln -sf ../src OpenACD/src
40   - ln -sf ../include OpenACD/include
41   - ln -sf ../priv OpenACD/priv
42   - ln -sf ../deps OpenACD/deps
  40 + oaDir="$BASEDIR/OpenACD"
  41 + if [ ! -d "$oaDir" ]; then
  42 + mkdir "$oaDir"
  43 + ln -sf ../ebin "$oaDir"/ebin
  44 + ln -sf ../src "$oaDir"/src
  45 + ln -sf ../include "$oaDir"/include
  46 + ln -sf ../priv "$oaDir"/priv
  47 + ln -sf ../deps "$oaDir"/deps
43 48 fi
44 49
45 50 # record what commit/version openacd is at
@@ -68,7 +73,9 @@ function pre_compile {
68 73 function pre_get-deps {
69 74 if [ "${GIT_UPDATE_DISABLED}" != "1" ]; then
70 75 echo "Updating submodules..."
  76 + cd "$BASEDIR"
71 77 git submodule init && git submodule update
  78 + cd -
72 79 fi
73 80 }
74 81
@@ -77,14 +84,14 @@ function post_get-deps {
77 84 }
78 85
79 86 function pre_clean {
80   - rm -rf "OpenACD"
  87 + rm -rf "$BASEDIR/OpenACD"
81 88 }
82 89
83 90 function post_clean {
84 91 do_included_apps clean
85 92 }
86 93
87   -case $1 in
  94 +case "$1" in
88 95 "pre_get-deps")
89 96 pre_get-deps;;
90 97 "post_get-deps")

0 comments on commit 12d6437

Please sign in to comment.
Something went wrong with that request. Please try again.