#!/bin/sh

# opencocon SPICE launcher

if [ -e /tmp/.cocon.cnf ];
then
  . /tmp/.cocon.cnf
fi
if [ -e /tmp/.cocon.cnf.part ];
then
  . /tmp/.cocon.cnf.part
fi

if [ $COCON_SPICE_HOST ];
then
  spiceop=" -h $COCON_SPICE_HOST "

  if [ $COCON_SPICE_PORT ];
  then
    spiceop=" $spiceop -p $COCON_SPICE_PORT "
  else
    if [ $COCON_SPICE_TLSPORT ];
    then
      spiceop=" $spiceop -s $COCON_SPICE_TLSPORT "
    else
      echo "Please specify PORT or TLSPORT."
      exit 1
    fi
  fi

  spicy $spiceop

else
  echo "Please specify HOST."
fi


