From 8f5838ceea049424cffbb157605fdd28d229ee5f Mon Sep 17 00:00:00 2001 From: Jesse Peterson Date: Thu, 12 Jul 2018 04:35:42 -0700 Subject: [PATCH] Allow setting curl options in environment variable (#455) --- tools/api/commands/available_os_updates | 2 +- tools/api/commands/certificate_list | 2 +- tools/api/commands/device_information | 2 +- tools/api/commands/device_lock | 2 +- tools/api/commands/install_application | 2 +- tools/api/commands/install_enterprise_application | 2 +- tools/api/commands/install_profile | 2 +- tools/api/commands/install_provisioning_profile | 2 +- tools/api/commands/installed_application_list | 2 +- tools/api/commands/os_update_status | 2 +- tools/api/commands/profile_list | 2 +- tools/api/commands/provisioning_profile_list | 2 +- tools/api/commands/remove_profile | 2 +- tools/api/commands/remove_provisioning_profile | 2 +- tools/api/commands/restart_device | 2 +- tools/api/commands/schedule_os_update | 2 +- tools/api/commands/schedule_os_update_scan | 2 +- tools/api/commands/security_info | 2 +- tools/api/get_devices | 2 +- tools/api/send_push_notification | 2 +- 20 files changed, 20 insertions(+), 20 deletions(-) diff --git a/tools/api/commands/available_os_updates b/tools/api/commands/available_os_updates index a3074afd..1d427ede 100755 --- a/tools/api/commands/available_os_updates +++ b/tools/api/commands/available_os_updates @@ -7,4 +7,4 @@ jq -n \ '.udid = $udid |.request_type = $request_type '|\ - curl -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- + curl $CURL_OPTS -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- diff --git a/tools/api/commands/certificate_list b/tools/api/commands/certificate_list index 60d97c8c..2389808c 100755 --- a/tools/api/commands/certificate_list +++ b/tools/api/commands/certificate_list @@ -7,4 +7,4 @@ jq -n \ '.udid = $udid |.request_type = $request_type '|\ - curl -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- + curl $CURL_OPTS -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- diff --git a/tools/api/commands/device_information b/tools/api/commands/device_information index 6b2f7e63..5b3131ff 100755 --- a/tools/api/commands/device_information +++ b/tools/api/commands/device_information @@ -7,4 +7,4 @@ jq -n \ '.udid = $udid |.request_type = $request_type '|\ - curl -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- + curl $CURL_OPTS -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- diff --git a/tools/api/commands/device_lock b/tools/api/commands/device_lock index e7697d68..1b24967f 100755 --- a/tools/api/commands/device_lock +++ b/tools/api/commands/device_lock @@ -9,4 +9,4 @@ jq -n \ |.pin = $pin |.request_type = $request_type '|\ - curl -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- + curl $CURL_OPTS -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- diff --git a/tools/api/commands/install_application b/tools/api/commands/install_application index fd1ee4b5..942bf509 100755 --- a/tools/api/commands/install_application +++ b/tools/api/commands/install_application @@ -9,6 +9,6 @@ jq -n \ |.request_type = $request_type |.manifest_url = $manifest_url '|\ - curl \ + curl $CURL_OPTS \ -H "Content-Type: application/json" \ -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- diff --git a/tools/api/commands/install_enterprise_application b/tools/api/commands/install_enterprise_application index 622716c4..dc86947d 100755 --- a/tools/api/commands/install_enterprise_application +++ b/tools/api/commands/install_enterprise_application @@ -9,6 +9,6 @@ jq -n \ |.request_type = $request_type |.manifest_url = $manifest_url '|\ - curl \ + curl $CURL_OPTS \ -H "Content-Type: application/json" \ -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- diff --git a/tools/api/commands/install_profile b/tools/api/commands/install_profile index 234efa38..2822c658 100755 --- a/tools/api/commands/install_profile +++ b/tools/api/commands/install_profile @@ -9,4 +9,4 @@ jq -n \ |.payload = $payload |.request_type = $request_type '|\ - curl -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- + curl $CURL_OPTS -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- diff --git a/tools/api/commands/install_provisioning_profile b/tools/api/commands/install_provisioning_profile index a0ea6d31..6d87af8a 100755 --- a/tools/api/commands/install_provisioning_profile +++ b/tools/api/commands/install_provisioning_profile @@ -9,4 +9,4 @@ jq -n \ |.provisioning_profile = $provisioning_profile |.request_type = $request_type '|\ - curl -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- + curl $CURL_OPTS -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- diff --git a/tools/api/commands/installed_application_list b/tools/api/commands/installed_application_list index 0037ecac..0b6099c9 100755 --- a/tools/api/commands/installed_application_list +++ b/tools/api/commands/installed_application_list @@ -7,4 +7,4 @@ jq -n \ '.udid = $udid |.request_type = $request_type '|\ - curl -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- + curl $CURL_OPTS -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- diff --git a/tools/api/commands/os_update_status b/tools/api/commands/os_update_status index 496c3a08..e93031da 100755 --- a/tools/api/commands/os_update_status +++ b/tools/api/commands/os_update_status @@ -7,4 +7,4 @@ jq -n \ '.udid = $udid |.request_type = $request_type '|\ - curl -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- + curl $CURL_OPTS -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- diff --git a/tools/api/commands/profile_list b/tools/api/commands/profile_list index f9791245..25e744ef 100755 --- a/tools/api/commands/profile_list +++ b/tools/api/commands/profile_list @@ -7,6 +7,6 @@ jq -n \ '.udid = $udid |.request_type = $request_type '|\ - curl \ + curl $CURL_OPTS \ -H "Content-Type: application/json" \ -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- diff --git a/tools/api/commands/provisioning_profile_list b/tools/api/commands/provisioning_profile_list index e5824891..e74cef94 100755 --- a/tools/api/commands/provisioning_profile_list +++ b/tools/api/commands/provisioning_profile_list @@ -7,4 +7,4 @@ jq -n \ '.udid = $udid |.request_type = $request_type '|\ - curl -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- + curl $CURL_OPTS -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- diff --git a/tools/api/commands/remove_profile b/tools/api/commands/remove_profile index b8832fe2..fd88c040 100755 --- a/tools/api/commands/remove_profile +++ b/tools/api/commands/remove_profile @@ -9,4 +9,4 @@ jq -n \ |.identifier = $identifier |.request_type = $request_type '|\ - curl -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- + curl $CURL_OPTS -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- diff --git a/tools/api/commands/remove_provisioning_profile b/tools/api/commands/remove_provisioning_profile index 9514ceb1..b81f9aa1 100755 --- a/tools/api/commands/remove_provisioning_profile +++ b/tools/api/commands/remove_provisioning_profile @@ -9,4 +9,4 @@ jq -n \ |.uuid = $uuid |.request_type = $request_type '|\ - curl -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- + curl $CURL_OPTS -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- diff --git a/tools/api/commands/restart_device b/tools/api/commands/restart_device index 2dce9a1c..8f5487e4 100755 --- a/tools/api/commands/restart_device +++ b/tools/api/commands/restart_device @@ -7,4 +7,4 @@ jq -n \ '.udid = $udid |.request_type = $request_type '|\ - curl -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- + curl $CURL_OPTS -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- diff --git a/tools/api/commands/schedule_os_update b/tools/api/commands/schedule_os_update index 8e702d28..42482046 100755 --- a/tools/api/commands/schedule_os_update +++ b/tools/api/commands/schedule_os_update @@ -13,4 +13,4 @@ jq -n \ |.install_action = $install_action ] '|\ - curl -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- + curl $CURL_OPTS -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- diff --git a/tools/api/commands/schedule_os_update_scan b/tools/api/commands/schedule_os_update_scan index a6c9f359..e68ea34f 100755 --- a/tools/api/commands/schedule_os_update_scan +++ b/tools/api/commands/schedule_os_update_scan @@ -9,4 +9,4 @@ jq -n \ |.request_type = $request_type |.force = $force '|\ - curl -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- + curl $CURL_OPTS -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- diff --git a/tools/api/commands/security_info b/tools/api/commands/security_info index f55248d1..ce0a52c6 100755 --- a/tools/api/commands/security_info +++ b/tools/api/commands/security_info @@ -7,4 +7,4 @@ jq -n \ '.udid = $udid |.request_type = $request_type '|\ - curl -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- + curl $CURL_OPTS -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@- diff --git a/tools/api/get_devices b/tools/api/get_devices index 3762150b..929d120b 100755 --- a/tools/api/get_devices +++ b/tools/api/get_devices @@ -1,4 +1,4 @@ #!/bin/bash source $MICROMDM_ENV_PATH endpoint="v1/devices" -curl -s -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" +curl $CURL_OPTS -XGET --data-binary {} -s -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" diff --git a/tools/api/send_push_notification b/tools/api/send_push_notification index 6d07aee9..992f7036 100755 --- a/tools/api/send_push_notification +++ b/tools/api/send_push_notification @@ -2,4 +2,4 @@ source $MICROMDM_ENV_PATH endpoint="push" -curl -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint/$1" +curl $CURL_OPTS -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint/$1"