added bpq wrappers to install script
authoraidan
Mon, 27 Jun 2011 18:54:19 +0100
changeset 3655ad5aabde9b6
parent 364 82b404f585f9
child 366 8d49aafb162e
added bpq wrappers to install script
BPQ/dtn-bpq
BPQ/install_bpq
     1.1 --- a/BPQ/dtn-bpq	Mon Jun 27 17:53:27 2011 +0100
     1.2 +++ b/BPQ/dtn-bpq	Mon Jun 27 18:54:19 2011 +0100
     1.3 @@ -19,8 +19,8 @@
     1.4  #
     1.5  # Set Environment Variables to use BPQ daemon
     1.6  #
     1.7 -DTNAPI_ADDR=0.0.0.0
     1.8 -DTNAPI_PORT=7010
     1.9 +export DTNAPI_ADDR=0.0.0.0
    1.10 +export DTNAPI_PORT=7010
    1.11  
    1.12  set -e
    1.13  
     2.1 --- a/BPQ/install_bpq	Mon Jun 27 17:53:27 2011 +0100
     2.2 +++ b/BPQ/install_bpq	Mon Jun 27 18:54:19 2011 +0100
     2.3 @@ -13,6 +13,19 @@
     2.4          exit -1
     2.5      fi
     2.6  }
     2.7 +# param 1: the current location of the application
     2.8 +# param 2: the name & location of the wrapper
     2.9 +function create_bpq_wrapper {
    2.10 +    log "Creating BPQ wrapper for $1"
    2.11 +
    2.12 +    echo "!#/bin/bash"                      >  $2
    2.13 +    echo "export DTNAPI_ADDR=0.0.0.0"       >> $2
    2.14 +    echo "export DTNAPI_PORT=7010"          >> $2
    2.15 +    echo "$1 \"\$*\""                       >> $2
    2.16 +
    2.17 +    chmod 755 $2
    2.18 +    chown root:root $2
    2.19 +}
    2.20  
    2.21  log "Creating dirs for BPQ daemon"
    2.22  for dir in /data/dtn/payload/bpq \
    2.23 @@ -59,19 +72,25 @@
    2.24  
    2.25  log "Building BPQ..."
    2.26  pushd /data/apps/DTN2-BPQ
    2.27 -./configure -C
    2.28 -make
    2.29 +sudo -u dtnuser ./configure -C
    2.30 +sudo -u dtnuser make
    2.31 +check "$?" "Error Building BPQ"
    2.32  
    2.33 -if [ "$?" -ne "0" ];then
    2.34 -    log "Error Building BPQ: $?"
    2.35 -    exit -1
    2.36 -fi
    2.37  popd
    2.38  
    2.39 -log "Adding BPQ daemon and apps to /usr/bin/"
    2.40 -cp -f /data/apps/DTN2-BPQ/daemon/dtnd                   /usr/bin/dtnd-bpq
    2.41 -cp -f /data/apps/DTN2-BPQ/apps/dtnquery/dtnquery        /usr/bin/dtnquery
    2.42 -cp -f /data/apps/DTN2-BPQ/apps/dtnrespond/dtnrespond    /usr/bin/dtnrespond
    2.43 +log "Adding BPQ daemon to /usr/bin/"
    2.44 +cp -f /data/apps/DTN2-BPQ/daemon/dtnd       /usr/bin/dtnd-bpq
    2.45 +
    2.46 +create_bpq_wrapper /data/apps/DTN2-BPQ/apps/dtnquery/dtnquery   /usr/bin/dtnquery
    2.47 +create_bpq_wrapper /data/apps/DTN2-BPQ/apps/dtnpond/dtnrespond  /usr/bin/dtnrespond
    2.48 +
    2.49 +create_bpq_wrapper /usr/bin/dtnping                             /usr/bin/dtnping-bpq
    2.50 +create_bpq_wrapper /usr/bin/dtntraceroute                       /usr/bin/dtntraceroute-bpq
    2.51 +
    2.52 +echo "!#/bin/bash"                          >  /usr/bin/dtnd-control-bpq
    2.53 +echo "dtnd-control -port 7010  \"\$*\""     >> /usr/bin/dtnd-control-bpq
    2.54 +
    2.55 +
    2.56  
    2.57  chown root:root /usr/bin/dtnd-bpq
    2.58  chown root:root /usr/bin/dtnquery