From a4d68ed35c9afcc1e74daaa98e1dfc0c41be7fe0 Mon Sep 17 00:00:00 2001 From: Aria <47712536+MrAriaNet@users.noreply.github.com> Date: Wed, 1 Jun 2022 18:15:43 +0430 Subject: [PATCH] Update sourceguardian.sh --- sourceguardian.sh | 110 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 82 insertions(+), 28 deletions(-) diff --git a/sourceguardian.sh b/sourceguardian.sh index f79c7a8..6800e85 100644 --- a/sourceguardian.sh +++ b/sourceguardian.sh @@ -1,33 +1,87 @@ #!/bin/bash -# by aria ;) - +# by Aria ;) clear -# Sourceguardian download -echo "Sourceguardian download started."; -mkdir -p /usr/local/sourceguardian/ > /dev/null 2>&1; -wget -O /usr/local/sourceguardian/loaders.linux-x86_64.tar.gz http://www.sourceguardian.com/loaders/download/loaders.linux-x86_64.tar.gz > /dev/null 2>&1; -tar xzf /usr/local/sourceguardian/loaders.linux-x86_64.tar.gz > /dev/null 2>&1; -chmod -R 0755 /usr/local/sourceguardian/ -echo -e "Sourceguardian were downloaded.\n"; -sleep 2; - -echo -e "Sourceguardian install started.\n"; - -if [[ -f "/usr/local/php56/lib/php.conf.d/90-custom.ini" ]]; then - echo "zend_extension = /usr/local/sourceguardian/ixed.5.6.lin" >> /usr/local/php56/lib/php.conf.d/90-custom.ini - echo "Install sourceguardian php 5.6" -elif [[ -f "/usr/local/php72/lib/php.conf.d/90-custom.ini" ]]; then - echo "zend_extension = /usr/local/sourceguardian/ixed.7.2.lin" >> /usr/local/php72/lib/php.conf.d/90-custom.ini - echo "Install sourceguardian php 7.2" -elif [[ -f "/usr/local/php73/lib/php.conf.d/90-custom.ini" ]]; then - echo "zend_extension = /usr/local/sourceguardian/ixed.7.3.lin" >> /usr/local/php73/lib/php.conf.d/90-custom.ini - echo "Install sourceguardian php 7.3" -elif [[ -f "/usr/local/php74/lib/php.conf.d/90-custom.ini" ]]; then - echo "zend_extension = /usr/local/sourceguardian/ixed.7.4.lin" >> /usr/local/php74/lib/php.conf.d/90-custom.ini - echo "Install sourceguardian php 7.4" +version="$(curl https://app.gerdoo.cloud/sg.php)"; + +if [[ -d "/usr/local/sourceguardian/" ]]; then + if grep -R 'zend_extension = /usr/local/sourceguardian/ixed.5.6.lin' "/usr/local/php56/lib/php.conf.d/90-custom.ini" > /dev/null 2>&1; then + echo "Sourceguardian was already installed in PHP 5.6" + fi + if grep -R 'zend_extension = /usr/local/sourceguardian/ixed.7.2.lin' "/usr/local/php72/lib/php.conf.d/90-custom.ini" > /dev/null 2>&1; then + echo "Sourceguardian was already installed in PHP 7.2" + fi + if grep -R 'zend_extension = /usr/local/sourceguardian/ixed.7.3.lin' "/usr/local/php73/lib/php.conf.d/90-custom.ini" > /dev/null 2>&1; then + echo "Sourceguardian was already installed in PHP 7.3" + fi + if grep -R 'zend_extension = /usr/local/sourceguardian/ixed.7.4.lin' "/usr/local/php74/lib/php.conf.d/90-custom.ini" > /dev/null 2>&1; then + echo "Sourceguardian was already installed in PHP 7.4" + fi + if grep -q $version "/usr/local/sourceguardian/version"; then + echo -e "\nSourceguardian is updated.\n"; + else + echo $version > /usr/local/sourceguardian/version + echo -e "\nA new Sourceguardian version has been released : $version\n"; + + echo -e "Sourceguardian download started.\n"; + + mkdir -p /usr/local/sourceguardian/ > /dev/null 2>&1; + echo "Create directory sourceguardian"; + + curl --output /usr/local/sourceguardian/loaders.linux-x86_64.tar.gz https://www.sourceguardian.com/loaders/download/loaders.linux-x86_64.tar.gz > /dev/null 2>&1; + echo "Download loader from sourceguardian"; + + tar -xzf /usr/local/sourceguardian/loaders.linux-x86_64.tar.gz --directory /usr/local/sourceguardian/ > /dev/null 2>&1; + echo "Extract loader file sourceguardian"; + + chown -R root:root /usr/local/sourceguardian/ + echo "Change owner directory and file sourceguardian"; + + chmod -R 0755 /usr/local/sourceguardian/ + echo "Change permission directory and file sourceguardian"; + + sleep 2; + echo -e "\nSourceguardian were downloaded.\n"; + fi else - echo "You are not using Directadmin" -fi + echo -e "Sourceguardian download started.\n"; -echo -e "Sourceguardian were installed.\n"; + mkdir -p /usr/local/sourceguardian/ > /dev/null 2>&1; + echo "Create directory sourceguardian"; + + curl --output /usr/local/sourceguardian/loaders.linux-x86_64.tar.gz https://www.sourceguardian.com/loaders/download/loaders.linux-x86_64.tar.gz > /dev/null 2>&1; + echo "Download loader from sourceguardian"; + + tar -xzf /usr/local/sourceguardian/loaders.linux-x86_64.tar.gz --directory /usr/local/sourceguardian/ > /dev/null 2>&1; + echo "Extract loader file sourceguardian"; + + chown -R root:root /usr/local/sourceguardian/ + echo "Change owner directory and file sourceguardian"; + + chmod -R 0755 /usr/local/sourceguardian/ + echo "Change permission directory and file sourceguardian"; + + sleep 2; + echo -e "\nSourceguardian were downloaded.\n"; + + echo -e "Sourceguardian install started.\n"; + + if [[ -f "/usr/local/php56/lib/php.conf.d/90-custom.ini" ]]; then + echo "zend_extension = /usr/local/sourceguardian/ixed.5.6.lin" >> /usr/local/php56/lib/php.conf.d/90-custom.ini + echo "Sourceguardian is installed in PHP 5.6" + fi + if [[ -f "/usr/local/php72/lib/php.conf.d/90-custom.ini" ]]; then + echo "zend_extension = /usr/local/sourceguardian/ixed.7.2.lin" >> /usr/local/php72/lib/php.conf.d/90-custom.ini + echo "Sourceguardian is installed in PHP 7.2" + fi + if [[ -f "/usr/local/php73/lib/php.conf.d/90-custom.ini" ]]; then + echo "zend_extension = /usr/local/sourceguardian/ixed.7.3.lin" >> /usr/local/php73/lib/php.conf.d/90-custom.ini + echo "Sourceguardian is installed in PHP 7.3" + fi + if [[ -f "/usr/local/php74/lib/php.conf.d/90-custom.ini" ]]; then + echo "zend_extension = /usr/local/sourceguardian/ixed.7.4.lin" >> /usr/local/php74/lib/php.conf.d/90-custom.ini + echo "Sourceguardian is installed in PHP 7.4" + fi + + echo -e "\nSourceguardian were installed.\n"; +fi