From 6b4c82f4657bdb56e6b7a56651d6d4bb91a35b8f Mon Sep 17 00:00:00 2001 From: Adrian Dudau Date: Thu, 26 Jun 2014 13:29:32 +0200 Subject: initial commit for Enea Linux 4.0 Migrated from the internal git server on the daisy-enea branch Signed-off-by: Adrian Dudau --- .../steward-init/LICENSE.steward-init | 9 ++++ .../steward-init/steward-init-settings.sh | 62 ++++++++++++++++++++++ .../steward-init/steward-init.service.in | 14 +++++ 3 files changed, 85 insertions(+) create mode 100644 meta-iot/recipes-web/the-thing-system/steward-init/LICENSE.steward-init create mode 100755 meta-iot/recipes-web/the-thing-system/steward-init/steward-init-settings.sh create mode 100644 meta-iot/recipes-web/the-thing-system/steward-init/steward-init.service.in (limited to 'meta-iot/recipes-web/the-thing-system/steward-init') diff --git a/meta-iot/recipes-web/the-thing-system/steward-init/LICENSE.steward-init b/meta-iot/recipes-web/the-thing-system/steward-init/LICENSE.steward-init new file mode 100644 index 0000000..0388698 --- /dev/null +++ b/meta-iot/recipes-web/the-thing-system/steward-init/LICENSE.steward-init @@ -0,0 +1,9 @@ +# LICENSE + +[MIT](http://en.wikipedia.org/wiki/MIT_License) license. Freely have you received, freely give. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/meta-iot/recipes-web/the-thing-system/steward-init/steward-init-settings.sh b/meta-iot/recipes-web/the-thing-system/steward-init/steward-init-settings.sh new file mode 100755 index 0000000..40f75ee --- /dev/null +++ b/meta-iot/recipes-web/the-thing-system/steward-init/steward-init-settings.sh @@ -0,0 +1,62 @@ +#!/bin/sh + +if [ -z "$THE_THING_SYSTEM" ]; then + THE_THING_SYSTEM=/opt/TheThingSystem + export THE_THING_SYSTEM +fi + +STEWARD_DIR=${THE_THING_SYSTEM}/steward +STEWARD_SETTINGS=$STEWARD_DIR/db/server.key + +RET=0 + +if [ -s $STEWARD_SETTINGS ]; then + exit 0 +fi + +# Change the port of the eca-web so that steward web-ui can live in +# port 80. Eca-web will be moved to HTTP port 8080. +sed -i 's/PORT=80$/PORT=8080/' /etc/eca-web/config + +if [ ! -d $STEWARD_DIR/sandbox ]; then + mkdir -p $STEWARD_DIR/sandbox +fi +if [ ! -d $STEWARD_DIR/db ]; then + mkdir -p $STEWARD_DIR/db +fi + +if [ -z "$NODE_PATH" ]; then + NODE_PATH=${THE_THING_SYSTEM}/steward + export NODE_PATH +fi + +cd $THE_THING_SYSTEM/steward + +echo -n "Creating server key..." +rm -f ${STEWARD_DIR}/sandbox/server.crt ${STEWARD_DIR}/sandbox/server.sha1 + +node <&2 + RET=1 +fi + +exit $RET diff --git a/meta-iot/recipes-web/the-thing-system/steward-init/steward-init.service.in b/meta-iot/recipes-web/the-thing-system/steward-init/steward-init.service.in new file mode 100644 index 0000000..feed7f5 --- /dev/null +++ b/meta-iot/recipes-web/the-thing-system/steward-init/steward-init.service.in @@ -0,0 +1,14 @@ +[Unit] +Description=Initialize TheThingSystem steward settings +After=syslog.target +Before=eca-web.service +ConditionFileNotEmpty=!@the_thing_system_dir@/steward/db/server.key + +[Service] +Type=oneshot +EnvironmentFile=-/etc/TheThingSystem/config +ExecStart=-@the_thing_system_dir@/steward/steward-init-settings.sh +StandardOutput=null + +[Install] +WantedBy=steward.service -- cgit v1.2.3-54-g00ecf