mirror of
https://github.com/sixfab/Sixfab_PPP_Installer
synced 2024-11-14 15:24:52 +00:00
763eca71b3
2. Added -y for ppp installation 3. Removed unused commands
78 lines
2.3 KiB
Bash
78 lines
2.3 KiB
Bash
#!/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 -y
|
|
|
|
mkdir -p /etc/chatscripts
|
|
|
|
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
|