mirror of
https://github.com/thiagoralves/OpenPLC_v3.git
synced 2025-12-13 07:20:30 +08:00
Add alternate wiringpi if not on apt.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
OPENPLC_DIR="$PWD"
|
OPENPLC_DIR="$PWD"
|
||||||
SWAP_FILE="$OPENPLC_DIR/swapfile"
|
SWAP_FILE="$OPENPLC_DIR/swapfile"
|
||||||
|
WIRINGPI_VERSION="2.61-1"
|
||||||
|
|
||||||
function print_help_and_exit {
|
function print_help_and_exit {
|
||||||
echo ""
|
echo ""
|
||||||
@@ -50,6 +51,23 @@ function linux_install_deps {
|
|||||||
$1 python2.7 get-pip.py
|
$1 python2.7 get-pip.py
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function install_wiringpi {
|
||||||
|
echo "[WIRINGPI]"
|
||||||
|
echo "Trying distribution package..."
|
||||||
|
sudo apt-get install -y wiringpi && return 0
|
||||||
|
|
||||||
|
echo "Falling back to direct download..."
|
||||||
|
local FILE="wiringpi-$WIRINGPI_VERSION-arm64.deb"
|
||||||
|
local URL="https://github.com/WiringPi/WiringPi/releases/download/$WIRINGPI_VERSION/$FILE"
|
||||||
|
(
|
||||||
|
set -e
|
||||||
|
wget -c -O "$OPENPLC_DIR/$FILE" "$URL"
|
||||||
|
sudo dpkg -i "$OPENPLC_DIR/$FILE"
|
||||||
|
sudo apt install -f
|
||||||
|
rm -f "$OPENPLC_DIR/$FILE"
|
||||||
|
) || fail "Failed to install wiringpi."
|
||||||
|
}
|
||||||
|
|
||||||
function install_py_deps {
|
function install_py_deps {
|
||||||
$1 pip2 install flask
|
$1 pip2 install flask
|
||||||
$1 pip2 install flask-login
|
$1 pip2 install flask-login
|
||||||
@@ -266,11 +284,9 @@ elif [ "$1" == "rpi" ]; then
|
|||||||
echo "Installing OpenPLC on Raspberry Pi"
|
echo "Installing OpenPLC on Raspberry Pi"
|
||||||
|
|
||||||
linux_install_deps sudo
|
linux_install_deps sudo
|
||||||
sudo apt-get install -y wiringpi
|
install_wiringpi
|
||||||
|
|
||||||
install_py_deps
|
install_py_deps
|
||||||
install_py_deps "sudo -H"
|
install_py_deps "sudo -H"
|
||||||
|
|
||||||
install_all_libs sudo
|
install_all_libs sudo
|
||||||
install_systemd_service sudo
|
install_systemd_service sudo
|
||||||
finalize_install
|
finalize_install
|
||||||
|
|||||||
Reference in New Issue
Block a user