@@ -9,12 +9,13 @@ function usage()
99 Usage: $progname [--device DEVICE] [--verbose] [--repair] [--deploy] [--latest-paris]
1010
1111 optional arguments:
12- -h, --help show this help message and exit
13- -v, --verbose increase the verbosity of the bash script
14- -d, --device DEVICE device hostname[:port]
15- --latest-paris Use latest paris version (default: prod)
16- --repair repair the device
17- --deploy deploy the device
12+ -h, --help show this help message and exit
13+ -v, --verbose increase the verbosity of the bash script
14+ -d, --device DEVICE device hostname[:port]
15+ --latest-paris Use latest paris version (default: prod)
16+ --repair repair the device
17+ --deploy deploy the device
18+ --depot-tools-path PATH path to depot tools (default: /usr/local/google/mobileharness/ate/cipd_packages)
1819
1920HEREDOC
2021}
@@ -26,6 +27,7 @@ deploy=0
2627repair=0
2728device=" "
2829useLatestParis=0
30+ depotToolsPath=" /usr/local/google/mobileharness/ate/cipd_packages"
2931port=" 5555"
3032user=` whoami`
3133tm=` date +" %Y-%m-%d_%H%M%S_%N" `
@@ -36,7 +38,7 @@ namespace=${UFS_NAMESPACE:-os}
3638# use getopt and store the output into $OPTS
3739# note the use of -o for the short options, --long for the long name options
3840# and a : for any option that takes a parameter
39- OPTS=$( getopt -o " hd:v" --long " help,device:,verbose,repair,deploy,latest-paris" -n " $progname " -- " $@ " )
41+ OPTS=$( getopt -o " hd:v" --long " help,device:,verbose,repair,deploy,latest-paris,depot-tools-path: " -n " $progname " -- " $@ " )
4042if [ $? != 0 ] ; then echo " Error in command line arguments." >&2 ; usage; exit 1 ; fi
4143eval set -- " $OPTS "
4244
@@ -49,6 +51,7 @@ while true; do
4951 --latest-paris ) useLatestParis=1; shift 1 ;;
5052 --repair ) repair=1; shift ;;
5153 --deploy ) deploy=1; shift ;;
54+ --depot-tools-path ) depotToolsPath=" $2 " ; shift 2 ;;
5255 -v | --verbose ) verbose=$(( verbose + 1 )) ; shift ;;
5356 -- ) shift ; break ;;
5457 * ) break ;;
@@ -60,6 +63,11 @@ if [ -z "${device}" ]; then
6063 exit -1
6164fi
6265
66+ if [ ! -x " ${depotToolsPath} /cipd" ]; then
67+ echo " Error: cipd executable not found at ${depotToolsPath} /cipd. Please check --depot-tools-path."
68+ exit 1
69+ fi
70+
6371if [[ $device =~ " :" ]]; then
6472 port=${device##*: }
6573 device=" ${device%%:* } "
@@ -109,7 +117,6 @@ exitEarlyIfExistingRepairJobRunning "${device}"
109117
110118cd " ${dd} "
111119# download paris
112- depotToolsPath=" /usr/local/google/mobileharness/runtime_files/recovery/depot_tools"
113120" ${depotToolsPath} " /cipd init -force -cache-dir " ${pd} "
114121
115122if [[ $useLatestParis -eq 1 ]]; then
0 commit comments