summaryrefslogtreecommitdiff
path: root/priv/templates
diff options
context:
space:
mode:
Diffstat (limited to 'priv/templates')
-rw-r--r--priv/templates/simplelib.app.src14
-rw-r--r--priv/templates/simplelib.erl18
-rw-r--r--priv/templates/simplelib.template3
-rwxr-xr-xpriv/templates/simplenode.runner33
4 files changed, 65 insertions, 3 deletions
diff --git a/priv/templates/simplelib.app.src b/priv/templates/simplelib.app.src
new file mode 100644
index 0000000..752665a
--- /dev/null
+++ b/priv/templates/simplelib.app.src
@@ -0,0 +1,14 @@
+{application, {{libid}},
+ [
+ {description, "An Erlang {{libid}} library"},
+ {vsn, "1"},
+ {modules, [
+ {{libid}}
+ ]},
+ {registered, []},
+ {applications, [
+ kernel,
+ stdlib
+ ]},
+ {env, []}
+ ]}.
diff --git a/priv/templates/simplelib.erl b/priv/templates/simplelib.erl
new file mode 100644
index 0000000..2c4451f
--- /dev/null
+++ b/priv/templates/simplelib.erl
@@ -0,0 +1,18 @@
+-module({{libid}}).
+
+%% {{libid}}: {{libid}} library's entry point.
+
+-export([my_func/0]).
+
+
+%% API
+
+my_func() ->
+ ok().
+
+%% Internals
+
+ok() ->
+ ok.
+
+%% End of Module.
diff --git a/priv/templates/simplelib.template b/priv/templates/simplelib.template
new file mode 100644
index 0000000..59d20fa
--- /dev/null
+++ b/priv/templates/simplelib.template
@@ -0,0 +1,3 @@
+{variables, [{libid, "mylib"}]}.
+{template, "simplelib.app.src", "src/{{libid}}.app.src"}.
+{template, "simplelib.erl", "src/{{libid}}.erl"}.
diff --git a/priv/templates/simplenode.runner b/priv/templates/simplenode.runner
index c2ef258..032eb28 100755
--- a/priv/templates/simplenode.runner
+++ b/priv/templates/simplenode.runner
@@ -16,6 +16,7 @@ fi
unset POSIX_SHELL
RUNNER_SCRIPT_DIR=$(cd ${0%/*} && pwd -P)
+RUNNER_SCRIPT=${0##*/}
CALLER_DIR=$PWD
@@ -85,10 +86,36 @@ fi
REMSH_TYPE=`echo $NAME_ARG | awk '{print $1}'`
REMSH_NAME=`echo $NAME_ARG | awk '{print $2}'`
+# Test if REMSH_NAME contains a @ and set REMSH_HOSTNAME_PART
+# and REMSH_NAME_PART according REMSH_TYPE
+MAYBE_FQDN_HOSTNAME=`hostname`
+HOSTNAME=`echo $MAYBE_FQDN_HOSTNAME | awk -F. '{print $1}'`
+
+REMSH_HOSTNAME_PART="$MAYBE_FQDN_HOSTNAME"
+case "$REMSH_NAME" in
+ *@*)
+ REMSH_HOSTNAME_PART=`echo $REMSH_NAME | awk -F@ '{print $2}'`
+ REMSH_NAME_PART=`echo $REMSH_NAME | awk -F@ '{print $1}'`
+ ;;
+ *)
+ REMSH_NAME_PART="$REMSH_NAME"
+ if [ "$REMSH_TYPE" = "-sname" ]; then
+ REMSH_HOSTNAME_PART= "$HOSTNAME"
+ else
+ # -name type, check if `hostname` is fqdn
+ if [ "$MAYBE_FQDN_HOSTNAME" = "$HOSTNAME" ]; then
+ echo "Hostname must be a fqdn domain name when node is configured with long names"
+ echo "and the full node name isn't configured in vm.args"
+ exit 1
+ fi
+ fi
+ ;;
+esac
+
# Note the `date +%s`, used to allow multiple remsh to the same node
# transparently
-REMSH_NAME_ARG="$REMSH_TYPE remsh`date +%s`@`echo $REMSH_NAME | awk -F@ '{print $2}'`"
-REMSH_REMSH_ARG="-remsh $REMSH_NAME"
+REMSH_NAME_ARG="$REMSH_TYPE remsh`date +%s`@$REMSH_HOSTNAME_PART"
+REMSH_REMSH_ARG="-remsh $REMSH_NAME_PART@$REMSH_HOSTNAME_PART"
# Extract the target cookie
COOKIE_ARG=`grep '^\-setcookie' $VMARGS_PATH`
@@ -110,7 +137,7 @@ ERTS_PATH=$RUNNER_BASE_DIR/erts-$ERTS_VSN/bin
NODETOOL="$ERTS_PATH/escript $ERTS_PATH/nodetool $NAME_ARG $COOKIE_ARG"
# Setup remote shell command to control node
-REMSH="$ERTS_PATH/erl $REMSH_NAME_ARG $REMSH_REMSH_ARG $COOKIE_ARG"
+REMSH="$ERTS_PATH/erl -hidden $REMSH_NAME_ARG $REMSH_REMSH_ARG $COOKIE_ARG"
# Common functions