diff --git a/AppendCMS.sh b/AppendCMS.sh index c76c4d4..6e70de5 100644 --- a/AppendCMS.sh +++ b/AppendCMS.sh @@ -1,3 +1,12 @@ +#!/bin/bash + +############################### +# @author: Bram Prieshof # +# @author: Branco van de Waal # +############################### + +itype=AddCMS + ##-----------------## # Fetching Vars # ##-----------------## @@ -29,6 +38,9 @@ declare -n options="$webserv"Options ignphpcms=1 +#Options var setup for enabled sub-modules +option="${SelectedOptions,,}" && option="${option// /}" && option="${option//:/ }" && option="${option//'"'}" +option="$option""$EnabledAons" ##---------------## # Functions # @@ -205,6 +217,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 ${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 ##-------------## # Installer # @@ -267,15 +296,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 ${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 + -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"/CMSHook-conf.sh; then - source <(curl --retry 7 --retry-delay 5 -s "$repobckutil"/raw/branch/"$branchbckutil"/CMSHook-conf.sh) -fi ##------------## # Services # diff --git a/AppendModule.sh b/AppendModule.sh index bdaed34..af2b03f 100644 --- a/AppendModule.sh +++ b/AppendModule.sh @@ -1,13 +1,18 @@ +#!/bin/bash + +############################### +# @author: Bram Prieshof # +# @author: Branco van de Waal # +############################### + +itype=AddMod + ##-----------------## # 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 $shortdist ] ; then source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/MicroOSDetect.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/SubModules/postfix/conf.sh b/SubModules/postfix/conf.sh index f0448f5..5af7539 100644 --- a/SubModules/postfix/conf.sh +++ b/SubModules/postfix/conf.sh @@ -85,7 +85,7 @@ systemctl start postfix opendkim systemctl enable postfix opendkim #if using Append module run for existing cms/sites -if [ ! -z "${postfixappended}" ]; then +if [ "$itype" = "AddMod" ]; then for file in /etc/ICTM/sites/*; do sitename="${file##*/}" domain=${sitename//_/.} diff --git a/SubModules/postfix/preconf.sh b/SubModules/postfix/preconf.sh index 0276a07..fec0bd6 100644 --- a/SubModules/postfix/preconf.sh +++ b/SubModules/postfix/preconf.sh @@ -1,7 +1,3 @@ -if [ -z "${domain}" ]; then - postfixappended=1 -fi - if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] ; then debconf-set-selections <<< "postfix postfix/mailname string $hostname" debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'" diff --git a/installer.sh b/installer.sh index dd063b5..2df823d 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 # @@ -435,6 +441,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 +582,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 +722,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 # ##------------##