diff --git a/scripts/system/install_python.sh b/scripts/system/install_python.sh index 39c1af6..ee44ff7 100644 --- a/scripts/system/install_python.sh +++ b/scripts/system/install_python.sh @@ -14,13 +14,13 @@ if [[ $DISTRO =~ ^Debian ]] || [[ $DISTRO =~ ^Ubuntu ]]; then sudo apt-get update apt install sudo - sudo apt-get -y install python3 python3-pip + sudo apt-get -y install python3 python3-pip python3-venv libaugeas0 elif [[ $DISTRO =~ ^NAME=\"Arch ]]; then pacman -Syu sudo - sudo pacman -S --noconfirm python python-pip sudo + sudo pacman -S --noconfirm python python-pip sudo augeas python-virtualenv elif [[ $DISTRO =~ ^NAME=\"Rocky ]]; then @@ -28,7 +28,7 @@ elif [[ $DISTRO =~ ^NAME=\"Rocky ]]; then sudo dnf upgrade -y - sudo dnf install -y python python-pip sudo + sudo dnf install -y python python-pip sudo augeas-libs #Install EPEL dnf config-manager --set-enabled crb sudo dnf install -y \ @@ -42,7 +42,7 @@ elif [[ $DISTRO =~ ^Fedora ]]; then sudo dnf upgrade -y - sudo dnf install -y python3 python3-pip sudo + sudo dnf install -y python3 python3-pip sudo augeas-libs else @@ -89,3 +89,29 @@ fi sleep 1 +# Install certbot for ssl operations with pip (independet of distro) + +sudo python3 -m venv /opt/certbot/ + +sudo /opt/certbot/bin/pip install --upgrade pip + +sudo /opt/certbot/bin/pip install certbot certbot + +echo "0 0,12 * * * root /opt/certbot/bin/python -c 'import random; import time; time.sleep(random.random() * 3600)' && sudo certbot renew -q" | sudo tee -a /etc/crontab > /dev/null + +sudo ln -s /opt/certbot/bin/certbot /usr/bin/certbot + +if [ $? -eq 0 ]; then + + #echo "Installed python3 sucessfully if not error..." + echo '{"error": 0, "status": 0, "progress": 100, "no_progress":0, "message": "Installed certbot package sucessfully..."}' + + sleep 1 + +else + + echo "Sorry, cannot install distro python package..." + + exit 1; + +fi