-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathDownloadRunnerDockerEntrypoint.sh
More file actions
executable file
·40 lines (36 loc) · 1.29 KB
/
DownloadRunnerDockerEntrypoint.sh
File metadata and controls
executable file
·40 lines (36 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
# ./DownloadRunnerDockerEntrypoint sidewalk_server_fqdn
# ./DownloadRunnerDockerEntrypoint sidewalk_server_fqdn user@host:/remote/path port
mkdir -p /tmp/download_dest
chmod 600 /app/id_rsa
# Parse optional parameters at the end
all_panos=""
attempt_depth=""
# Process arguments from the end
while [[ $# -gt 0 ]]; do
case "${@: -1}" in
"--all-panos")
all_panos="--all-panos"
set -- "${@:1:$(($#-1))}"
;;
"--attempt-depth")
attempt_depth="--attempt-depth"
set -- "${@:1:$(($#-1))}"
;;
*)
# Not an optional parameter, stop processing
break
;;
esac
done
# If one param, just download to /tmp. If three params, this means a host and port has been supplied.
if [ $# -eq 1 ]; then
python3 DownloadRunner.py $1 /tmp/download_dest $all_panos
elif [ $# -eq 3 ]; then
echo "Mounting $2 port $3 for $1"
sshfs -o IdentityFile=/app/id_rsa,StrictHostKeyChecking=no $2 /tmp/download_dest -p $3 && python3 DownloadRunner.py $1 /tmp/download_dest $all_panos; umount /tmp/download_dest
else
echo "Usage:"
echo " ./DownloadRunnerDockerEntrypoint sidewalk_server_fqdn"
echo " ./DownloadRunnerDockerEntrypoint sidewalk_server_fqdn user@host:/remote/path port"
fi