diff --git a/templates/scripts/includes/check-for-network b/templates/scripts/includes/check-for-network index 1d88286..a83e276 100755 --- a/templates/scripts/includes/check-for-network +++ b/templates/scripts/includes/check-for-network @@ -15,13 +15,10 @@ EXIT_CODE=1 GW="$(route -n | awk '/^0\.0\.0\.0/{print $2}')" GWDEV="$(route -n | awk '/^0\.0\.0\.0/{print $NF}')" -NMAP="$(nmap -sP --host_timeout 4000 --max_rtt_timeout 4000ms "$GW" 2>/dev/null)" -if [ $? -eq 0 ]; then - if ! echo "$NMAP" | grep -q "0 hosts up" ; then - STATUS="Online (${GWDEV})" - EXIT_CODE=0 - fi +if ping -c 3 "${GW}" >/dev/null ; then + STATUS="Online (${GWDEV})" + EXIT_CODE=0 fi printf "%s\n" "$STATUS" diff --git a/templates/scripts/includes/check_installing_version.sh b/templates/scripts/includes/check_installing_version.sh index da601fa..7cd1627 100755 --- a/templates/scripts/includes/check_installing_version.sh +++ b/templates/scripts/includes/check_installing_version.sh @@ -37,13 +37,11 @@ if checkBootParam ngcppro ; then if checkBootParam "sipwiserepo=" ; then SIPWISE_REPO_HOST=$(getBootParam sipwiserepo) fi + URL="${SIPWISE_REPO_TRANSPORT}://${SIPWISE_REPO_HOST}/sppro/" - accessible=$( curl -s -o /dev/null -w "%{http_code}" "${URL}" 2>/dev/null || true ) err_message="You are installing Pro/Carrier version but ${SIPWISE_REPO_TRANSPORT}://${SIPWISE_REPO_HOST}/sppro/ repository not accessible. Please contact support@sipwise.com" - while [[ "${accessible}" != 200 ]]; do - if dialog --yes-label Retry --no-label Exit --yesno "${err_message}" 0 0 ; then - accessible=$( curl -s -o /dev/null -w "%{http_code}" "${URL}" 2>/dev/null || true ) - else + while ! wget -q -T 10 -O /dev/null "${URL}" ; do + if ! dialog --yes-label Retry --no-label Exit --yesno "${err_message}" 0 0 ; then exit 1 fi done diff --git a/templates/scripts/includes/install_required_packages.sh b/templates/scripts/includes/install_required_packages.sh new file mode 100755 index 0000000..f1964ac --- /dev/null +++ b/templates/scripts/includes/install_required_packages.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +set -e + +echo "Updating list of packages..." +apt-get update 1>/dev/null +echo "Installing required packages..." +apt-get install --assume-yes \ + isomd5sum diff --git a/templates/scripts/includes/verify_iso_image.sh b/templates/scripts/includes/verify_iso_image.sh index 3e399ad..829b24d 100755 --- a/templates/scripts/includes/verify_iso_image.sh +++ b/templates/scripts/includes/verify_iso_image.sh @@ -4,8 +4,6 @@ set -e message="Do you want to check the install media?" if dialog --yes-label Yes --no-label Skip --yesno "${message}" 0 0 ; then - sudo apt-get update 1>/dev/null || true - sudo apt-get install isomd5sum --assume-yes 1>/dev/null || true if ! result="$( { checkisomd5 /dev/sr0 1>/dev/null; } 2>&1 )" ; then err_message="Integrity check failed. Reason: ${result}. Abort installation or continue anyway?" if dialog --yes-label Exit --no-label Continue --yesno "${err_message}" 0 0 ; then diff --git a/templates/scripts/main.sh b/templates/scripts/main.sh index e06d9f3..ffacefd 100755 --- a/templates/scripts/main.sh +++ b/templates/scripts/main.sh @@ -145,6 +145,7 @@ deploy() { install_sipwise_keyring "${scripts_dir}/network_configuration.sh" "${scripts_dir}/check_installing_version.sh" +"${scripts_dir}/install_required_packages.sh" "${scripts_dir}/verify_iso_image.sh" prompt_for_target check_for_existing_pvs