From 7f17c387b64d5cbd9d7f6388b08774034e00cad6 Mon Sep 17 00:00:00 2001 From: Yujin Boby Date: Sun, 16 Jul 2023 03:02:55 +0530 Subject: [PATCH] added centos 9 --- sok-find-os.sh | 2 ++ squid-add-user.sh | 40 ++-------------------------------------- squid-uninstall.sh | 3 +++ squid3-install.sh | 11 +++++++++++ 4 files changed, 18 insertions(+), 38 deletions(-) diff --git a/sok-find-os.sh b/sok-find-os.sh index 050280f..3352b9d 100755 --- a/sok-find-os.sh +++ b/sok-find-os.sh @@ -40,6 +40,8 @@ elif cat /etc/os-release | grep PRETTY_NAME | grep "AlmaLinux 8" > /dev/null; th echo "almalinux9" elif cat /etc/os-release | grep PRETTY_NAME | grep "CentOS Stream 8" > /dev/null; then echo "centos8s" +elif cat /etc/os-release | grep PRETTY_NAME | grep "CentOS Stream 9" > /dev/null; then + echo "centos9" else echo "ERROR" fi diff --git a/squid-add-user.sh b/squid-add-user.sh index 646afab..87f2cdd 100644 --- a/squid-add-user.sh +++ b/squid-add-user.sh @@ -28,41 +28,5 @@ else /usr/bin/htpasswd -c /etc/squid/passwd $proxy_username fi -if [ ! -f /usr/local/bin/sok-find-os ]; then - echo "/usr/local/bin/sok-find-os not found" - exit 1 -fi - -SOK_OS=$(/usr/local/bin/sok-find-os) - -if [ "$SOK_OS" == "ERROR" ]; then - echo "OS NOT SUPPORTED.\n" - echo "Contact https://serverok.in/contact to add support for your OS." - exit 1; -fi - -if [ $SOK_OS == "ubuntu2204" ]; then - systemctl reload squid -elif [ $SOK_OS == "ubuntu2004" ]; then - systemctl reload squid -elif [ $SOK_OS == "ubuntu1804" ]; then - systemctl reload squid -elif [ $SOK_OS == "ubuntu1604" ]; then - service squid restart -elif [ $SOK_OS == "ubuntu1404" ]; then - service squid3 restart -elif [ $SOK_OS == "debian8" ]; then - service squid3 restart -elif [ $SOK_OS == "debian9" ]; then - systemctl reload squid -elif [ $SOK_OS == "debian10" ]; then - systemctl reload squid -elif [ "$SOK_OS" == "debian11" ] && "$SOK_OS" == "debian12" ]; then - systemctl reload squid -elif [ $SOK_OS == "centos7" ]; then - systemctl reload squid -elif [ $SOK_OS == "centos8s" ]; then - systemctl reload squid -elif [ "$SOK_OS" == "centos8" ] || [ "$SOK_OS" == "almalinux8" ] || [ "$SOK_OS" == "almalinux9" ]; then - systemctl reload squid -fi +systemctl reload squid > /dev/null 2>&1 +service squid3 restart > /dev/null 2>&1 diff --git a/squid-uninstall.sh b/squid-uninstall.sh index 224a613..f0190fd 100644 --- a/squid-uninstall.sh +++ b/squid-uninstall.sh @@ -79,6 +79,9 @@ elif [ "$SOK_OS" == "centos8" ] || [ "$SOK_OS" == "almalinux8" ] || [ "$SOK_OS" elif [ "$SOK_OS" == "centos8s" ]; then dnf remove squid -y /bin/rm -rf /etc/squid/ +elif [ "$SOK_OS" == "centos9" ]; then + dnf remove squid -y + /bin/rm -rf /etc/squid/ fi rm -f /usr/local/bin/squid-add-user > /dev/null 2>&1 diff --git a/squid3-install.sh b/squid3-install.sh index 8a4026d..d5062fa 100644 --- a/squid3-install.sh +++ b/squid3-install.sh @@ -206,6 +206,17 @@ elif [ "$SOK_OS" == "centos8s" ]; then firewall-cmd --zone=public --permanent --add-port=3128/tcp > /dev/null 2>&1 firewall-cmd --reload > /dev/null 2>&1 fi +elif [ "$SOK_OS" == "centos9" ]; then + dnf install squid httpd-tools wget -y > /dev/null 2>&1 + mv /etc/squid/squid.conf /etc/squid/squid.conf.sok + /usr/bin/touch /etc/squid/blacklist.acl + /usr/bin/wget -q --no-check-certificate -O /etc/squid/squid.conf https://raw.githubusercontent.com/serverok/squid-proxy-installer/master/conf/squid-centos7.conf + systemctl enable squid > /dev/null 2>&1 + systemctl restart squid > /dev/null 2>&1 + if [ -f /usr/bin/firewall-cmd ]; then + firewall-cmd --zone=public --permanent --add-port=3128/tcp > /dev/null 2>&1 + firewall-cmd --reload > /dev/null 2>&1 + fi fi echo