+
+ ((contact_count++))
+ if [[ $contact_count > $ATTEMPTS_BEFORE_BACKUP ]]; then
+
+ contact_count=0
+
+ if [[ $on_backup_server == 1 ]]; then
+ echo "pl_boot: failed to contact backup server, trying primary."
+
+ on_backup_server=0
+
+ CONNECT_BOOT_SERVER=$BOOT_SERVER
+ CONNECT_BOOT_SERVER_PORT=$BOOT_SERVER_PORT
+ CONNECT_BOOT_SERVER_PATH=$BOOT_SERVER_PATH
+ CONNECT_BOOT_SERVER_GPG_KEYRING=$BOOT_SERVER_GPG_KEYRING
+ CONNECT_BOOT_SERVER_CACERT=$BOOT_SERVER_CACERT
+ else
+ echo "pl_boot: failed to contact primary server, trying backup."
+
+ on_backup_server=1
+
+ CONNECT_BOOT_SERVER=$BACKUP_BOOT_SERVER
+ CONNECT_BOOT_SERVER_PORT=$BACKUP_BOOT_SERVER_PORT
+ CONNECT_BOOT_SERVER_PATH=$BACKUP_BOOT_SERVER_PATH
+ CONNECT_BOOT_SERVER_GPG_KEYRING=$BACKUP_BOOT_SERVER_GPG_KEYRING
+ CONNECT_BOOT_SERVER_CACERT=$BACKUP_BOOT_SERVER_CACERT
+ fi
+ fi
+
+ # assemble the curl transaction
+ CURL_CMD="/usr/bin/curl \
+ --connect-timeout 60 \
+ --max-time 600 \
+ --form version=<$BOOT_VERSION_FILE \
+ --form cmdline=</proc/cmdline \
+ --form uptime=</proc/uptime \
+ --form ifconfig=</tmp/ifconfig \
+ --form nonce=</tmp/nonce \
+ --location \
+ --output $UNVERIFIED_SCRIPT \
+ --sslv3 \
+ --silent \
+ --show-error \
+ --fail \
+ --stderr /tmp/curl_errors \
+ --cacert $CONNECT_BOOT_SERVER_CACERT \
+ https://$CONNECT_BOOT_SERVER:$CONNECT_BOOT_SERVER_PORT/$CONNECT_BOOT_SERVER_PATH"
+
+ # assemble the gpg command line
+ GPG_CMD="/usr/bin/gpg \
+ --no-default-keyring \
+ --keyring $CONNECT_BOOT_SERVER_GPG_KEYRING \
+ --output $VERIFIED_SCRIPT \
+ --always-trust \
+ --decrypt $UNVERIFIED_SCRIPT"