From 7bb5477872744201bf174b2a2de09423280eaeb5 Mon Sep 17 00:00:00 2001 From: saeedjohar Date: Fri, 13 May 2022 19:06:36 +0300 Subject: [PATCH] WiringPi installation from source code (#35) * installing wiringPi from source code * gpio -vshowing custom error message --- ppp_install.sh | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/ppp_install.sh b/ppp_install.sh index 44874a4..d344a6c 100755 --- a/ppp_install.sh +++ b/ppp_install.sh @@ -214,17 +214,27 @@ do 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 + colored_echo "Installing WiringPi (gpio tool) if required..." + + # Check the availability of the gpio. + gpio -v > /dev/null 2>&1 + if [[ $? -ne 0 ]]; then colored_echo "WiringPi not found\n" ${RED} ; fi + + # Download WiringPi from https://github.com/WiringPi/WiringPi.git + git clone https://github.com/WiringPi/WiringPi.git + + # change directory to WiringPi and build from source code + pushd WiringPi && ./build && popd + 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 + # # 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