Skip to content
Snippets Groups Projects
Commit b2f76eda authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

add detection if download is an update

parent db6791cc
No related branches found
No related tags found
No related merge requests found
......@@ -58,6 +58,9 @@ function setprofile(){
exit 12
fi
echo "OK, profile [${profile}] was set."
downloadfile="${tmpdir}/${IMLCI_PROJECT}.tgz"
downloadtmp="${tmpdir}/${IMLCI_PROJECT}.tgz.tmp"
}
# output a colored infoline with date and given message
......@@ -65,12 +68,12 @@ function setprofile(){
function header(){
local COLOR="\033[34m"
local NO_COLOR="\033[0m"
echo
echo -en "${COLOR}"
echo ______________________________________________________________________
echo
echo -n ">>>>>>>>>> $(date) "
test ! -z "$profile" && echo -n "${profile} :: "
echo -n " - $* "
echo -n "$*"
echo -en "${NO_COLOR}"
if [ "$wait" = "1" ]; then
echo -n " RETURN"; read dummy;
......@@ -84,9 +87,11 @@ function header(){
function run_task(){
local taskscript=$1
if [ -x "${taskscript}" ]; then
echo "INFO: starting script ${taskscript}..."
. "${taskscript}" || exit 10
else
echo "SKIP: task script ${taskscript} does not exist."
test -f "${taskscript}" && ( echo "SKIP: task script ${taskscript} is not executable." ; ls -l "${taskscript}")
test -f "${taskscript}" || echo "SKIP: task script ${taskscript} does not exist."
fi
}
......@@ -96,11 +101,6 @@ function run_task(){
cd $( dirname $0 )
echo
echo
echo "<<<<<<<<<<##########| POC :: DEPLOYMENT SCRIPT |##########>>>>>>>>>>"
echo
if [ $# -eq 0 ]; then
header "looping over all profiles"
getprofiles
......@@ -109,9 +109,17 @@ if [ $# -eq 0 ]; then
do
$0 $myprofile
done
rc=$?
profile=
header "loop over projects is finished"
exit $?
fi
echo
echo
echo "<<<<<<<<<<##########| POC :: DEPLOYMENT SCRIPT |##########>>>>>>>>>>"
echo
# ----------------------------------------------------------------------
header "Set profile [$1]"
......@@ -120,15 +128,34 @@ setprofile $1
# ----------------------------------------------------------------------
header "Download ${IMLCI_PROJECT}.tgz"
cd $tmpdir
${selfdir}/bin/getfile.sh -f ${IMLCI_PROJECT}.tgz || exit 1
isupdate=0
${selfdir}/bin/getfile.sh -f ${IMLCI_PROJECT}.tgz -o ${downloadtmp} || exit 1
# ----------------------------------------------------------------------
header "Detect if download is newer than last download."
if [ -f ${downloadfile} ]; then
# ls -l "${downloadfile}" "${downloadtmp}"
diff "${downloadfile}" "${downloadtmp}"
if [ $? -eq 0 ]; then
echo "INFO: the downloaded file is the same like last download."
rm -f "${downloadtmp}"
else
echo "OK: donwload contains an update."
isupdate=1
mv "${downloadtmp}" "${downloadfile}"
fi
else
echo "INFO: last download not available - first install or a forced update."
isupdate=1
mv "${downloadtmp}" "${downloadfile}"
fi
# ----------------------------------------------------------------------
header "Go into install dir ${installdir}"
header "Switch into install dir ${installdir} ..."
test -d "${installdir}" || mkdir -p "${installdir}"
cd ${installdir} || exit 2
pwd
# ----------------------------------------------------------------------
......@@ -141,14 +168,14 @@ run_task "${profiledir}/tasks_preinstall.sh"
# ----------------------------------------------------------------------
header "Extract ${IMLCI_PROJECT}.tgz"
header "Extract ${IMLCI_PROJECT}.tgz into $( pwd )"
tar -xzf ${tmpdir}/${IMLCI_PROJECT}.tgz . || exit 3
ls -l
# ----------------------------------------------------------------------
header "Remove download archive ${IMLCI_PROJECT}.tgz"
echo rm -f ${IMLCI_PROJECT}.tgz
# header "Remove download archive ${IMLCI_PROJECT}.tgz"
# echo rm -f ${IMLCI_PROJECT}.tgz
# ----------------------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment