From 8eae2d1606af305f06e883289c8e56546297676c Mon Sep 17 00:00:00 2001 From: NL-TCH Date: Fri, 9 Feb 2024 01:56:02 +0100 Subject: [PATCH] check if python is present --- installers/common.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/installers/common.sh b/installers/common.sh index ad56b269..df65a0ae 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -585,6 +585,17 @@ function _create_openvpn_scripts() { function _install_restapi() { _install_log "Installing and enabling RestAPI" sudo cp -r "$webroot_dir/api" "$raspap_dir/api" || _install_status 1 "Unable to move api folder" + + if ! command -v python &> /dev/null; then + echo "Python is not installed. Installing Python..." + sudo apt update + sudo apt install -y python3 python3-pip + echo "Python installed successfully." + else + echo "Python is already installed." + sudo apt install python3-pip -y + + fi python -m pip install -r "$raspap_dir/api/requirements.txt" --break-system-packages || _install_status 1 " Unable to install pip modules" echo "Moving restapi systemd unit control file to /lib/systemd/system/"