Compare commits
4 Commits
860cc1408f
...
901f856402
Author | SHA1 | Date | |
---|---|---|---|
|
901f856402 | ||
|
7fb4423026 | ||
|
69a7114ac6 | ||
|
9680c93574 |
@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
### update script for <ab-container> utility scripts
|
### update script for <ab-container> container and utility scripts
|
||||||
# version x.y.z
|
# version x.y.z
|
||||||
# script by Asif Bacchus
|
# script by Asif Bacchus
|
||||||
# usage of this script is subject to the license terms found at:
|
# usage of this script is subject to the license terms found at:
|
||||||
@ -15,6 +15,13 @@ if ! command -v wget > /dev/null 2>&1; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# is user root or in the docker group?
|
||||||
|
if [ ! "$( id -u )" -eq 0 ]; then
|
||||||
|
if ! id -Gn | grep docker > /dev/null; then
|
||||||
|
consoleError '1' "You must either be root or in the 'docker' group to pull container updates."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# zero counters
|
# zero counters
|
||||||
updatesAvailable=0
|
updatesAvailable=0
|
||||||
downloadFailed=0
|
downloadFailed=0
|
||||||
@ -24,6 +31,7 @@ updateSuccess=0
|
|||||||
|
|
||||||
# reference constants
|
# reference constants
|
||||||
containerName=''
|
containerName=''
|
||||||
|
containerUpdatePath='docker.asifbacchus.app/...'
|
||||||
server='https://git.asifbacchus.app/ab-docker/scripts/raw/branch/master/'
|
server='https://git.asifbacchus.app/ab-docker/scripts/raw/branch/master/'
|
||||||
checksumFilename='checksums.sha256'
|
checksumFilename='checksums.sha256'
|
||||||
|
|
||||||
@ -32,10 +40,23 @@ localScriptName='update.sh'
|
|||||||
repoScriptName="${containerName}-update.sh"
|
repoScriptName="${containerName}-update.sh"
|
||||||
updateFiles=""
|
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... "
|
printf "Getting latest checksums from ab-git server... "
|
||||||
if ! wget --quiet --tries=3 --timeout=10 -N "${server}${checksumFilename}"; then
|
if ! wget --quiet --tries=3 --timeout=10 -N "${server}${checksumFilename}"; then
|
||||||
printf "[ERROR]\n"
|
printf "[ERROR]\n"
|
||||||
@ -45,8 +66,7 @@ else
|
|||||||
printf "[OK]\n"
|
printf "[OK]\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
## check for updates to this script
|
||||||
### check for updates to this script
|
|
||||||
printf "Checking for updates to this script... "
|
printf "Checking for updates to this script... "
|
||||||
repoScriptChecksum=$( grep "$repoScriptName" "$checksumFilename" | grep -o '^\S*' )
|
repoScriptChecksum=$( grep "$repoScriptName" "$checksumFilename" | grep -o '^\S*' )
|
||||||
localScriptChecksum=$( sha256sum "$localScriptName" | grep -o '^\S*' )
|
localScriptChecksum=$( sha256sum "$localScriptName" | grep -o '^\S*' )
|
||||||
@ -72,8 +92,7 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
## update files
|
||||||
### update files
|
|
||||||
set -- dummy $updateFiles
|
set -- dummy $updateFiles
|
||||||
shift
|
shift
|
||||||
for file; do
|
for file; do
|
||||||
|
Loading…
Reference in New Issue
Block a user