Created
November 29, 2013 13:23
-
-
Save tlatsas/7705629 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#Get the first IP from ifconfig. Ignore loopback. | |
SYSIP=$(ifconfig | awk -F'[: ]+' '/inet addr/ {print $4}' | grep -v "127.0.0.1" | head -n1) | |
if [ -z "${SYSIP}" ]; then | |
#THE SKY IS FALLING! | |
#Okay, not really. Couldn't determine IP address. | |
TEXT="To configure networking, login as 'root' and run the \`setup\` command." | |
else | |
if [ -f /var/lib/asterisk/static-http/index.html ]; then | |
#Asterisk-GUI | |
# Get the bindport from http.conf. Use 8088 if unset. | |
p=`awk -F'[= \t]' '/^bindport[ \t]?=[ \t]?/ {print $NF}' /etc/asterisk/http.conf` | |
PORT=${p:-8088} | |
up=`awk -F'[= \t]' '/^prefix[ \t]?=[ \t]?/ {print $NF}' /etc/asterisk/http.conf` | |
URIPREFIX=${up:+"${up}"/} | |
TEXT="To configure AsteriskNOW with Asterisk-GUI, point your web browser to http://${SYSIP}:${PORT}/${URIPREFIX}static/config/index.html" | |
elif [ -d /var/www/html/admin/ ]; then | |
#FreePBX | |
TEXT="To configure AsteriskNOW with FreePBX, point your web browser to http://${SYSIP}/" | |
else | |
#No GUI | |
TEXT="The IP address of your AsteriskNOW system is ${SYSIP}" | |
fi | |
fi | |
cat /etc/asterisknow-version > /etc/issue | |
echo -e "\n${TEXT}\n" >> /etc/issue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment