From 69a7114ac682763487af9b69da0522282a8bb062 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Fri, 13 Mar 2020 03:12:47 -0600 Subject: [PATCH] add container update --- template-update.sh | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/template-update.sh b/template-update.sh index c43c527..9d54efa 100755 --- a/template-update.sh +++ b/template-update.sh @@ -31,6 +31,7 @@ updateSuccess=0 # reference constants containerName='' +containerUpdatePath='docker.asifbacchus.app/...' server='https://git.asifbacchus.app/ab-docker/scripts/raw/branch/master/' checksumFilename='checksums.sha256' @@ -39,10 +40,23 @@ localScriptName='update.sh' repoScriptName="${containerName}-update.sh" updateFiles="" -printf "\n*** Updating %s container service scripts ***\n\n" "$containerName" + +### update container +printf "\n*** Updating %s container and service scripts ***\n\n" "$containerName" + +printf "Updating container:\n" +if ! docker pull "$containerUpdatePath"; then + printf "There was an error updating the container. Try again later.\n\n" + exit 1 +else + "Container updated!\n" +fi -### download latest checksums +### update scripts +printf "Updating %s service scripts\n" "$containerName" + +## download latest checksums printf "Getting latest checksums from ab-git server... " if ! wget --quiet --tries=3 --timeout=10 -N "${server}${checksumFilename}"; then printf "[ERROR]\n" @@ -52,8 +66,7 @@ else printf "[OK]\n" fi - -### check for updates to this script +## check for updates to this script printf "Checking for updates to this script... " repoScriptChecksum=$( grep "$repoScriptName" "$checksumFilename" | grep -o '^\S*' ) localScriptChecksum=$( sha256sum "$localScriptName" | grep -o '^\S*' ) @@ -79,8 +92,7 @@ else fi fi - -### update files +## update files set -- dummy $updateFiles shift for file; do