Problem with install script

I think there maybe an issue with the current first run script.
I have used this CD before successfully and I think that the script is downloaded from FreePBX servers on each install.
Here is the first install log - last few lines are the relevant part. Seems to be an issue with the Sysadmin module.
I tried the script 3 times and I know the internet connection is ok (besides everything else downloads fine).

#INCLUDING stringent.sh # stringent.sh copyright michael potter 2008

stringent.sh is intended to reduce the problems associated with

using bash by turning on bash options that make errors more

apparent. This will not eliminate problems and I am sure there

is some case where some problem will be made worse.

USE AT YOUR OWN RISK.

set -o errexit # errexit first

  • set -o errexit
    set -o noclobber
  • set -o noclobber
    set -o nounset
  • set -o nounset
    set -o pipefail # if you fail on this line, get a newer version of bash.
  • set -o pipefail

function traperr
{
declare -i i;
declare -i nestlevel;
declare Message=${1:-""}

nestlevel=${#FUNCNAME[@]}

if (( $nestlevel <= 2 ))
then
echo “ERROR: ${BASH_SOURCE[1]}:${BASH_LINENO[0]} $Message” >&2
else
echo “ERROR: ${FUNCNAME[1]}(${BASH_SOURCE[1]}:~${BASH_LINENO[0]}) $Message” >&2
for (( i = 2 ; i < $nestlevel ; i++ ))
do
echo " ${FUNCNAME[$i]}(${BASH_SOURCE[$i]}:~${BASH_LINENO[($i-1)]})" >&2
done
fi

if BASH_SUBSHELL is 0, then script will exit anyway.

if (( $BASH_SUBSHELL >= 3 ))
then
kill $$
fi
set +x +v
clear && echo -e "Some firstboot error occured, and the system is not properly setup.\nCheck to see if you have internet access and re-run /etc/pbx-first-boot.sh\nPress enter to continue"
read foo
echo changing console to ${ORIGCONSOLE}
chvt ${ORIGCONSOLE}
exit 1
}

function traperrsimple
{

Use this function if the above function fails

echo “ERROR: ${BASH_SOURCE[0]} ${LINENO}” >&2

if BASH_SUBSHELL is 0, then script will exit anyway.

if (( $BASH_SUBSHELL >= 1 ))
then
kill $$
fi
}

set -o errtrace

  • set -o errtrace
    trap traperr ERR
  • trap traperr ERR

function errexiton
{
set -o errexit
trap traperr ERR
}

function errexitoff
{
set +o errexit
trap ‘’ ERR
}
#END INCLUDE

test for internet and send back to freepbx

INTERFACE=$(ip route show | awk ’ /^default/ { print $5 }’)
ip route show | awk ’ /^default/ { print $5 }’
++ ip route show
++ awk ’ /^default/ { print $5 }’

  • INTERFACE=eth0
    MACADDR=$(ip -o link show ${INTERFACE} | awk ‘/link/ {print $11}’)
    ip -o link show ${INTERFACE} | awk ‘/link/ {print $11}’
    ++ ip -o link show eth0
    ++ awk ‘/link/ {print $11}’
  • MACADDR=00:14:5e:46:6a:eb
    MACHASH=$(echo -en ${MACADDR} | md5sum - | awk ‘/-/ {print $1}’)
    echo -en ${MACADDR} | md5sum - | awk ‘/-/ {print $1}’
    ++ echo -en 00:14:5e:46:6a:eb
    ++ md5sum -
    ++ awk ‘/-/ {print $1}’
  • MACHASH=5593970d58201027d2bec6b69a8d2a42
    ARCH=$(uname -m)
    uname -m
    ++ uname -m
  • ARCH=x86_64
    FREEPBXVERS=$(head -n 1 /etc/asterisk/freepbxdistro-version)
    head -n 1 /etc/asterisk/freepbxdistro-version
    ++ head -n 1 /etc/asterisk/freepbxdistro-version
  • FREEPBXVERS=1.812.210.57-1
    INSTALLTYPE=$(cat /installed-version | sed -e ‘s/.kickstart-([^.])./\1/’)
    cat /installed-version | sed -e 's/.kickstart-([^.]).
    /\1/’
    ++ cat /installed-version
    ++ sed -e ‘s/.kickstart-([^.]).*/\1/’
  • INSTALLTYPE=raid
    UARETURN=$(curl -s -m 30 -A “FreePBX Firstboot FreePBX-${FREEPBXVERS} ${ARCH} ${INSTALLTYPE}” --data mac=${MACADDR} --data mhash=${MACHASH} http://kickstart.freepbxdistro.org/install-log/)
    curl -s -m 30 -A “FreePBX Firstboot FreePBX-${FREEPBXVERS} ${ARCH} ${INSTALLTYPE}” --data mac=${MACADDR} --data mhash=${MACHASH} http://kickstart.freepbxdistro.org/install-log/
    ++ curl -s -m 30 -A ‘FreePBX Firstboot FreePBX-1.812.210.57-1 x86_64 raid’ --data mac=00:14:5e:46:6a:eb --data mhash=5593970d58201027d2bec6b69a8d2a42 http://kickstart.freepbxdistro.org/install-log/
  • UARETURN=’{“status”:“passed”,“data”:{“ua”:“FreePBX Firstboot FreePBX-1.812.210.57-1 x86_64 raid”,“ipaddr”:“212.56.97.163”,“test”:0,“mac”:“00:14:5e:46:6a:eb”,“mhash”:“5593970d58201027d2bec6b69a8d2a42”}}’

echo ${UARETURN} | grep ‘passed’

  • echo ‘{“status”:“passed”,“data”:{“ua”:"FreePBX’ Firstboot FreePBX-1.812.210.57-1 x86_64 ‘raid",“ipaddr”:“212.56.97.163”,“test”:0,“mac”:“00:14:5e:46:6a:eb”,“mhash”:“5593970d58201027d2bec6b69a8d2a42”}}’
  • grep passed
    {“status”:“passed”,“data”:{“ua”:“FreePBX Firstboot FreePBX-1.812.210.57-1 x86_64 raid”,“ipaddr”:“212.56.97.163”,“test”:0,“mac”:“00:14:5e:46:6a:eb”,“mhash”:“5593970d58201027d2bec6b69a8d2a42”}}

known good return{“status”:“passed”,“data”:{“ua”:“FreePBX Firstboot FreePBX-1.810.210.57 i386 raid”,“ipaddr”:“98.92.113.190”,“mac”:“00:13:e8:dc:ba:47”,“mhash”:“b95057354699ec012de93ac1b833ffd4”,“test”:1}}

Enable modules that in 2.10 are not being enabled from the RPM

errexitoff

  • errexitoff
  • set +o errexit
  • trap ‘’ ERR
    sudo -u asterisk /var/lib/asterisk/bin/module_admin enable fw_ari
  • sudo -u asterisk /var/lib/asterisk/bin/module_admin enable fw_ari
    The following error(s) occured:
  • Module fw_ari is already enabled
    sudo -u asterisk /var/lib/asterisk/bin/module_admin enable framework
  • sudo -u asterisk /var/lib/asterisk/bin/module_admin enable framework
    The following error(s) occured:
  • Module framework is already enabled
    sudo -u asterisk /var/lib/asterisk/bin/module_admin disable userpaneltab
  • sudo -u asterisk /var/lib/asterisk/bin/module_admin disable userpaneltab
    The following error(s) occured:
  • Specified module not found
    sudo -u asterisk /var/lib/asterisk/bin/module_admin disable fw_fop
  • sudo -u asterisk /var/lib/asterisk/bin/module_admin disable fw_fop
    The following error(s) occured:
  • Specified module not found
    sudo -u asterisk /var/lib/asterisk/bin/retrieve_conf
  • sudo -u asterisk /var/lib/asterisk/bin/retrieve_conf
    found language dir fr for directory, not installed on system, skipping
    Added to globals: ASTETCDIR = /etc/asterisk
    Added to globals: ASTMODDIR = /usr/lib/asterisk/modules
    Added to globals: ASTVARLIBDIR = /var/lib/asterisk
    Added to globals: ASTAGIDIR = /var/lib/asterisk/agi-bin
    Added to globals: ASTSPOOLDIR = /var/spool/asterisk
    Added to globals: ASTRUNDIR = /var/run/asterisk
    Added to globals: ASTLOGDIR = /var/log/asterisk
    Added to globals: CWINUSEBUSY = true
    Added to globals: AMPMGRUSER = admin
    Added to globals: AMPMGRPASS = amp111
    Added to globals: AMPDBENGINE = mysql
    Added to globals: AMPDBHOST = localhost
    Added to globals: AMPDBNAME = asterisk
    Added to globals: AMPDBUSER = freepbxuser
    Added to globals: AMPDBPASS = ftvpNiiv5XPf
    Added to globals: VMX_CONTEXT = from-internal
    Added to globals: VMX_PRI = 1
    Added to globals: VMX_TIMEDEST_CONTEXT =
    Added to globals: VMX_TIMEDEST_EXT = dovm
    Added to globals: VMX_TIMEDEST_PRI = 1
    Added to globals: VMX_LOOPDEST_CONTEXT =
    Added to globals: VMX_LOOPDEST_EXT = dovm
    Added to globals: VMX_LOOPDEST_PRI = 1
    Added to globals: MIXMON_DIR =
    Added to globals: MIXMON_POST =
    Please update your modules and reload Asterisk by browsing to your server.
    sudo -u asterisk /var/lib/asterisk/bin/module_admin reload
  • sudo -u asterisk /var/lib/asterisk/bin/module_admin reload
    Successfully reloaded

pull in all freepbx modules and load them

which amportal chown
which amportal
++ which amportal

  • /usr/local/sbin/amportal chown

Fetching FreePBX settings with gen_amp_conf.php…

SETTING FILE PERMISSIONS
Permissions OK
sudo -u asterisk /var/lib/asterisk/bin/module_admin installlocal

  • sudo -u asterisk /var/lib/asterisk/bin/module_admin installlocal
    All modules up to date.
    sudo -u asterisk /var/lib/asterisk/bin/module_admin upgradeall
  • sudo -u asterisk /var/lib/asterisk/bin/module_admin upgradeall
    no repos specified, using: [standard] from last GUI settings

Up to date.
sudo -u asterisk /var/lib/asterisk/bin/module_admin uninstall backup

  • sudo -u asterisk /var/lib/asterisk/bin/module_admin uninstall backup
    Module backup successfully uninstalled
    sudo -u asterisk /var/lib/asterisk/bin/module_admin install backup
  • sudo -u asterisk /var/lib/asterisk/bin/module_admin install backup
    added default backup servers
    added default backup templates
    Module backup successfully installed
    sudo -u asterisk /var/lib/asterisk/bin/module_admin installlocal
  • sudo -u asterisk /var/lib/asterisk/bin/module_admin installlocal
    All modules up to date.
    sudo -u asterisk /var/lib/asterisk/bin/module_admin upgradeall
  • sudo -u asterisk /var/lib/asterisk/bin/module_admin upgradeall
    no repos specified, using: [standard] from last GUI settings

Up to date.
sudo -u asterisk /var/lib/asterisk/bin/retrieve_conf

  • sudo -u asterisk /var/lib/asterisk/bin/retrieve_conf
    found language dir fr for directory, not installed on system, skipping
    Added to globals: ASTETCDIR = /etc/asterisk
    Added to globals: ASTMODDIR = /usr/lib/asterisk/modules
    Added to globals: ASTVARLIBDIR = /var/lib/asterisk
    Added to globals: ASTAGIDIR = /var/lib/asterisk/agi-bin
    Added to globals: ASTSPOOLDIR = /var/spool/asterisk
    Added to globals: ASTRUNDIR = /var/run/asterisk
    Added to globals: ASTLOGDIR = /var/log/asterisk
    Added to globals: CWINUSEBUSY = true
    Added to globals: AMPMGRUSER = admin
    Added to globals: AMPMGRPASS = amp111
    Added to globals: AMPDBENGINE = mysql
    Added to globals: AMPDBHOST = localhost
    Added to globals: AMPDBNAME = asterisk
    Added to globals: AMPDBUSER = freepbxuser
    Added to globals: AMPDBPASS = ftvpNiiv5XPf
    Added to globals: VMX_CONTEXT = from-internal
    Added to globals: VMX_PRI = 1
    Added to globals: VMX_TIMEDEST_CONTEXT =
    Added to globals: VMX_TIMEDEST_EXT = dovm
    Added to globals: VMX_TIMEDEST_PRI = 1
    Added to globals: VMX_LOOPDEST_CONTEXT =
    Added to globals: VMX_LOOPDEST_EXT = dovm
    Added to globals: VMX_LOOPDEST_PRI = 1
    Added to globals: MIXMON_DIR =
    Added to globals: MIXMON_POST =
    Please update your modules and reload Asterisk by browsing to your server.
    sudo -u asterisk /var/lib/asterisk/bin/module_admin reload
  • sudo -u asterisk /var/lib/asterisk/bin/module_admin reload
    Successfully reloaded
    sudo -u asterisk /var/lib/asterisk/bin/module_admin download sysadmin
  • sudo -u asterisk /var/lib/asterisk/bin/module_admin download sysadmin

Downloading 0 of 162989 (0%)
Downloading 2628 of 162989 (2%)
Downloading 4076 of 162989 (3%)
Downloading 5524 of 162989 (3%)
Downloading 6972 of 162989 (4%)
Downloading 8420 of 162989 (5%)
Downloading 9868 of 162989 (6%)
Downloading 11316 of 162989 (7%)
Downloading 12764 of 162989 (8%)
Downloading 14212 of 162989 (9%)
Downloading 15660 of 162989 (10%)
Downloading 17108 of 162989 (10%)
Downloading 18556 of 162989 (11%)
Downloading 20004 of 162989 (12%)
Downloading 21452 of 162989 (13%)
Downloading 22900 of 162989 (14%)
Downloading 24348 of 162989 (15%)
Downloading 25796 of 162989 (16%)
Downloading 27244 of 162989 (17%)
Downloading 28692 of 162989 (18%)
Downloading 30140 of 162989 (18%)
Downloading 31588 of 162989 (19%)
Downloading 33036 of 162989 (20%)
Downloading 34484 of 162989 (21%)
Downloading 35932 of 162989 (22%)
Downloading 37380 of 162989 (23%)
Downloading 38828 of 162989 (24%)
Downloading 40276 of 162989 (25%)
Downloading 41724 of 162989 (26%)
Downloading 43172 of 162989 (26%)
Downloading 44620 of 162989 (27%)
Downloading 46068 of 162989 (28%)
Downloading 47516 of 162989 (29%)
Downloading 48964 of 162989 (30%)
Downloading 50412 of 162989 (31%)
Downloading 51860 of 162989 (32%)
Downloading 53308 of 162989 (33%)
Downloading 54756 of 162989 (34%)
Downloading 56204 of 162989 (34%)
Downloading 57652 of 162989 (35%)
Downloading 59100 of 162989 (36%)
Downloading 60548 of 162989 (37%)
Downloading 61996 of 162989 (38%)
Downloading 63444 of 162989 (39%)
Downloading 64892 of 162989 (40%)
Downloading 66340 of 162989 (41%)
Downloading 67788 of 162989 (42%)
Downloading 69236 of 162989 (42%)
Downloading 70684 of 162989 (43%)
Downloading 72132 of 162989 (44%)
Downloading 73580 of 162989 (45%)
Downloading 75028 of 162989 (46%)
Downloading 76476 of 162989 (47%)
Downloading 77924 of 162989 (48%)
Downloading 79372 of 162989 (49%)
Downloading 80820 of 162989 (50%)
Downloading 82268 of 162989 (50%)
Downloading 83716 of 162989 (51%)
Downloading 85164 of 162989 (52%)
Downloading 86612 of 162989 (53%)
Downloading 88060 of 162989 (54%)
Downloading 89508 of 162989 (55%)
Downloading 90956 of 162989 (56%)
Downloading 92404 of 162989 (57%)
Downloading 93852 of 162989 (58%)
Downloading 95300 of 162989 (58%)
Downloading 96748 of 162989 (59%)
Downloading 98196 of 162989 (60%)
Downloading 99644 of 162989 (61%)
Downloading 101092 of 162989 (62%)
Downloading 102540 of 162989 (63%)
Downloading 103988 of 162989 (64%)
Downloading 105436 of 162989 (65%)
Downloading 106884 of 162989 (66%)
Downloading 108332 of 162989 (66%)
Downloading 109780 of 162989 (67%)
Downloading 111228 of 162989 (68%)
Downloading 112676 of 162989 (69%)
Downloading 114124 of 162989 (70%)
Downloading 115572 of 162989 (71%)
Downloading 117020 of 162989 (72%)
Downloading 118468 of 162989 (73%)
Downloading 119916 of 162989 (74%)
Downloading 121364 of 162989 (74%)
Downloading 122812 of 162989 (75%)
Downloading 124260 of 162989 (76%)
Downloading 125708 of 162989 (77%)
Downloading 127156 of 162989 (78%)
Downloading 128604 of 162989 (79%)
Downloading 130052 of 162989 (80%)
Downloading 131500 of 162989 (81%)
Downloading 132948 of 162989 (82%)
Downloading 134396 of 162989 (82%)
Downloading 135844 of 162989 (83%)
Downloading 137292 of 162989 (84%)
Downloading 138740 of 162989 (85%)
Downloading 140188 of 162989 (86%)
Downloading 141636 of 162989 (87%)
Downloading 143084 of 162989 (88%)
Downloading 144532 of 162989 (89%)
Downloading 145980 of 162989 (90%)
Downloading 147428 of 162989 (90%)
Downloading 148876 of 162989 (91%)
Downloading 150324 of 162989 (92%)
Downloading 151772 of 162989 (93%)
Downloading 153220 of 162989 (94%)
Downloading 154668 of 162989 (95%)
Downloading 156116 of 162989 (96%)
Downloading 157564 of 162989 (97%)
Downloading 159012 of 162989 (98%)
Downloading 160460 of 162989 (98%)
Downloading 161908 of 162989 (99%)
Downloading 162989 of 162989 (100%)

Untaring…Done
Module sysadmin successfully downloaded
sudo -u asterisk /var/lib/asterisk/bin/module_admin install sysadmin

  • sudo -u asterisk /var/lib/asterisk/bin/module_admin install sysadmin
    Module sysadmin successfully installed
    sudo -u asterisk /var/lib/asterisk/bin/module_admin install sysadmin
  • sudo -u asterisk /var/lib/asterisk/bin/module_admin install sysadmin
    Module sysadmin successfully installed
    sudo -u asterisk /var/lib/asterisk/bin/retrieve_conf
  • sudo -u asterisk /var/lib/asterisk/bin/retrieve_conf
    found language dir fr for directory, not installed on system, skipping
    Added to globals: ASTETCDIR = /etc/asterisk
    Added to globals: ASTMODDIR = /usr/lib/asterisk/modules
    Added to globals: ASTVARLIBDIR = /var/lib/asterisk
    Added to globals: ASTAGIDIR = /var/lib/asterisk/agi-bin
    Added to globals: ASTSPOOLDIR = /var/spool/asterisk
    Added to globals: ASTRUNDIR = /var/run/asterisk
    Added to globals: ASTLOGDIR = /var/log/asterisk
    Added to globals: CWINUSEBUSY = true
    Added to globals: AMPMGRUSER = admin
    Added to globals: AMPMGRPASS = amp111
    Added to globals: AMPDBENGINE = mysql
    Added to globals: AMPDBHOST = localhost
    Added to globals: AMPDBNAME = asterisk
    Added to globals: AMPDBUSER = freepbxuser
    Added to globals: AMPDBPASS = ftvpNiiv5XPf
    Added to globals: VMX_CONTEXT = from-internal
    Added to globals: VMX_PRI = 1
    Added to globals: VMX_TIMEDEST_CONTEXT =
    Added to globals: VMX_TIMEDEST_EXT = dovm
    Added to globals: VMX_TIMEDEST_PRI = 1
    Added to globals: VMX_LOOPDEST_CONTEXT =
    Added to globals: VMX_LOOPDEST_EXT = dovm
    Added to globals: VMX_LOOPDEST_PRI = 1
    Added to globals: MIXMON_DIR =
    Added to globals: MIXMON_POST =
    Please update your modules and reload Asterisk by browsing to your server.
    sudo -u asterisk /var/lib/asterisk/bin/module_admin reload
  • sudo -u asterisk /var/lib/asterisk/bin/module_admin reload
    Successfully reloaded
    errexiton
  • errexiton
  • set -o errexit
  • trap traperr ERR

Sysadmin RPM for Sysadmin Module Moved to Firstboot or we can create the incrontab

/usr/bin/yum -q -y install sysadmin-2.5.1-1

  • /usr/bin/yum -q -y install sysadmin-2.5.1-1
    http://yum.freepbxdistro.org/centos/5.7/addons/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404: Not Found
    Trying other mirror.
    Error: Cannot retrieve repository metadata (repomd.xml) for repository: addons. Please verify its path and try again
    traperr
    ++ traperr
    ++ declare -i i
    ++ declare -i nestlevel
    ++ declare Message=
    ++ nestlevel=2
    ++ (( 2 <= 2 ))
    ++ echo 'ERROR: ./pbx_first_boot.sh:135 '
    ERROR: ./pbx_first_boot.sh:135
    ++ (( 0 >= 3 ))
    ++ set +x +v
    e[He[JSome firstboot error occured, and the system is not properly setup.
    Check to see if you have internet access and re-run /etc/pbx-first-boot.sh
    Press enter to continue
    changing console to 1