PPP installation created for twilio

This commit is contained in:
saeedjohar 2020-10-15 20:16:10 +03:00
parent ed50ff9452
commit 5b506c2974

View File

@ -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