If Pro or Carrier version is chosen for installation - check if deb.sipwise.com/sppro repo is accessible Change-Id: I221c53c3dfce4b96792da116e13a00df26476f51changes/33/19833/3
parent
2532db8f90
commit
cc89b646f1
@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
SIPWISE_REPO_HOST="deb.sipwise.com"
|
||||||
|
SIPWISE_REPO_TRANSPORT="https"
|
||||||
|
|
||||||
|
CMD_LINE=$(cat /proc/cmdline)
|
||||||
|
stringInString() {
|
||||||
|
local to_test_="$1" # matching pattern
|
||||||
|
local source_="$2" # string to search in
|
||||||
|
case "${source_}" in *${to_test_}*) return 0;; esac
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
checkBootParam() {
|
||||||
|
stringInString " $1" "${CMD_LINE}"
|
||||||
|
return "$?"
|
||||||
|
}
|
||||||
|
|
||||||
|
getBootParam() {
|
||||||
|
local param_to_search="$1"
|
||||||
|
local result=''
|
||||||
|
|
||||||
|
stringInString " ${param_to_search}=" "${CMD_LINE}" || return 1
|
||||||
|
result="${CMD_LINE##*$param_to_search=}"
|
||||||
|
result="${result%%[ ]*}"
|
||||||
|
echo "${result}"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if checkBootParam ngcppro ; then
|
||||||
|
if checkBootParam "sipwiserepotransport=" ; then
|
||||||
|
SIPWISE_REPO_TRANSPORT=$(getBootParam sipwiserepotransport)
|
||||||
|
fi
|
||||||
|
|
||||||
|
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
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
Loading…
Reference in new issue