I'd recommend something like the below be added. It adds some (very) basic checks for download server accessibility before proceeding with the install that assumes all is OK.
For the Pi specifically, I've seen multiple incidents where the mirrors are down.
Today, pear.php.net seems to be down(not Pi specific).
For the Pi specifically, I've seen multiple incidents where the mirrors are down.
Today, pear.php.net seems to be down(not Pi specific).
Code:
--- IncrediblePBX13-12.3-raspbian.sh 2015-09-10 14:23:10.000000000 +0000
+++ IncrediblePBX13-12.3-raspbian.with.check.sh 2015-11-30 05:56:56.951953988 +0000
@@ -85,9 +85,13 @@
echo "Press Ctrl-C now if you do not wish to proceed. Otherwise..."
echo " "
read -p "Press Enter to proceed at your own risk..."
- apt-get update && apt-get upgrade -y
- touch /root/COPYING
- reboot
+ apt-get update && apt-get upgrade -y && {
+ touch /root/COPYING
+ reboot
+ } || {
+ echo -e "\n\nERROR: Could not update server\n\nAborting Install.\n"
+ exit
+ }
fi
echo "SUCCESS: Incredible PBX 13 installer detected Raspbian platform."
@@ -171,7 +175,37 @@
-o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
}
-apt-get update
+# Hosts used in install script. This may not be complete.
+hostlist="http://download.neorouter.com
+http://downloads.asterisk.org
+http://download.webmin.com
+http://incrediblepbx.com
+http://launchpadlibrarian.net
+http://pbxinaflash.com
+http://pear.php.net
+https://github.com
+http://sourceforge.net
+https://raw.githubusercontent.com
+http://srtp.sourceforge.net
+http://www.webmin.com
+"
+echo "Testing download hosts connectivity..."
+for host in $hostlist; do
+ echo -n " $host..."
+ wget -t2 -T10 -O - $host &> /dev/null && echo success. || {
+ echo -e "FAILED\n\nERROR: Could not connect to $host\n\nAborting Install.\n"
+ exit
+ }
+done
+
+# Test an apt-get update for success
+echo ""
+echo "Testing apt-get connectivity..."
+apt-get update || {
+ echo -e "\n\nERROR: Could not update package list\n\nAborting Install.\n"
+ exit
+}
+
apt-get dist-upgrade -y
# Installing packages needed to work with Asterisk (note libmpg123-0 and mpg123 are built from source below because of buggy packages)