0

I am trying to configure Eclipse under linux to run my .sh script with arguments. I am using External tools configuration to this end. I am able to run my script, but as soon as I add an argument i receive a message the input device is not a TTY in the console and the script is not run. This is my config:

enter image description here

What could be the case of this? I would appreciate all help.

Edit: this is the script:

#!/bin/bash
EDISON_DEVICE="root@192.168.1.202:/tmp"
WORK_DIR=$(pwd)

CLEAN=false
BUILD=false
TEST=false
CREATE_DOC=false
UPLOAD=false

#tabs 30
if [ $# -eq 0 ] 
then
   echo -e "Options:\n-c, --clean \tClean project\n-b, --build\tBuild project\n-d, --doc\t Create documentation\n-u, --upload\tUpload project to Edison device\n-e, --edison string\tEdison device ip (need to copy output)"
fi

while [ $# -gt 0 ]
do
key="$1"

case $key in
    --help)
    echo -e "Options:\n-c, --clean \tClean project\n-b, --build\tBuild project\n-d, --doc\t Create documentation\n-u, --upload\tUpload project to Edison device\n-e, --edison string\tEdison device ip (need to copy output)"
    exit
    ;;
    -c|--clean)
    CLEAN=true
    ;;
    -b|--build)
    BUILD=true
    ;;
    -t|--test)
    TEST=true
    ;;
    -d|--doc)
    CREATE_DOC=true
    ;;
    -u|--upload)
    UPLOAD=true
    ;;
    -e|--edison)
    EDISON_DEVICE="$2"
    shift # past argument or value
    ;;
    *)
    echo "Unrecognized option $key" # unknown option
    ;;
esac
shift # past argument or value
done

# VALIDATION
if $UPLOAD; then
   if [ "$EDISON_DEVICE" = "" ]
   then
      echo 'Please use option --edison to compile project or fill default EDISON_DEVICE on script'
      exit
   fi
fi

# EXECUTION
if $CLEAN; then
   docker run --rm -it -v $WORK_DIR:/tmp --workdir /tmp inteliotdevkit/intel-iot-yocto -c "make clean"
fi

if $BUILD; then
   docker run --rm -it -v $WORK_DIR:/tmp --workdir /tmp inteliotdevkit/intel-iot-yocto -c "make"
fi

if $TEST; then
   docker run --rm -it -v $WORK_DIR:/tmp --workdir /tmp inteliotdevkit/intel-iot-yocto -c "make test"
fi

if $CREATE_DOC; then
   make docs
fi

if $UPLOAD; then
   echo -e "${COLOR}Copy program-test-python to Edison device${NC}"
   scp program-test/PythonConnectorEdison.py program-test/_PythonConnectorEdison.so program-test/python_script.py $EDISON_DEVICE
fi
Łukasz Przeniosło
  • 2,725
  • 5
  • 38
  • 74

1 Answers1

0

Your script is fine and works for me if I just echo all commands that should be executed. The problem is about the docker command. Remove the -t from your docker command, answer from here on SO.

The "-t" tells docker to configure the tty, which won't work if you don't have a tty and try to attach to the container (default when you don't do a "-d").


If you want to use the interactive mode and see output instead you can start an own shell that is reading the argument as command (-c) and is interactive (-i) by setting the following.

On the Main page set Location to:

/usr/bin/sh

On the Arguments add:

-ci "/home/lukasz/bitbucket/driver/compile_ubuntu.sh -c"

Edit #1:

As you wrote in your comment that it can still find no TTY consider this answer on superuser. If there is no /etc/inittab read this answer on aksubuntu:

Just remove /dev/console

cd /dev
rm -f console
ln -s ttyS0 console

edit/change the /etc/inittab content

::askfirst:/bin/sh

to:

ttyS0::askfirst:/bin/sh
Andre Kampling
  • 5,476
  • 2
  • 20
  • 47