perf: add installation requirements for automatic connection (#34)

This commit is contained in:
saeedjohar 2022-04-26 17:03:13 +03:00 committed by GitHub
parent 1b4fd90a1d
commit fe4ad2411f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,7 +40,6 @@ function colored_echo
echo -e "$COLOR$1 ${SET}"
}
# Check Sixfab path
if [[ -e $SIXFAB_PATH ]]; then
colored_echo "Sixfab path already exist!" ${SET}
@ -83,45 +82,16 @@ colored_echo "Checking requirements..."
colored_echo "Updating headers..."
sudo apt-get update
colored_echo "Installing python3 if it is required..."
if ! [ -x "$(command -v python3)" ]; then
sudo apt-get install python3 -y
if [[ $? -ne 0 ]]; then colored_echo "Process failed" ${RED}; exit 1; fi
fi
colored_echo "Installing pip3 if it is required..."
if ! [ -x "$(command -v pip3)" ]; then
sudo apt-get install python3-pip -y
if [[ $? -ne 0 ]]; then colored_echo "Process failed" ${RED}; exit 1; fi
fi
colored_echo "Installing or upgrading atcom if it is required..."
pip3 install -U atcom
if [[ $? -ne 0 ]]; then colored_echo "Process failed" ${RED}; exit 1; fi
source ~/.profile
if [[ $? -ne 0 ]]; then colored_echo "Process failed" ${RED}; exit 1; fi
colored_echo "Copying setup files..."
cp $SOURCE_PATH/chat-connect chat-connect
cp $SOURCE_PATH/chat-disconnect chat-disconnect
cp $SOURCE_PATH/provider provider
colored_echo "ppp and wiringpi (gpio tool) installing..."
apt-get install ppp wiringpi -y
colored_echo "ppp installing..."
apt-get install ppp -y
if [[ $? -ne 0 ]]; then colored_echo "Process failed" ${RED}; exit 1; fi
# test wiringpi and fix if there is any issue
gpio readall | grep Oops > /dev/null
if [[ $? -ne 1 ]]; then
colored_echo "Known wiringpi issue is detected! Wiringpi is updating..."
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb
fi
colored_echo "What is your carrier APN?"
read carrierapn
@ -223,8 +193,40 @@ do
colored_echo "You chose $auto_reconnect" ${GREEN}
case $auto_reconnect in
[Yy]* ) colored_echo "Copying setup file..."
[Yy]* )
colored_echo "Installing python3 if it is required..."
if ! [ -x "$(command -v python3)" ]; then
sudo apt-get install python3 -y
if [[ $? -ne 0 ]]; then colored_echo "Process failed" ${RED}; exit 1; fi
fi
colored_echo "Installing pip3 if it is required..."
if ! [ -x "$(command -v pip3)" ]; then
sudo apt-get install python3-pip -y
if [[ $? -ne 0 ]]; then colored_echo "Process failed" ${RED}; exit 1; fi
fi
colored_echo "Installing or upgrading atcom if it is required..."
pip3 install -U atcom
if [[ $? -ne 0 ]]; then colored_echo "Process failed" ${RED}; exit 1; fi
source ~/.profile
if [[ $? -ne 0 ]]; then colored_echo "Process failed" ${RED}; exit 1; fi
colored_echo "wiringpi (gpio tool) installing..."
apt-get install wiringpi -y
if [[ $? -ne 0 ]]; then colored_echo "WiringPi installation failed \nTry manual insatallation" ${RED} ; fi
# test wiringpi and fix if there is any issue
gpio readall | grep Oops > /dev/null
if [[ $? -ne 1 ]]; then
colored_echo "Known wiringPi issue is detected! WiringPi is updating..."
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb
fi
colored_echo "Copying setup file..."
cp $SOURCE_PATH/$SERVICE_NAME $SERVICE_NAME
cp $SOURCE_PATH/functions.sh functions.sh
cp $SOURCE_PATH/configs.sh configs.sh