From b1a6f6848c4368393dbdc9d4f188d54ea6752872 Mon Sep 17 00:00:00 2001 From: Yasin Kaya Date: Wed, 18 Nov 2020 10:45:59 -0800 Subject: [PATCH] changed working directories --- ppp_installer/install.sh | 35 ++++++++++++++++++++++++++++++--- ppp_installer/reconnect_service | 4 ++-- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/ppp_installer/install.sh b/ppp_installer/install.sh index 8b26b22..d0829dc 100755 --- a/ppp_installer/install.sh +++ b/ppp_installer/install.sh @@ -1,11 +1,18 @@ #!/bin/bash +REPO=revision +SIXFAB_PATH="/opt/sixfab" +PPP_PATH="/opt/sixfab/ppp_connection_manager" + YELLOW='\033[1;33m' RED='\033[0;31m' BLUE='\033[1;34m' SET='\033[0m' -REPO=revision +function debug() +{ + echo $(date "+%Y/%m/%d - %H:%M:%S :") "$1" +} function colored_echo { @@ -14,6 +21,23 @@ function colored_echo } +# Check Sixfab path +if [[ -e $SIXFAB_PATH ]]; then + debug "Path already exist!" +else + sudo mkdir $SIXFAB_PATH + debug "Sixfab path is created." +fi + +# Check PPP path +if [[ -e $PPP_PATH ]]; then + debug "Path already exist!" +else + sudo mkdir $PPP_PATH + debug "PPP path is created." +fi + + colored_echo "Please choose your Sixfab Shield/HAT:" colored_echo "1: GSM/GPRS Shield" colored_echo "2: 3G, 4G/LTE Base Shield" @@ -119,7 +143,10 @@ do [Yy]* ) colored_echo "Downloading setup file..." wget --no-check-certificate https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/$REPO/ppp_installer/reconnect_service -O reconnect.service - + wget --no-check-certificate https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/$REPO/ppp_installer/functions.sh + wget --no-check-certificate https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/$REPO/ppp_installer/configs.sh + + if [ $shield_hat -eq 1 ]; then wget --no-check-certificate https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/$REPO/ppp_installer/reconnect_gprsshield -O reconnect.sh @@ -146,7 +173,9 @@ do fi - mv reconnect.sh /usr/src/ + mv reconnect.sh $PPP_PATH + mv functions.sh $PPP_PATH + mv configs.sh $PPP_PATH mv reconnect.service /etc/systemd/system/ systemctl daemon-reload diff --git a/ppp_installer/reconnect_service b/ppp_installer/reconnect_service index c3a9d65..aed5577 100644 --- a/ppp_installer/reconnect_service +++ b/ppp_installer/reconnect_service @@ -3,8 +3,8 @@ Description=PPP Auto Connection After=network.target [Service] -ExecStart=/bin/sh /usr/src/reconnect.sh -WorkingDirectory=/usr/src/ +ExecStart=/bin/bash reconnect.sh +WorkingDirectory=/opt/sixfab/ppp_connection_manager StandardOutput=inherit StandardError=inherit Restart=always