WiringPi installation from source code (#35)

* installing wiringPi from source code

* gpio -vshowing custom error message
This commit is contained in:
saeedjohar 2022-05-13 19:06:36 +03:00 committed by GitHub
parent fe4ad2411f
commit 7bb5477872
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -214,17 +214,27 @@ do
source ~/.profile source ~/.profile
if [[ $? -ne 0 ]]; then colored_echo "Process failed" ${RED}; exit 1; fi if [[ $? -ne 0 ]]; then colored_echo "Process failed" ${RED}; exit 1; fi
colored_echo "wiringpi (gpio tool) installing..." colored_echo "Installing WiringPi (gpio tool) if required..."
apt-get install wiringpi -y
# 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 if [[ $? -ne 0 ]]; then colored_echo "WiringPi installation failed \nTry manual insatallation" ${RED} ; fi
# test wiringpi and fix if there is any issue # # test wiringpi and fix if there is any issue
gpio readall | grep Oops > /dev/null # gpio readall | grep Oops > /dev/null
if [[ $? -ne 1 ]]; then # if [[ $? -ne 1 ]]; then
colored_echo "Known wiringPi issue is detected! WiringPi is updating..." # colored_echo "Known wiringPi issue is detected! WiringPi is updating..."
wget https://project-downloads.drogon.net/wiringpi-latest.deb # # wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb # # sudo dpkg -i wiringpi-latest.deb
fi # fi
colored_echo "Copying setup file..." colored_echo "Copying setup file..."
cp $SOURCE_PATH/$SERVICE_NAME $SERVICE_NAME cp $SOURCE_PATH/$SERVICE_NAME $SERVICE_NAME