@@ -25,11 +25,11 @@ usage() {
25 echo "Script to setup a build environment for the shell and sync build and run it on the device"
25 echo "Script to setup a build environment for the shell and sync build and run it on the device"
27 echo "OPTIONS:"
27 echo "OPTIONS:"
28− echo " -a The sudo password to use"
28+ echo " -a, --password The sudo password to use"
29− echo " -s Setup the build environment"
29+ echo " -s, --setup Setup the build environment"
30− echo " -g Run with gdb"
30+ echo " -g, --gdb Run with gdb"
31− echo " -p Enable a PIN lock screen when running"
31+ echo " -p, --pinlock Enable a PIN lock screen when running"
32− echo " -k Enable a Keyboard lock screen when running"
32+ echo " -k, --keylock Enable a Keyboard lock screen when running"
34 echo "IMPORTANT:"
34 echo "IMPORTANT:"
35 echo " * Make sure to have networking setup on the device beforehand."
35 echo " * Make sure to have networking setup on the device beforehand."
@@ -107,20 +107,23 @@ run() {
107 exec_with_ssh "start unity8"
107 exec_with_ssh "start unity8"
110−while getopts "a:sgpkh" OPTION; do
110+set -- `getopt -n$0 -u -a --longoptions="password:,setup,gdb,pinlock,keylock,help" "a:sgpkh" "$@"`
112+# FIXME: giving incorrect arguments does not call usage and exit
111− case "$OPTION" in
115+ case "$1" in
112− a) PASSWORD=$OPTARG;;
116+ -a|--password) PASSWORD=$2;;
113− s) SETUP=true;;
117+ -s|--setup) SETUP=true;;
114− g) GDB=true;;
118+ -g|--gdb) GDB=true;;
115− p) PINLOCK=true;;
119+ -p|--pinlock) PINLOCK=true;;
116− k) KEYLOCK=true;;
120+ -k|--keylock) KEYLOCK=true;;
117− h) usage;;
121+ -h|--help) usage;;
118− ?) echo;usage;;
122+ --) shift;break;;
122−shift $((OPTIND - 1))
124if [ -z "${PASSWORD}" ]; then
127if [ -z "${PASSWORD}" ]; then
125 echo "ERROR: You need to provide a sudo password..."
128 echo "ERROR: You need to provide a sudo password..."