RPi2 Install Script

jerrm

Guru
Joined
Sep 23, 2015
Messages
838
Reaction score
405
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).

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)
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,206
Reaction score
5,228
Hate to say it but installing open source code over a Thanksgiving weekend is asking for trouble. We're dependent on dozens of other folks' servers, and they're all eating turkey or watching football. Yes, we could add additional checks but it still won't change the fact that the install is gonna fail. Either way, you'll have to start over on Monday morning preferably after California wakes up. Sorry.
 

Members online

Forum statistics

Threads
25,825
Messages
167,850
Members
19,250
Latest member
mark-curtis
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top