Skip to content
This repository

FreeBSD support #11

Closed
wants to merge 4 commits into from

1 participant

Matthew Batema
Matthew Batema

FreeBSD does not have bash in its base install, nor when installed, is bash found in /bin. I converted the bash scripts to bourne shell (/bin/sh) scripts of (I hope) equal functionality. Additionally, procfs is not guaranteed to exist, so I changed "ps -ef" to "ps -x" and the awk on the PID accordingly. Tested on OS X, FreeBSD 8.1, and CentOS.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
10 rel/overlay/bin/dev
... ... @@ -1,4 +1,4 @@
1   -#!/bin/bash
  1 +#!/bin/sh
2 2
3 3 RUNNER_SCRIPT_DIR=$(cd ${0%/*} && pwd)
4 4
@@ -16,20 +16,20 @@ fi
16 16 cd $RUNNER_BASE_DIR
17 17
18 18 # Extract the target node name from node.args
19   -NAME_ARG=`grep -e '-[s]*name' $RUNNER_ETC_DIR/vm.args`
  19 +NAME_ARG=`grep -e '-[s]\?name' $RUNNER_ETC_DIR/vm.args`
20 20 if [ -z "$NAME_ARG" ]; then
21 21 echo "vm.args needs to have either -name or -sname parameter."
22 22 exit 1
23 23 fi
24 24
25 25 # Learn how to specify node name for connection from remote nodes
26   -if [[ "$NAME_ARG" =~ ^-sname ]]; then
  26 +if [ "$NAME_ARG" = "${NAME_ARG#"-sname"}" ]; then
27 27 NAME_PARAM="-sname"
28 28 NAME_HOST=""
29 29 else
30 30 NAME_PARAM="-name"
31   - if [[ "$NAME_ARG" =~ (@.*) ]]; then
32   - NAME_HOST=${BASH_REMATCH[1]}
  31 + if [ "$NAME_ARG" = "${NAME_ARG#"*@"}" ]; then
  32 + NAME_HOST="@"${NAME_ARG#"*@"}
33 33 else
34 34 NAME_HOST=""
35 35 fi
10 rel/overlay/bin/nitrogen
... ... @@ -1,4 +1,4 @@
1   -#!/bin/bash
  1 +#!/bin/sh
2 2
3 3 RUNNER_SCRIPT_DIR=$(cd ${0%/*} && pwd)
4 4
@@ -20,7 +20,7 @@ cd $RUNNER_BASE_DIR
20 20 mkdir -p $RUNNER_LOG_DIR
21 21
22 22 # Extract the target node name from node.args
23   -NAME_ARG=`grep -e '-[s]*name' $RUNNER_ETC_DIR/vm.args`
  23 +NAME_ARG=`grep -e '-[s]\?name' $RUNNER_ETC_DIR/vm.args`
24 24 if [ -z "$NAME_ARG" ]; then
25 25 echo "vm.args needs to have either -name or -sname parameter."
26 26 exit 1
@@ -52,7 +52,7 @@ case "$1" in
52 52 start)
53 53 # Make sure there is not already a node running
54 54 RES=`$NODETOOL ping`
55   - if [ "$RES" == "pong" ]; then
  55 + if [ "$RES" = "pong" ]; then
56 56 echo "Node is already running!"
57 57 exit 1
58 58 fi
@@ -63,7 +63,7 @@ case "$1" in
63 63
64 64 stop)
65 65 # Wait for the node to completely stop...
66   - PID=`ps -ef|grep "$RUNNER_BASE_DIR/.*/[b]eam.smp|awk '{print $2}'"`
  66 + PID=`ps x|grep "$RUNNER_BASE_DIR/.*/[b]eam.smp|awk '{print $1}'"`
67 67 $NODETOOL stop
68 68 while `kill -0 $PID 2>/dev/null`;
69 69 do
@@ -100,7 +100,7 @@ case "$1" in
100 100
101 101 console)
102 102 RES=`$NODETOOL ping`
103   - if [ "$RES" == "pong" ]; then
  103 + if [ "$RES" = "pong" ]; then
104 104 echo "Node is already running - use '$SCRIPT attach' instead"
105 105 exit 1
106 106 fi
4 rel/overlay/erts-vsn/bin/erl
... ... @@ -1,4 +1,4 @@
1   -#!/bin/bash
  1 +#!/bin/sh
2 2
3 3 ## This script replaces the default "erl" in erts-VSN/bin. This is necessary
4 4 ## as escript depends on erl and in turn, erl depends on having access to a
@@ -31,4 +31,4 @@ export ROOTDIR
31 31 export BINDIR
32 32 export PROGNAME
33 33
34   -exec $CMD -boot $ROOTDIR/releases/$APP_VSN/start_clean ${1+"$@"}
  34 +exec $CMD -boot $ROOTDIR/releases/$APP_VSN/start_clean ${1+"$@"}
10 rel/overlay_dependent/bin/nitrogen
... ... @@ -1,4 +1,4 @@
1   -#!/bin/bash
  1 +#!/bin/sh
2 2
3 3 RUNNER_SCRIPT_DIR=$(cd ${0%/*} && pwd)
4 4
@@ -20,7 +20,7 @@ cd $RUNNER_BASE_DIR
20 20 mkdir -p $RUNNER_LOG_DIR
21 21
22 22 # Extract the target node name from node.args
23   -NAME_ARG=`grep -e '-[s]*name' $RUNNER_ETC_DIR/vm.args`
  23 +NAME_ARG=`grep -e '-[s]\?name' $RUNNER_ETC_DIR/vm.args`
24 24 if [ -z "$NAME_ARG" ]; then
25 25 echo "vm.args needs to have either -name or -sname parameter."
26 26 exit 1
@@ -51,7 +51,7 @@ case "$1" in
51 51 start)
52 52 # Make sure there is not already a node running
53 53 RES=`$NODETOOL ping`
54   - if [ "$RES" == "pong" ]; then
  54 + if [ "$RES" = "pong" ]; then
55 55 echo "Node is already running!"
56 56 exit 1
57 57 fi
@@ -62,7 +62,7 @@ case "$1" in
62 62
63 63 stop)
64 64 # Wait for the node to completely stop...
65   - PID=`ps -ef|grep "$RUNNER_BASE_DIR/.*/[b]eam.smp|awk '{print $2}'"`
  65 + PID=`ps x|grep "$RUNNER_BASE_DIR/.*/[b]eam.smp|awk '{print $1}'"`
66 66 $NODETOOL stop
67 67 while `kill -0 $PID 2>/dev/null`;
68 68 do
@@ -99,7 +99,7 @@ case "$1" in
99 99
100 100 console)
101 101 RES=`$NODETOOL ping`
102   - if [ "$RES" == "pong" ]; then
  102 + if [ "$RES" = "pong" ]; then
103 103 echo "Node is already running - use '$SCRIPT attach' instead"
104 104 exit 1
105 105 fi

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.