Skip to content
Snippets Groups Projects

support custom phase per project

1 file
+ 8
2
Compare changes
  • Side-by-side
  • Inline
+ 39
16
@@ -12,6 +12,7 @@
# 2021-11-01 v0.6 <axel.hahn@iml.unibe.ch> save config diffs
# 2021-11-02 v0.7 <axel.hahn@iml.unibe.ch> delete logs keping N files
# 2022-11-24 v0.8 <axel.hahn@iml.unibe.ch> tar -xzf without dot as 2nd param
# 2022-11-25 v0.9 <axel.hahn@iml.unibe.ch> support custom phase + file per project
# ======================================================================
@@ -20,6 +21,7 @@
# ----------------------------------------------------------------------
cd $( dirname $0 )
selfdir=$( /bin/pwd )
_version=0.9
tmpdir=/var/tmp/imldeployment_packages
logdir=/var/log/imldeployment-client
@@ -74,9 +76,17 @@ function setprofile(){
fi
echo "OK, profile [${profile}] was set."
downloadfile="${tmpdir}/${IMLCI_PROJECT}.tgz"
downloadtmp="${tmpdir}/${IMLCI_PROJECT}.tgz.tmp"
cfgdiff="${tmpdir}/${IMLCI_PROJECT}_cfgdiff.txt"
local localfile
if [ -n "$IMLCI_FILE" ]; then
localfile="${IMLCI_PROJECT}__${IMLCI_FILE}"
else
IMLCI_FILE="${IMLCI_PROJECT}.tgz"
localfile="${IMLCI_FILE}"
fi
downloadfile="${tmpdir}/${localfile}"
downloadtmp="${tmpdir}/${localfile}.tmp"
cfgdiff="${tmpdir}/${localfile}_cfgdiff.txt"
test -f "${cfgdiff}" && rm -f "${cfgdiff}"
}
@@ -132,6 +142,7 @@ function run_task(){
function deploy(){
local dlparams
skipmessage="SKIP: no newer download file. You can use parameter -f to force reinstall."
# ----------------------------------------------------------------------
@@ -140,9 +151,17 @@ function deploy(){
# ----------------------------------------------------------------------
header "Download ${IMLCI_PROJECT}.tgz"
header "Download ${IML} ${IMLCI_PROJECT}.tgz"
typeset -i local isupdate=$defaultupdate
${selfdir}/bin/getfile.sh -f ${IMLCI_PROJECT}.tgz -o ${downloadtmp}
# getfile.sh reads phase from its cfg file - we need to add it as parameter
test -n "${IMLCI_PHASE}" && dlparams="$dlparams -e ${IMLCI_PHASE}"
# set the filename to fetch
test -n "$IMLCI_FILE" || dlparams="$dlparams -f ${IMLCI_PROJECT}.tgz"
test -n "$IMLCI_FILE" && dlparams="$dlparams -f $IMLCI_FILE"
${selfdir}/bin/getfile.sh ${dlparams} -o ${downloadtmp}
if [ $? -ne 0 ]; then
echo Download failed.
echo Repeating request with debug param -d to get the error...
@@ -301,28 +320,32 @@ cd $( dirname $0 )
action="deploy"
typeset -i defaultupdate=0
echo
echo
echo "<<<<<<<<<<##########| IML - DEPLOYMENT SCRIPT |##########>>>>>>>>>>"
echo
echo "_______________________________________________________________________________
IML - DEPLOYMENT CLIENT
DOCS: https://os-docs.iml.unibe.ch/imldeployment-client/ _____
_________________________________________________________________________/ v$_version
"
while getopts 'hfl' arg; do
case ${arg} in
h)
echo "HELP"
echo "Load one or more profiles profile to deploy an application."
echo "HELP:"
echo " Loads one or more profiles profile to deploy an application."
echo " If the download file is not newer then it does not extract files and does not"
echo "run pre and post hooks - it updates the config files only and sets the owner."
echo " Optionally it cleans up the target directory."
echo " Runs pre and post hooks - it updates the config files only and sets the owner."
echo
echo "Syntax:"
echo "SYNTAX:"
echo " $( basename $0 ) [OPTION] [PROFILE(S)]"
echo
echo "Optioms:"
echo "OPTIONS:"
echo " -h | show this help and exit"
echo " -f | force full installation even if the download file is not newer"
echo " -l | list exiting profile names"
echo
echo "Profile(s):"
echo "PROFILE(S):"
echo " Set one or more valid profile names. By default it loops over all profiles."
echo " This prameter limits the execution to the given profiles."
echo " Use option -l to get a list of profiles."
Loading