Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 109 lines (97 sloc) 2.619 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
#!/bin/sh
# @@@LICENSE
#
# Copyright (c) 2008-2012 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# LICENSE@@@

BUILD_DIR="./build-x86"
BUILD_BIN_DIR="${BUILD_DIR}/bin"
BUILD_LIB_DIR="${BUILD_DIR}/lib"

DESKTOP_BINARIES=/opt/Palm/luna/desktop-binaries/
export LD_LIBRARY_PATH=${BUILD_LIB_DIR}:${DESKTOP_BINARIES}/lib:${LD_LIBRARY_PATH}
#export PATH=./bin:${PATH}

HUB="${BUILD_BIN_DIR}/ls-hubd"

CONF_DIR=${BUILD_DIR}/tests/conf
PUB_CONF=${BUILD_DIR}/etc/ls2/ls-public.conf
PRV_CONF=${BUILD_DIR}/etc/ls2/ls-private.conf

# Start a desktop version of the hub
start_private() {
    ARGS="-i /var/palm/run -c ${PRV_CONF}"
    if [ "x${1}" = "xdebug" ]; then
        CMD="gdb --args ${HUB} ${ARGS}"
    else
        CMD="${HUB} ${ARGS} &"
    fi

    ${CMD}
}

start_public() {
    ARGS="-i /var/palm/run -c ${PUB_CONF} -p"
    if [ "x${1}" = "xdebug" ]; then
        CMD="gdb --args ${HUB} ${ARGS}"
    else
        CMD="${HUB} ${ARGS} &"
    fi

    ${CMD}
}

stop_all() {
# killall ls-hubd
    for i in $LS_PID
    do
        echo "Killing process $i"
        kill $i
    done
}

usage() {
    echo "Start or stop a local hub"
    echo "Options:"
    echo " help Show this help message"
    echo ""
    echo "Commands:"
    echo " start_public Start public hub"
    echo " start_public_debug Start public hub under gdb"
    echo " start_private Start private hub"
    echo " start_private_debug Start private hub under gdb"
    echo " start Start both public and private"
    echo " stop Stop all running instances of hub"
}

LS_PID=`ps auwx | grep ${HUB} | grep -v grep | tr -s [:space:] | cut -f2 -d' '`

case "$1" in
start_public*)
    if [ "x${1}" = "xstart_public_debug" ]
    then
        start_public debug
    else
        start_public
    fi
    ;;
start_private*)
    if [ "x${1}" = "xstart_private_debug" ]
    then
        start_private debug
    else
        start_private
    fi
    ;;
start)
    start_public
    start_private
    ;;
stop)
    stop_all
    ;;
*)
    usage
    ;;
esac
Something went wrong with that request. Please try again.