added safe checks to wgets

This commit is contained in:
Yasin Kaya 2020-11-19 09:51:22 -08:00
parent 7b9687d4e7
commit e37b4d7d9e
3 changed files with 36 additions and 45 deletions

View File

@ -62,26 +62,15 @@ case $shield_hat in
esac esac
colored_echo "Downloading setup files..." colored_echo "Downloading setup files..."
wget --no-check-certificate $SOURCE_PATH/chat-connect -O chat-connect
if [ $? -ne 0 ]; then wget --no-check-certificate $SOURCE_PATH/chat-connect -O chat-connect
colored_echo "Download failed" ${RED} if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
exit 1;
fi
wget --no-check-certificate $SOURCE_PATH/chat-disconnect -O chat-disconnect wget --no-check-certificate $SOURCE_PATH/chat-disconnect -O chat-disconnect
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
if [ $? -ne 0 ]; then
colored_echo "Download failed" ${RED}
exit 1;
fi
wget --no-check-certificate $SOURCE_PATH/provider -O provider wget --no-check-certificate $SOURCE_PATH/provider -O provider
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
if [ $? -ne 0 ]; then
colored_echo "Download failed" ${RED}
exit 1;
fi
colored_echo "ppp and wiringpi (gpio tool) installing..." colored_echo "ppp and wiringpi (gpio tool) installing..."
apt-get install ppp wiringpi -y apt-get install ppp wiringpi -y
@ -146,35 +135,50 @@ do
[Yy]* ) colored_echo "Downloading setup file..." [Yy]* ) colored_echo "Downloading setup file..."
wget --no-check-certificate $SOURCE_PATH/$SERVICE_NAME wget --no-check-certificate $SOURCE_PATH/$SERVICE_NAME
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
wget --no-check-certificate $SOURCE_PATH/functions.sh wget --no-check-certificate $SOURCE_PATH/functions.sh
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
wget --no-check-certificate $SOURCE_PATH/configs.sh wget --no-check-certificate $SOURCE_PATH/configs.sh
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
wget --no-check-certificate $SOURCE_PATH/configure_modem.sh wget --no-check-certificate $SOURCE_PATH/configure_modem.sh
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
wget --no-check-certificate $SOURCE_PATH/$MANAGER_SCRIPT_NAME wget --no-check-certificate $SOURCE_PATH/$MANAGER_SCRIPT_NAME
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
if [ $shield_hat -eq 1 ]; then if [ $shield_hat -eq 1 ]; then
wget --no-check-certificate $SCRIPT_PATH/reconnect_gprsshield -O $RECONNECT_SCRIPT_NAME wget --no-check-certificate $SCRIPT_PATH/reconnect_gprsshield -O $RECONNECT_SCRIPT_NAME
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
elif [ $shield_hat -eq 2 ]; then elif [ $shield_hat -eq 2 ]; then
wget --no-check-certificate $SCRIPT_PATH/reconnect_baseshield -O $RECONNECT_SCRIPT_NAME wget --no-check-certificate $SCRIPT_PATH/reconnect_baseshield -O $RECONNECT_SCRIPT_NAME
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
elif [ $shield_hat -eq 3 ]; then elif [ $shield_hat -eq 3 ]; then
wget --no-check-certificate $SCRIPT_PATH/reconnect_cellulariot_app -O $RECONNECT_SCRIPT_NAME wget --no-check-certificate $SCRIPT_PATH/reconnect_cellulariot_app -O $RECONNECT_SCRIPT_NAME
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
elif [ $shield_hat -eq 4 ]; then elif [ $shield_hat -eq 4 ]; then
wget --no-check-certificate $SCRIPT_PATH/reconnect_cellulariot -O $RECONNECT_SCRIPT_NAME wget --no-check-certificate $SCRIPT_PATH/reconnect_cellulariot -O $RECONNECT_SCRIPT_NAME
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
elif [ $shield_hat -eq 5 ]; then elif [ $shield_hat -eq 5 ]; then
wget --no-check-certificate $SCRIPT_PATH/reconnect_tracker -O $RECONNECT_SCRIPT_NAME wget --no-check-certificate $SCRIPT_PATH/reconnect_tracker -O $RECONNECT_SCRIPT_NAME
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
elif [ $shield_hat -eq 6 ]; then elif [ $shield_hat -eq 6 ]; then
wget --no-check-certificate $SCRIPT_PATH/reconnect_basehat -O $RECONNECT_SCRIPT_NAME wget --no-check-certificate $SCRIPT_PATH/reconnect_basehat -O $RECONNECT_SCRIPT_NAME
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
fi fi

View File

@ -64,25 +64,13 @@ esac
colored_echo "Downloading setup files..." colored_echo "Downloading setup files..."
wget --no-check-certificate $SOURCE_PATH/chat-connect -O chat-connect wget --no-check-certificate $SOURCE_PATH/chat-connect -O chat-connect
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
if [ $? -ne 0 ]; then
colored_echo "Download failed" ${RED}
exit 1;
fi
wget --no-check-certificate $SOURCE_PATH/chat-disconnect -O chat-disconnect wget --no-check-certificate $SOURCE_PATH/chat-disconnect -O chat-disconnect
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
if [ $? -ne 0 ]; then
colored_echo "Download failed" ${RED}
exit 1;
fi
wget --no-check-certificate $SOURCE_PATH/provider -O provider wget --no-check-certificate $SOURCE_PATH/provider -O provider
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
if [ $? -ne 0 ]; then
colored_echo "Download failed" ${RED}
exit 1;
fi
colored_echo "ppp installing" colored_echo "ppp installing"
apt-get install ppp -y apt-get install ppp -y

View File

@ -44,25 +44,13 @@ colored_echo "Installing PPP for Sixfab Cellular IoT Shield/HAT with Twilio Supe
colored_echo "Downloading setup files..." colored_echo "Downloading setup files..."
wget --no-check-certificate $SOURCE_PATH/chat-connect -O chat-connect wget --no-check-certificate $SOURCE_PATH/chat-connect -O chat-connect
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
if [ $? -ne 0 ]; then
colored_echo "Download failed" ${RED}
exit 1;
fi
wget --no-check-certificate $SOURCE_PATH/chat-disconnect -O chat-disconnect wget --no-check-certificate $SOURCE_PATH/chat-disconnect -O chat-disconnect
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
if [ $? -ne 0 ]; then
colored_echo "Download failed" ${RED}
exit 1;
fi
wget --no-check-certificate $SOURCE_PATH/provider -O provider wget --no-check-certificate $SOURCE_PATH/provider -O provider
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
if [ $? -ne 0 ]; then
colored_echo "Download failed" ${RED}
exit 1;
fi
colored_echo "ppp and wiringpi (gpio tool) installing..." colored_echo "ppp and wiringpi (gpio tool) installing..."
apt-get install ppp wiringpi -y apt-get install ppp wiringpi -y
@ -90,11 +78,22 @@ do
[Yy]* ) colored_echo "Downloading setup file..." [Yy]* ) colored_echo "Downloading setup file..."
wget --no-check-certificate $SOURCE_PATH/$SERVICE_NAME wget --no-check-certificate $SOURCE_PATH/$SERVICE_NAME
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
wget --no-check-certificate $SOURCE_PATH/functions.sh wget --no-check-certificate $SOURCE_PATH/functions.sh
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
wget --no-check-certificate $SOURCE_PATH/configs.sh wget --no-check-certificate $SOURCE_PATH/configs.sh
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
wget --no-check-certificate $SOURCE_PATH/configure_modem.sh wget --no-check-certificate $SOURCE_PATH/configure_modem.sh
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
wget --no-check-certificate $SOURCE_PATH/$MANAGER_SCRIPT_NAME wget --no-check-certificate $SOURCE_PATH/$MANAGER_SCRIPT_NAME
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
wget --no-check-certificate $SCRIPT_PATH/reconnect_cellulariot -O $RECONNECT_SCRIPT_NAME wget --no-check-certificate $SCRIPT_PATH/reconnect_cellulariot -O $RECONNECT_SCRIPT_NAME
if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi
mv functions.sh $PPP_PATH mv functions.sh $PPP_PATH
mv configs.sh $PPP_PATH mv configs.sh $PPP_PATH