diff --git a/AppendCMS.sh b/AppendCMS.sh index 0966189..8456443 100644 --- a/AppendCMS.sh +++ b/AppendCMS.sh @@ -1,3 +1,13 @@ +#!/bin/bash + +############################### +# @author: Bram Prieshof # +# @author: Branco van de Waal # +############################### + +itype=AddCMS +ScriptCompat=2 + ##-----------------## # Fetching Vars # ##-----------------## @@ -6,6 +16,8 @@ if [ ! -f "/etc/ICTM/selopts.list" ] || [ ! -f "/etc/ICTM/mainvar.list" ] ; then source /etc/ICTM/selopts.list source /etc/ICTM/mainvar.list +if [ -z ${CompatVer} ] || [ "$CompatVer" -lt "$ScriptCompat" ]; then echo "Web-V2 is outdated, Please run the Compat-V*.sh updater from the repo, Current version= $CompatVer" && exit ; fi + if [ -z $shortdist ] ; then source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/MicroOSDetect.sh) ; fi if [ $webserv != nginx_nonphp ]; then if [ ! -f "/etc/ICTM/phpvar.list" ] ; then bash <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/GeneratePhplist.sh) ; fi @@ -27,8 +39,9 @@ declare -n options="$webserv"Options # Static-Vars # ##----------------## -ignphpcms=1 - +#Options var setup for enabled sub-modules +EnOption="${SelectedOptions[@],,}" && EnOption="${EnOption// /}" && EnOption="${EnOption//:/ }" && EnOption="${EnOption//'"'}" +EnOption="$EnOption""${EnabledAons[@]}" ##---------------## # Functions # @@ -153,9 +166,15 @@ if [ $IMODE = l ]; then done fi -#Cleaning options from menu +#Cleaning CMS from menu CMS="${CMS//:}" && CMS="${CMS,,}" +##-----------------## +# Storeing vars # +##-----------------## + +touch /etc/ICTM/sites/"$sitename" + ##-----------## # AptList # @@ -199,6 +218,23 @@ if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$re source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/"$CMS"/"$webserv"-preconf.sh) fi +#Preconfiguring module For CMS +for val1 in ${EnOption[*]}; do + modListed=$(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/extModules.list|grep "$val1") + #Checking + if test -z "$modListed" + then + #Fetching from local repo + if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/CMSHook-preconf.sh; then + source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/CMSHook-preconf.sh) + fi + else + #Fetching from remote repo + if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$modListed"CMSHook-preconf.sh; then + source <(curl --retry 7 --retry-delay 5 -s "$modListed"CMSHook-preconf.sh) + fi + fi +done ##-------------## # Installer # @@ -261,15 +297,26 @@ if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$re source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/"$CMS"/"$webserv"-conf.sh) fi -##--------------------------## -# Backup-util Site Setup # -##--------------------------## +#Configuring Module for CMS + +for val1 in ${EnOption[*]}; do + modListed=$(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/extModules.list|grep "$val1") + #Checking + if test -z "$modListed" + then + #Fetching from local repo + if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/CMSHook-conf.sh; then + source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/CMSHook-conf.sh) + fi + else + #Fetching from remote repo + if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$modListed"CMSHook-conf.sh; then + source <(curl --retry 7 --retry-delay 5 -s "$modListed"CMSHook-conf.sh) + fi + fi +done + -repobckutil=https://git.ictmaatwerk.com/VPS-scripts/Backup-Util -branchbckutil=master -if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repobckutil"/raw/branch/"$branchbckutil"/cms-handeler.sh; then - source <(curl --retry 7 --retry-delay 5 -s "$repobckutil"/raw/branch/"$branchbckutil"/cms-handeler.sh) -fi ##------------## # Services # diff --git a/AppendModule.sh b/AppendModule.sh index bdaed34..411056f 100644 --- a/AppendModule.sh +++ b/AppendModule.sh @@ -1,15 +1,23 @@ +#!/bin/bash + +############################### +# @author: Bram Prieshof # +# @author: Branco van de Waal # +############################### + +itype=AddMod +ScriptCompat=2 + ##-----------------## # Fetching Vars # ##-----------------## if [ ! -f "/etc/ICTM/selopts.list" ] || [ ! -f "/etc/ICTM/mainvar.list" ] ; then echo 'This system is not yet setup, please run the main installer first' && exit ; fi -##-----------------## -# Fetching Vars # -##-----------------## - source /etc/ICTM/selopts.list source /etc/ICTM/mainvar.list +if [ -z ${CompatVer} ] || [ "$CompatVer" -lt "$ScriptCompat" ]; then echo "Web-V2 is outdated, Please run the Compat-V*.sh updater from the repo, Current version= $CompatVer" && exit ; fi + if [ -z $shortdist ] ; then source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/MicroOSDetect.sh) ; fi if [ $webserv != nginx_nonphp ]; then if [ ! -f "/etc/ICTM/phpvar.list" ] ; then bash <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/GeneratePhplist.sh) ; fi diff --git a/Docs/docs/Dev-Adding-Modules.md b/Docs/docs/Dev-Adding-Modules.md index fc95801..1526377 100644 --- a/Docs/docs/Dev-Adding-Modules.md +++ b/Docs/docs/Dev-Adding-Modules.md @@ -14,6 +14,8 @@ In both cases the file structure is expected as shown below * ``-apt.pkg.list * ``-dnf.pkg.list * config/* +* CMSHook-preconf.sh +* CMSHook-conf.sh ## The internal module location SubModules/`` @@ -32,7 +34,8 @@ SubModules/`` | ``-apt.pkg.list | packagelist for specified webserver for distro's that use apt| | ``-dnf.pkg.list | packagelist for specified webserver for distro's that use dnf/yum| | config/* | Directory for config files | - +| CMSHook-conf.sh | Will run as addtional preconf when CSM is installed| +| CMSHook-conf.sh | Will run after a CSM is installed| # Defining in the menu ### Add the following to ModulesMenu.list diff --git a/PhpUpdater.sh b/PhpUpdater.sh index 41da8d8..d8b41a7 100644 --- a/PhpUpdater.sh +++ b/PhpUpdater.sh @@ -92,6 +92,7 @@ if [ $IMODE = n ]; then $PKGP -y $phpPkgName* else PhpPurge=0 + echo "$PKGP -y $phpPkgName*" > ~/remove-PHP-$phpver fi fi diff --git a/Scripts/Compat/Compat-V2.sh b/Scripts/Compat/Compat-V2.sh new file mode 100644 index 0000000..82786a2 --- /dev/null +++ b/Scripts/Compat/Compat-V2.sh @@ -0,0 +1,23 @@ +if [ ! -f "/etc/ICTM/selopts.list" ] || [ ! -f "/etc/ICTM/mainvar.list" ] ; then echo 'This system is not yet setup, please run the main installer first' && exit ; fi + +#Getting information and vars +source /etc/ICTM/mainvar.list + +#CompatUpdater Setup +UpdaterCompatTo=2 +if [ -z ${CompatVer} ]; then CompatVer=1 ; fi +if [ "$CompatVer" -ge "$UpdaterCompatTo" ]; then echo "Web-V2 is update to-date,Update scipt version= $UpdaterCompatTo, Current version= $CompatVer" && exit ; fi + +printf '%s' "Updating Web-V2..." +#NewCompat var +CompatVer=$UpdaterCompatTo + +#Updating mod lists +aonoption="/MySQL/" +aonoption="$aonoption /Unattended-Security-Updates/" +aonoption="$aonoption /Backup-Util/" +aonoption="$aonoption /AcmeSH/" +echo 'EnabledAons=('$aonoption')' >> /etc/ICTM/selopts.list +declare -p CompatVer | cut -d ' ' -f 3- >> /etc/ICTM/mainvar.list + +printf " [\033[0;32mok\033[0m]\n" diff --git a/SubModules/postfix/CMSHook-conf.sh b/SubModules/postfix/CMSHook-conf.sh new file mode 100644 index 0000000..ebcacbb --- /dev/null +++ b/SubModules/postfix/CMSHook-conf.sh @@ -0,0 +1,24 @@ +#ADD DOMAIN +sudo --user opendkim mkdir /etc/opendkim.d/keys/"$maildomain" +sudo --user opendkim opendkim-genkey -r -D /etc/opendkim.d/keys/"$maildomain" -d "$maildomain" -s "$odkdomsec" +echo "$maildomain" >> /etc/opendkim.d/TrustedHosts +echo "$odkdomsec._domainkey."$maildomain" "$maildomain":"$odkdomsec":/etc/opendkim.d/keys/"$maildomain"/"$odkdomsec".private" >> /etc/opendkim.d/KeyTable + +if [ $webserv != nginx_nonphp ]; then + echo "" >> "$phpPoolDir"/"$sitename".conf + echo "php_admin_value[mail.force_extra_parameters] = \"-f$mailas -F'$maildomain'\"" >> "$phpPoolDir"/"$sitename".conf +fi + + +curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/postfix/opendkim-init.sh -o ~/OpenDKIMInit-$sitename.sh +sed -i -e 's/DOMAINname/'$maildomain'/g' -e 's/SITEName/'${sitename//_}'/g' -e 's/ODKSec/'$odkdomsec'/g' ~/OpenDKIMInit-$sitename.sh + +cat << EOF > /etc/update-motd.d/51-opendkim-"${sitename//_}" +#!/bin/sh +red='\e[1;31m%s\e[0m\n' +printf "\n" +printf \$red "To enable mail for $domain please run please run bash ~/OpenDKIMInit-$sitename.sh" +printf "\n" +EOF +chmod +x /etc/update-motd.d/51-opendkim-"${sitename//_}" +systemctl reload opendkim $phpFPMService \ No newline at end of file diff --git a/SubModules/postfix/CMSHook-preconf.sh b/SubModules/postfix/CMSHook-preconf.sh new file mode 100644 index 0000000..63c679d --- /dev/null +++ b/SubModules/postfix/CMSHook-preconf.sh @@ -0,0 +1,46 @@ +if [ -z "${sitename}" ]; then sitename=${domain//./_};fi +if [ $IMODE = n ]; then + if (whiptail --title "Config" --yesno " Send mail as info@$domain for $domain?" 11 78); then + mailas=info@$domain + maildomain=$domain + else + mailas=$(whiptail --nocancel --inputbox " Enter mail addres for sending mail?" 11 78 --title "Config" 3>&1 1>&2 2>&3) + maildomain=$(sed -e 's/[^@]*@//' <<< "$mail") + fi + if (whiptail --title "Config" --yesno " Use default DKIM selector [vps]?" 11 78); then + odkdomsec=vps + else + odkdomsec=$(whiptail --nocancel --inputbox " Enter DKIM selector" 11 78 --title "Config" 3>&1 1>&2 2>&3) + fi +fi + +if [ $IMODE = l ]; then + while true; do + read -p "Send mail as info@$domain for $domain? (y/n)" yn + case $yn in + [Yy]* ) + mailas=info@$domain + maildomain=$domain + break;; + [Nn]* ) + echo 'Enter mail addres for sending mail? ' + read mailas + maildomain=$(sed -e 's/[^@]*@//' <<< "$mailas") + break;; + * )echo "Choose yes or no.";; + esac + done + while true; do + read -p "Use default DKIM selector [vps]? (y/n)" yn + case $yn in + [Yy]* ) + odkdomsec=vps + break;; + [Nn]* ) + echo 'Enter DKIM selector? ' + read odkdomsec + break;; + * )echo "Choose yes or no.";; + esac + done +fi \ No newline at end of file diff --git a/SubModules/postfix/apt.pkg.list b/SubModules/postfix/apt.pkg.list index b318606..9e3fe93 100644 --- a/SubModules/postfix/apt.pkg.list +++ b/SubModules/postfix/apt.pkg.list @@ -1 +1 @@ -mailutils \ No newline at end of file +mailutils opendkim-tools \ No newline at end of file diff --git a/SubModules/postfix/conf.sh b/SubModules/postfix/conf.sh index f7c847c..2d4c3b7 100644 --- a/SubModules/postfix/conf.sh +++ b/SubModules/postfix/conf.sh @@ -1,11 +1,20 @@ + +systemctl stop postfix opendkim + + ##-------------## # Postfix # ##-------------## -sed -i 's/#inet_interfaces = all/inet_interfaces = loopback-only/g' /etc/postfix/main.cf -sed -i 's/mydestination/#mydestination/g' /etc/postfix/main.cf -sed -i 's/relayhost =/mydestination = '$hostname', localhost.'$hostname', '$hostname'/g' /etc/postfix/main.cf -echo "bounce_notice_recipient = info@$domain" >> /etc/postfix/main.cf +sed -i "/^inet_interfaces =/c\inet_interfaces = loopback-only" /etc/postfix/main.cf +sed -i "/recipient_delimiter =/c\recipient_delimiter = +" /etc/postfix/main.cf +sed -i "/^mydestination =/c\mydestination = \"$hostname\", localhost.\"$hostname\", \"$hostname\"" /etc/postfix/main.cf +echo "$hostname" > /etc/mailname +if [ "$(echo "$hostname" | grep -o "\." | wc -l)" -eq 1 ]; then + echo "bounce_notice_recipient = admin@$hostname" >> /etc/postfix/main.cf +else + echo "bounce_notice_recipient = admin@$(sed 's/.*\.\(.*\..*\)/\1/' <<< $hostname)" >> /etc/postfix/main.cf +fi cat < /etc/aliases # See man 5 aliases for format postmaster: root @@ -13,6 +22,80 @@ root: $email EOF newaliases -systemctl start postfix -systemctl enable postfix -systemctl reload postfix \ No newline at end of file +cat <> /etc/postfix/main.cf + +#openDKIM +milter_default_action = accept +milter_protocol = 2 +smtpd_milters = unix:/var/run/opendkim/opendkim.sock +non_smtpd_milters = unix:/var/run/opendkim/opendkim.sock +EOF + + +##--------------## +# OpenDKIM # +##--------------## + +usermod -aG opendkim postfix +rm -rf /etc/opendkim.d +mkdir -p /etc/opendkim.d/keys +chown opendkim:opendkim /etc/opendkim.d/keys -R +curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/postfix/config/opendkim.conf -o /etc/opendkim.conf +touch /etc/opendkim.d/SigningTable +cat < /etc/opendkim.d/TrustedHosts +127.0.0.1 +::1 +localhost +$(curl -s -4 icanhazip.com) +$(curl -s -6 icanhazip.com) +${hostname} +EOF + + +if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] ; then + mkdir -p /var/spool/postfix/var/run/opendkim + sudo chown opendkim:postfix /var/spool/postfix/var/run/opendkim + sed -i "/^RUNDIR=/c\RUNDIR=/var/spool/postfix/var/run/opendkim" /etc/default/opendkim + echo "TrustAnchorFile /usr/share/dns/root.key" >> /etc/opendkim.conf + bash /lib/opendkim/opendkim.service.generate + systemctl daemon-reload +fi + +odkhsec=$(sed 's/\..*$//' <<< $hostname) +sudo --user opendkim mkdir /etc/opendkim.d/keys/"$hostname" +sudo --user opendkim opendkim-genkey -r -D /etc/opendkim.d/keys/"$hostname" -d "$hostname" -s $odkhsec +echo ""$odkhsec"._domainkey."$hostname" "$hostname":"$odkhsec":/etc/opendkim.d/keys/"$hostname"/"$odkhsec".private" >> /etc/opendkim.d/KeyTable +curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/postfix/opendkim-init.sh -o ~/OpenDKIMInit-host.sh +sed -i -e 's/DOMAINname/'$hostname'/g' -e 's/SITEName/'host'/g' -e 's/ODKSec/'$odkhsec'/g' ~/OpenDKIMInit-host.sh +unset odkhsec + + +cat << EOF > /etc/update-motd.d/51-generalspf +#!/bin/sh +red='\e[1;31m%s\e[0m\n' +printf "\n" +printf \$red "To enable mail for this server add the folling Records for $hostname:" +printf \$red "A record: \$(curl -s -4 icanhazip.com)" +printf \$red "AAA record: \$(curl -s -6 icanhazip.com)" +printf \$red "MX record: '0 mail'" +printf \$red "SPF record: '\"v=spf1 a mx -all\"'" +printf \$red "Check Blacklist using the following url: 'https://www.debouncer.com/blacklistlookup?t=$hostname'" +printf "\n" +printf \$red "Optionally, to enable DKIM for the hostname run bash ~/OpenDKIMInit-host.sh" +printf \$red "Remove notice this by running \"rm /etc/update-motd.d/51-generalspf\"" +printf "\n" +EOF +chmod +x /etc/update-motd.d/51-generalspf + +systemctl start postfix opendkim +systemctl enable postfix opendkim + +#if using Append module run for existing cms/sites +if [ "$itype" = "AddMod" ]; then + for file in /etc/ICTM/sites/*; do + sitename="${file##*/}" + domain=${sitename//_/.} + source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/postfix/CMSHook-preconf.sh) + source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/postfix/CMSHook-conf.sh) + done +fi \ No newline at end of file diff --git a/SubModules/postfix/config/opendkim.conf b/SubModules/postfix/config/opendkim.conf new file mode 100644 index 0000000..799422c --- /dev/null +++ b/SubModules/postfix/config/opendkim.conf @@ -0,0 +1,12 @@ +Syslog yes +UMask 007 +Socket local:/var/run/opendkim/opendkim.sock +PidFile /var/run/opendkim/opendkim.pid +OversignHeaders From +UserID opendkim +Canonicalization relaxed/simple +Mode s +KeyTable refile:/etc/opendkim.d/KeyTable +SigningTable refile:/etc/opendkim.d/SigningTable +ExternalIgnoreList refile:/etc/opendkim.d/TrustedHosts +InternalHosts refile:/etc/opendkim.d/TrustedHosts diff --git a/SubModules/postfix/dnf.pkg.list b/SubModules/postfix/dnf.pkg.list new file mode 100644 index 0000000..72b8002 --- /dev/null +++ b/SubModules/postfix/dnf.pkg.list @@ -0,0 +1 @@ +perl-Getopt-Long \ No newline at end of file diff --git a/SubModules/postfix/generic.pkg.list b/SubModules/postfix/generic.pkg.list index 638b1b7..c07114a 100644 --- a/SubModules/postfix/generic.pkg.list +++ b/SubModules/postfix/generic.pkg.list @@ -1 +1 @@ -postfix \ No newline at end of file +postfix opendkim \ No newline at end of file diff --git a/SubModules/postfix/opendkim-init.sh b/SubModules/postfix/opendkim-init.sh new file mode 100644 index 0000000..4a2c861 --- /dev/null +++ b/SubModules/postfix/opendkim-init.sh @@ -0,0 +1,39 @@ +if [ -n "$1" ]; then + if [[ "$1" = "--enable" ]]; then + echo "Enableing DKIM" + + echo "*@DOMAINname ODKSec._domainkey.DOMAINname" >>/etc/opendkim.d/SigningTable + systemctl reload opendkim + #Remove script + while true; do + read -p "Remove this script -> yes/no?" yn + case $yn in + [Nn]* ) + break;; + [Yy]* ) + rm -- "$0" + break;; + * )echo "Choose yes or no.";; + esac + done + exit + fi +fi +echo "Required to enable mailing for this system" +echo "Please make sure a valid MX record, and A/AAA are set for DOMAINname," +echo "Please add the folloing to your SPF Record in the DNS of DOMAINname," +echo "ip4:$(curl -s -4 icanhazip.com) ip6:$(curl -s -6 icanhazip.com)" +echo "" +echo "Alternatively use the 'a' and 'mx' in the SPF record just make sure the server has an 'A' and 'AAA' record pointing to it" +echo "" +echo "" +echo "Optionally to enable dkim" +echo "Add the folloing TXT Record to the DNS of DOMAINname" +echo "WARNING the output is split, please combine key before inserting into DNS" +cat /etc/opendkim.d/keys/DOMAINname/ODKSec.txt + +echo "" +echo "If DNS is propegated then run \"bash $0 --enable\"" + +rm -f /etc/update-motd.d/51-opendkim-SITEName + diff --git a/SubModules/postfix/preconf.sh b/SubModules/postfix/preconf.sh index 1d01d0c..fec0bd6 100644 --- a/SubModules/postfix/preconf.sh +++ b/SubModules/postfix/preconf.sh @@ -1,13 +1,4 @@ -if [ -z "${domain}" ]; then - if [ $IMODE = n ]; then - domain=$(whiptail --nocancel --inputbox " Enter the domain without WWW " 11 82 --title "Config" 3>&1 1>&2 2>&3) - elif [ $IMODE = l ]; then - echo "Enter the domain without WWW:" - read domain - fi -fi - if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] ; then - debconf-set-selections <<< "postfix postfix/mailname string $domain" + debconf-set-selections <<< "postfix postfix/mailname string $hostname" debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'" fi \ No newline at end of file diff --git a/installer.sh b/installer.sh index 43b9eeb..aca61b5 100644 --- a/installer.sh +++ b/installer.sh @@ -1,5 +1,11 @@ #!/bin/bash +############################### +# @author: Bram Prieshof # +# @author: Branco van de Waal # +############################### + +itype=Main ##--------------------## # Legacy/Main Menu # @@ -24,8 +30,9 @@ fi #Git-repo repo=https://git.ictmaatwerk.com/VPS-scripts/Web-V2 -branch=master +branch=PostfixTesting branchtype=branch #=branch for branch and =tag for release +CompatVer=2 #Installer-config phpver=7.4 PHPMyadmin=1 #Overwriten by cms's without php @@ -368,7 +375,7 @@ fi mkdir -p /etc/ICTM/sites echo "InstDate=$(date "+%d-%B-%Y")" >> /etc/ICTM/mainvar.list -for storeme in PKGM PKGI PKGUC PKGUP PKGLIST OUTPUT IMODE shortdist repo branch branchtype webserv email shortdist hostname; do +for storeme in PKGM PKGI PKGUC PKGUP PKGLIST OUTPUT IMODE shortdist repo branch branchtype webserv email shortdist hostname CompatVer; do declare -p $storeme | cut -d ' ' -f 3- >> /etc/ICTM/mainvar.list done @@ -435,6 +442,9 @@ if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$re source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/"$webserv"/reqmodules.sh) fi +#saving enabled Allways on modules +echo 'EnabledAons=('$aonoption')' >> /etc/ICTM/selopts.list + #Combining selected option with always-on options option="$option""$aonoption" @@ -573,6 +583,24 @@ if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$re source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/"$CMS"/"$webserv"-preconf.sh) fi +#Preconfiguring module For CMS +for val1 in ${option[*]}; do + modListed=$(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/extModules.list|grep "$val1") + #Checking + if test -z "$modListed" + then + #Fetching from local repo + if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/CMSHook-preconf.sh; then + source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/CMSHook-preconf.sh) + fi + else + #Fetching from remote repo + if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$modListed"CMSHook-preconf.sh; then + source <(curl --retry 7 --retry-delay 5 -s "$modListed"CMSHook-preconf.sh) + fi + fi +done + #Saving updated vars for storeme in phpver sqlver PHPMyadmin; do declare -p $storeme | cut -d ' ' -f 3- >> /etc/ICTM/mainvar.list @@ -695,6 +723,25 @@ if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$re fi fi +#Configuring Module for CMS + +for val1 in ${option[*]}; do + modListed=$(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/extModules.list|grep "$val1") + #Checking + if test -z "$modListed" + then + #Fetching from local repo + if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/CMSHook-conf.sh; then + source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/CMSHook-conf.sh) + fi + else + #Fetching from remote repo + if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$modListed"CMSHook-conf.sh; then + source <(curl --retry 7 --retry-delay 5 -s "$modListed"CMSHook-conf.sh) + fi + fi +done + ##------------## # Services # ##------------##