check if python is present

This commit is contained in:
NL-TCH 2024-02-09 01:56:02 +01:00
parent ccd0d62a5a
commit 8eae2d1606

View file

@ -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/"