Sixfab_PPP_Installer/install_ppp_jetson.sh

100 lines
2.7 KiB
Bash
Raw Normal View History

2019-07-12 14:38:39 +00:00
#!/bin/sh
2019-11-25 11:37:55 +00:00
'
2019-07-12 14:40:35 +00:00
Created on July 12, 2019 by Saeed Johar (saeedjohar)
'
2019-07-12 14:38:39 +00:00
YELLOW='\033[1;33m'
RED='\033[0;31m'
BLUE='\033[1;34m'
SET='\033[0m'
echo "${YELLOW}Please choose your Sixfab Shield/HAT:${SET}"
echo "${YELLOW}1: GSM/GPRS Shield${SET}"
echo "${YELLOW}2: 3G, 4G/LTE Base Shield${SET}"
echo "${YELLOW}3: Cellular IoT App Shield${SET}"
echo "${YELLOW}4: Cellular IoT HAT${SET}"
2020-03-26 08:49:13 +00:00
echo "${YELLOW}5: Tracker HAT${SET}"
echo "${YELLOW}6: 3G/4G Base HAT${SET}"
2019-07-12 14:38:39 +00:00
read shield_hat
case $shield_hat in
1) echo "${YELLOW}You chose GSM/GPRS Shield${SET}";;
2) echo "${YELLOW}You chose Base Shield${SET}";;
3) echo "${YELLOW}You chose CellularIoT Shield${SET}";;
4) echo "${YELLOW}You chose CellularIoT HAT${SET}";;
2020-03-26 08:49:13 +00:00
5) echo "${YELLOW}You chose Tracker HAT${SET}";;
6) echo "${YELLOW}You chose 3G/4G Base HAT${SET}";;
2019-07-12 14:38:39 +00:00
*) echo "${RED}Wrong Selection, exiting${SET}"; exit 1;
esac
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 install${SET}"
apt-get install ppp -y
2019-07-12 14:38:39 +00:00
echo "${YELLOW}What is your carrier APN?${SET}"
read carrierapn
while [ 1 ]
do
echo "${YELLOW}Does your carrier need username and password? [Y/n]${SET}"
read usernpass
case $usernpass in
[Yy]* ) while [ 1 ]
do
echo "${YELLOW}Enter username${SET}"
read username
echo "${YELLOW}Enter password${SET}"
read password
sed -i "s/noauth/#noauth\nuser \"$username\"\npassword \"$password\"/" provider
break
done
break;;
[Nn]* ) break;;
*) echo "${RED}Wrong Selection, Select among Y or n${SET}";;
esac
done
echo "${YELLOW}What is your device communication PORT? (ttyS0/ttyUSB3/etc.)${SET}"
read devicename
mkdir -p /etc/chatscripts
mv chat-connect /etc/chatscripts/
mv chat-disconnect /etc/chatscripts/
mkdir -p /etc/ppp/peers
sed -i "s/#APN/$carrierapn/" provider
sed -i "s/#DEVICE/$devicename/" provider
mv provider /etc/ppp/peers/provider
2020-03-26 09:49:07 +00:00
if ! (grep -q 'sudo route' /etc/ppp/ip-up ); then
2019-07-12 14:38:39 +00:00
echo "sudo route add default ppp0" >> /etc/ppp/ip-up
fi
read -p "Press ENTER key to reboot" ENTER
reboot