mirror of
https://github.com/sixfab/Sixfab_PPP_Installer
synced 2024-12-25 02:31:37 +00:00
jetson install & service install
This commit is contained in:
parent
d920f6d0dd
commit
c905901dd0
@ -11,8 +11,8 @@ BRANCH=master
|
||||
SOURCE_PATH="$REPO_PATH/$BRANCH/src"
|
||||
SCRIPT_PATH="$REPO_PATH/$BRANCH/src/reconnect_scripts"
|
||||
RECONNECT_SCRIPT_NAME="ppp_reconnect.sh"
|
||||
MANAGER_SCRIPT_NAME="ppp_connection_manager.sh"
|
||||
SERVICE_NAME="ppp_connection_manager.service"
|
||||
MANAGER_SCRIPT_NAME="jetson_ppp_connection_manager.sh"
|
||||
SERVICE_NAME="jetson_ppp_connection_manager.service"
|
||||
|
||||
YELLOW='\033[1;33m'
|
||||
RED='\033[0;31m'
|
||||
@ -137,5 +137,51 @@ if ! (grep -q 'sudo route' /etc/ppp/ip-up ); then
|
||||
echo "sudo route add default ppp0" >> /etc/ppp/ip-up
|
||||
fi
|
||||
|
||||
while [ 1 ]
|
||||
do
|
||||
colored_echo "Do you want to activate auto connect/reconnect service at R.Pi boot up? [Y/n]"
|
||||
read auto_reconnect
|
||||
|
||||
colored_echo "You chose $auto_reconnect" ${GREEN}
|
||||
|
||||
case $auto_reconnect in
|
||||
[Yy]* ) colored_echo "Copying setup file..."
|
||||
|
||||
wget --no-check-certificate $SOURCE_PATH/$SERVICE_NAME -O $SERVICE_NAME
|
||||
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
|
||||
|
||||
wget --no-check-certificate $SOURCE_PATH/functions.sh -O functions.sh
|
||||
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
|
||||
|
||||
wget --no-check-certificate $SOURCE_PATH/configs.sh -O configs.sh
|
||||
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
|
||||
|
||||
wget --no-check-certificate $SOURCE_PATH/jetson_configure_modem.sh -O jetson_configure_modem.sh
|
||||
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
|
||||
|
||||
wget --no-check-certificate $SOURCE_PATH/$MANAGER_SCRIPT_NAME -O $MANAGER_SCRIPT_NAME
|
||||
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
|
||||
|
||||
# APN Configuration
|
||||
sed -i "s/SIM_APN/$carrierapn/" jetson_configure_modem.sh
|
||||
|
||||
mv functions.sh $PPP_PATH
|
||||
mv configs.sh $PPP_PATH
|
||||
mv jetson_configure_modem.sh $PPP_PATH
|
||||
mv $RECONNECT_SCRIPT_NAME $PPP_PATH
|
||||
mv $MANAGER_SCRIPT_NAME $PPP_PATH
|
||||
mv $SERVICE_NAME /etc/systemd/system/
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl enable $SERVICE_NAME
|
||||
|
||||
break;;
|
||||
|
||||
[Nn]* ) echo -e "${YELLOW}To connect to internet run ${BLUE}\"sudo pon\"${YELLOW} and to disconnect run ${BLUE}\"sudo poff\" ${SET}"
|
||||
break;;
|
||||
*) colored_echo "Wrong Selection, Select among Y or n" ${RED};;
|
||||
esac
|
||||
done
|
||||
|
||||
read -p "Press ENTER key to reboot" ENTER
|
||||
reboot
|
||||
|
85
src/jetson_configure_modem.sh
Normal file
85
src/jetson_configure_modem.sh
Normal file
@ -0,0 +1,85 @@
|
||||
#!/bin/bash
|
||||
|
||||
source functions.sh
|
||||
|
||||
# only for "2: 3G, 4G/LTE Base Shield"
|
||||
|
||||
# default arguments
|
||||
APN=${SIM_APN:-super}
|
||||
|
||||
### Modem configuration for RMNET/PPP mode ##################################
|
||||
debug "Checking APN and Modem Modem..."
|
||||
|
||||
# APN Configuration
|
||||
# -----------------
|
||||
atcom "AT+CGDCONT?" | grep $APN > /dev/null
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
atcom "AT+CGDCONT=1,\"IPV4V6\",\"$APN\""
|
||||
debug "APN is updated."
|
||||
fi
|
||||
|
||||
# Check the vendor
|
||||
# ON JETSON ONLY THE vendor:product ID is SHOWN
|
||||
lsusb | grep 2c7c >> /dev/null
|
||||
IS_QUECTEL=$?
|
||||
|
||||
|
||||
# Modem Mode Configuration
|
||||
# ------------------------
|
||||
# For Quectel
|
||||
if [[ $IS_QUECTEL -eq 0 ]]; then
|
||||
|
||||
# Quectel EC25-E
|
||||
lsusb | grep 0125 > /dev/null
|
||||
MODEL_EC25E=$?
|
||||
|
||||
if [[ $MODEL_EC25E -eq 0 ]]; then
|
||||
|
||||
# EC25 or derives.
|
||||
atcom "AT+QCFG=\"usbnet\"" | grep 0 > /dev/null
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
atcom "AT+QCFG=\"usbnet\",0"
|
||||
debug "PPP mode is activated."
|
||||
debug "Modem restarting..."
|
||||
|
||||
sleep 20
|
||||
|
||||
# Check modem is started
|
||||
route -n | grep wwan0 >> /dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo
|
||||
else
|
||||
# If modem don't reboot automatically, reset manually
|
||||
atcom "AT+CFUN=1,1" # rebooting modem
|
||||
sleep 20
|
||||
fi
|
||||
|
||||
# Check modem is started!
|
||||
for i in {1..120}; do
|
||||
route -n | grep wwan0 >> /dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo
|
||||
debug "Modem is restarted."
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
printf "*"
|
||||
done
|
||||
sleep 5 # wait until modem is ready
|
||||
fi
|
||||
fi
|
||||
|
||||
# Unknown
|
||||
else
|
||||
debug "The cellular module couldn't be detected!"
|
||||
exit 1
|
||||
fi
|
||||
### End of Modem configuration for RMNET/PPP mode ############################
|
||||
|
||||
|
||||
# Check the network is ready
|
||||
# --------------------------
|
||||
if check_network -eq 0; then exit 0; else debug "Network registration is failed!. Modem configuration is unsuccesfully ended!"; exit 1; fi
|
||||
|
13
src/jetson_ppp_connection_manager.service
Normal file
13
src/jetson_ppp_connection_manager.service
Normal file
@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=Jetson PPP Connection Manager
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/bin/bash jetson_ppp_connection_manager.sh
|
||||
WorkingDirectory=/opt/sixfab/ppp_connection_manager
|
||||
StandardOutput=inherit
|
||||
StandardError=inherit
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
20
src/jetson_ppp_connection_manager.sh
Normal file
20
src/jetson_ppp_connection_manager.sh
Normal file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
source functions.sh
|
||||
|
||||
for i in {1..4}; do
|
||||
bash jetson_configure_modem.sh
|
||||
|
||||
if [[ $MODEM_CONFIG -eq 0 ]]; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
if [[ $MODEM_CONFIG -eq 0 ]]; then
|
||||
bash ppp_reconnect.sh
|
||||
else
|
||||
debug "Modem configuration is failed multiple times!"
|
||||
debug "Checkout other troubleshooting steps on docs.sixfab.com."
|
||||
exit 1
|
||||
fi
|
Loading…
Reference in New Issue
Block a user