Main:All Added per CMS config for sub-modules

If CMS is installed and a sub-module requires to be configured per CMS,
this is handeled by new 'CMSHook-(pre)conf.sh'
this has been added to Dev Docs

Updated postfix sub-module to use new CMSHook
Added 'itype' var for detection of install script type
Now also storeing  'Allways on modules' in installer as EnabledAons
This commit is contained in:
2021-02-10 15:23:22 +01:00
parent 282851f1ed
commit 81b7e93678
6 changed files with 108 additions and 18 deletions

View File

@@ -1,3 +1,12 @@
#!/bin/bash
###############################
# @author: Bram Prieshof #
# @author: Branco van de Waal #
###############################
itype=AddCMS
##-----------------## ##-----------------##
# Fetching Vars # # Fetching Vars #
##-----------------## ##-----------------##
@@ -29,6 +38,9 @@ declare -n options="$webserv"Options
ignphpcms=1 ignphpcms=1
#Options var setup for enabled sub-modules
option="${SelectedOptions,,}" && option="${option// /}" && option="${option//:/ }" && option="${option//'"'}"
option="$option""$EnabledAons"
##---------------## ##---------------##
# Functions # # 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) source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/"$CMS"/"$webserv"-preconf.sh)
fi 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 # # 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) source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/"$CMS"/"$webserv"-conf.sh)
fi fi
##--------------------------## #Configuring Module for CMS
# Backup-util Site Setup #
##--------------------------## 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 # # Services #

View File

@@ -1,13 +1,18 @@
#!/bin/bash
###############################
# @author: Bram Prieshof #
# @author: Branco van de Waal #
###############################
itype=AddMod
##-----------------## ##-----------------##
# Fetching Vars # # 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 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/selopts.list
source /etc/ICTM/mainvar.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 if [ -z $shortdist ] ; then source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/MicroOSDetect.sh) ; fi

View File

@@ -14,6 +14,8 @@ In both cases the file structure is expected as shown below
* `<Webserver>`-apt.pkg.list * `<Webserver>`-apt.pkg.list
* `<Webserver>`-dnf.pkg.list * `<Webserver>`-dnf.pkg.list
* config/* * config/*
* CMSHook-preconf.sh
* CMSHook-conf.sh
## The internal module location ## The internal module location
SubModules/`<ModuleName>` SubModules/`<ModuleName>`
@@ -32,7 +34,8 @@ SubModules/`<ModuleName>`
| `<Webserver>`-apt.pkg.list | packagelist for specified webserver for distro's that use apt| | `<Webserver>`-apt.pkg.list | packagelist for specified webserver for distro's that use apt|
| `<Webserver>`-dnf.pkg.list | packagelist for specified webserver for distro's that use dnf/yum| | `<Webserver>`-dnf.pkg.list | packagelist for specified webserver for distro's that use dnf/yum|
| config/* | Directory for config files | | 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 # Defining in the menu
### Add the following to ModulesMenu.list ### Add the following to ModulesMenu.list

View File

@@ -85,7 +85,7 @@ systemctl start postfix opendkim
systemctl enable postfix opendkim systemctl enable postfix opendkim
#if using Append module run for existing cms/sites #if using Append module run for existing cms/sites
if [ ! -z "${postfixappended}" ]; then if [ "$itype" = "AddMod" ]; then
for file in /etc/ICTM/sites/*; do for file in /etc/ICTM/sites/*; do
sitename="${file##*/}" sitename="${file##*/}"
domain=${sitename//_/.} domain=${sitename//_/.}

View File

@@ -1,7 +1,3 @@
if [ -z "${domain}" ]; then
postfixappended=1
fi
if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] ; then if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] ; then
debconf-set-selections <<< "postfix postfix/mailname string $hostname" debconf-set-selections <<< "postfix postfix/mailname string $hostname"
debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'" debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'"

View File

@@ -1,5 +1,11 @@
#!/bin/bash #!/bin/bash
###############################
# @author: Bram Prieshof #
# @author: Branco van de Waal #
###############################
itype=Main
##--------------------## ##--------------------##
# Legacy/Main Menu # # 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) source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/"$webserv"/reqmodules.sh)
fi fi
#saving enabled Allways on modules
echo 'EnabledAons=('$aonoption')' > /etc/ICTM/selopts.list
#Combining selected option with always-on options #Combining selected option with always-on options
option="$option""$aonoption" 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) source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/"$CMS"/"$webserv"-preconf.sh)
fi 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 #Saving updated vars
for storeme in phpver sqlver PHPMyadmin; do for storeme in phpver sqlver PHPMyadmin; do
declare -p $storeme | cut -d ' ' -f 3- >> /etc/ICTM/mainvar.list 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
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 # # Services #
##------------## ##------------##