From 64a3aa725fa8606869d6480ba2883e6b6a3e5cda Mon Sep 17 00:00:00 2001 From: Manfred Touron Date: Tue, 22 Dec 2015 18:35:51 +0100 Subject: [PATCH] create-image-from-http.sh: Support HTTP proxy (fix #249) --- README.md | 1 + examples/create-image-from-http.sh | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4ef9456ec5..0342fe535c 100644 --- a/README.md +++ b/README.md @@ -1152,6 +1152,7 @@ $ scw inspect myserver | jq '.[0].public_ip.address' ### master (unreleased) +* create-image-from-http.sh: Support HTTP proxy ([#249](https://github.com/scaleway/scaleway-cli/issues/249)) * Support of `scw run --userdata=...` ([#202](https://github.com/scaleway/scaleway-cli/issues/202)) * Refactor of `scw _security-groups` ([#197](https://github.com/scaleway/scaleway-cli/issues/197)) * Support of `scw tag --arch=XXX` diff --git a/examples/create-image-from-http.sh b/examples/create-image-from-http.sh index 6b1bc34627..674cf2812d 100755 --- a/examples/create-image-from-http.sh +++ b/examples/create-image-from-http.sh @@ -20,7 +20,6 @@ IMAGE_BOOTSCRIPT=${IMAGE_BOOTSCRIPT:stable} VOLUME_SIZE=${VOLUME_SIZE:-50GB} KEY=$(cat ~/.ssh/id_rsa.pub | awk '{ print $1" "$2 }' | tr ' ' '_') - echo "[+] URL of the tarball: ${URL}" echo "[+] Target name: ${NAME}" @@ -35,6 +34,16 @@ scw exec -w "${SERVER}" 'uname -a' echo "[+] Server is booted" +if [ -n "${SCW_GATEWAY_HTTP_PROXY}" ]; then + echo "[+] Configuring HTTP proxy" + # scw exec "${SERVER}" "echo proxy=${SCW_GATEWAY_HTTP_PROY} >> .curlrc" + ( + set +x + scw exec "${SERVER}" "echo http_proxy = ${SCW_GATEWAY_HTTP_PROXY} >> .wgetrc" >/dev/null 2>/dev/null || (echo "Failed to configure HTTP proxy"; exit 1) || exit 1 + ) +fi + + echo "[+] Formating and mounting /dev/nbd1..." scw exec "${SERVER}" 'mkfs.ext4 /dev/nbd1 && mount /dev/nbd1 /mnt' echo "[+] /dev/nbd1 formatted in ext4 and mounted on /mnt"