From 5b506c2974852b1e0939d8727cc9f14af9de2bc4 Mon Sep 17 00:00:00 2001 From: saeedjohar Date: Thu, 15 Oct 2020 20:16:10 +0300 Subject: [PATCH] PPP installation created for twilio --- ppp_installer/install_supersim.sh | 78 +++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 ppp_installer/install_supersim.sh diff --git a/ppp_installer/install_supersim.sh b/ppp_installer/install_supersim.sh new file mode 100644 index 0000000..5f23812 --- /dev/null +++ b/ppp_installer/install_supersim.sh @@ -0,0 +1,78 @@ +#!/bin/sh + +YELLOW='\033[1;33m' +RED='\033[0;31m' +BLUE='\033[1;34m' +SET='\033[0m' + +echo "${YELLOW}Installing PPP for Sixfab Cellular IoT Shield/HAT with Twilio Super SIM${SET}" + +echo "${YELLOW}Downloading setup files${SET}" +wget --no-check-certificate https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/master/ppp_installer/chat-connect -O chat-connect + +if [ $? -ne 0 ]; then + echo "${RED}Download failed${SET}" + exit 1; +fi + +wget --no-check-certificate https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/master/ppp_installer/chat-disconnect -O chat-disconnect + +if [ $? -ne 0 ]; then + echo "${RED}Download failed${SET}" + exit 1; +fi + +wget --no-check-certificate https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/master/ppp_installer/provider -O provider + +if [ $? -ne 0 ]; then + echo "${RED}Download failed${SET}" + exit 1; +fi + +echo "${YELLOW}ppp and wiringpi (gpio tool) install${SET}" +apt install ppp wiringpi + +mkdir -p /etc/chatscripts +sed -i "/#EXTRA/d" chat-connect + +mv chat-connect /etc/chatscripts/ +mv chat-disconnect /etc/chatscripts/ + +mkdir -p /etc/ppp/peers +sed -i "s/#APN/super/" provider +sed -i "s/#DEVICE/ttyUSB3/" provider +mv provider /etc/ppp/peers/provider + +if ! (grep -q 'sudo route' /etc/ppp/ip-up ); then + echo "sudo route del default" >> /etc/ppp/ip-up + echo "sudo route add default ppp0" >> /etc/ppp/ip-up +fi + +while [ 1 ] +do + echo "${YELLOW}Do you want to activate auto connect/reconnect service at R.Pi boot up? [Y/n] ${SET}" + read auto_reconnect + + case $auto_reconnect in + [Yy]* ) echo "${YELLOW}Downloading setup file${SET}" + + wget --no-check-certificate https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/master/ppp_installer/reconnect_service -O reconnect.service + + wget --no-check-certificate https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/master/ppp_installer/reconnect_cellulariot -O reconnect.sh + + mv reconnect.sh /usr/src/ + mv reconnect.service /etc/systemd/system/ + + systemctl daemon-reload + systemctl enable reconnect.service + + break;; + + [Nn]* ) echo "${YELLOW}To connect to internet run ${BLUE}\"sudo pon\"${YELLOW} and to disconnect run ${BLUE}\"sudo poff\" ${SET}" + break;; + *) echo "${RED}Wrong Selection, Select among Y or n${SET}";; + esac +done + +read -p "Press ENTER key to reboot" ENTER +reboot