]> git.proxmox.com Git - mirror_lxc.git/blobdiff - templates/lxc-download.in
Merge pull request #3067 from Rachid-Koucha/patch-1
[mirror_lxc.git] / templates / lxc-download.in
index 5f1138ccf2acbcdd8a27d6a2e0e542c1411b4ede..413b85f35bb65a9beaffe5d08e4a534741986fa0 100644 (file)
@@ -60,6 +60,7 @@ if [ -z "${DOWNLOAD_KEYSERVER:-}" ]; then
   # Deal with GPG over http proxy
   if [ -n "${http_proxy:-}" ]; then
     DOWNLOAD_KEYSERVER="hkp://p80.pool.sks-keyservers.net:80"
+    DOWNLOAD_GPG_PROXY="--keyserver-options http-proxy=\"${http_proxy}\""
   fi
 fi
 
@@ -133,8 +134,8 @@ gpg_setup() {
 
   success=
   for _ in $(seq 3); do
-    if gpg --keyserver "${DOWNLOAD_KEYSERVER}" \
-      --recv-keys "${DOWNLOAD_KEYID}" >/dev/null 2>&1; then
+    if $(gpg --keyserver "${DOWNLOAD_KEYSERVER}" ${DOWNLOAD_GPG_PROXY:-} \
+      --recv-keys "${DOWNLOAD_KEYID}" >/dev/null 2>&1); then
       success=1
       break
     fi
@@ -319,8 +320,11 @@ fi
 
 if ! command -V mktemp >/dev/null 2>&1; then
   DOWNLOAD_TEMP="${DOWNLOAD_TEMP}/tmp/lxc-download.$$"
-else
+elif [ -n "${DOWNLOAD_TEMP}" ]; then
+  mkdir -p "${DOWNLOAD_TEMP}"
   DOWNLOAD_TEMP="$(mktemp -p ${DOWNLOAD_TEMP} -d)"
+else
+  DOWNLOAD_TEMP="${DOWNLOAD_TEMP}$(mktemp -d)"
 fi
 
 # Simply list images