Compare commits

..

No commits in common. "66c27ccd7374d1d11c6059fed1a3454eaee8774e" and "901f856402ee850c7a3c8c134263a0d98130866e" have entirely different histories.

3 changed files with 15 additions and 33 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
### update script for ab-openldap container and utility scripts ### update script for ab-openldap utility scripts
# version 1.0.0 # version 1.0.0
# 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,13 +15,6 @@ 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
@ -31,32 +24,18 @@ updateSuccess=0
# reference constants # reference constants
containerName='ab-openldap' containerName='ab-openldap'
containerUpdatePath='docker.asifbacchus.app/ldap/ab-openldap' server='https://git.asifbacchus.app/ab-docker/scripts/raw/branch/master/'
server="https://git.asifbacchus.app/ab-docker/scripts/raw/branch/master/$containerName/"
checksumFilename='checksums.sha256' checksumFilename='checksums.sha256'
# files to update # files to update
localScriptName='update.sh' localScriptName='update.sh'
repoScriptName='update.sh' repoScriptName="${containerName}-update.sh"
updateFiles="" updateFiles="ab-openldap.sh ab-openldap.params.template ab-openldap-backup.sh ab-openldap-backup.params.template"
printf "\n*** Updating %s container service scripts ***\n\n" "$containerName"
### update container ### download latest checksums
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
### 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"
@ -66,7 +45,8 @@ 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*' )
@ -92,7 +72,8 @@ else
fi fi
fi fi
## update files
### update files
set -- dummy $updateFiles set -- dummy $updateFiles
shift shift
for file; do for file; do

View File

@ -1,5 +1,6 @@
# ab-openldap
3818e56bc2eaa33c57a10b4e7bfdee4674df0d9b41ce665d5ca3853ebdd9212b ab-openldap-backup.params.template 3818e56bc2eaa33c57a10b4e7bfdee4674df0d9b41ce665d5ca3853ebdd9212b ab-openldap-backup.params.template
14b11370f980bd10b3cd96ddf3acab73c723f7594127e38d4b90ad09660b5e0a ab-openldap-backup.sh 14b11370f980bd10b3cd96ddf3acab73c723f7594127e38d4b90ad09660b5e0a ab-openldap-backup.sh
5257cbc175e1f35061e419f54c953875597996d887b3c882990319ecc2371bfd ab-openldap.params.template 5257cbc175e1f35061e419f54c953875597996d887b3c882990319ecc2371bfd ab-openldap.params.template
79d96713f2e0a1e9d8c4192077986fc8e6efe805441595d014931ec56163c3c9 ab-openldap.sh 79d96713f2e0a1e9d8c4192077986fc8e6efe805441595d014931ec56163c3c9 ab-openldap.sh
9e0702c1799c1e629387ddd9c36ae7dcad67e11d63c37209904da8b29ec71835 update.sh d37c4c1083ba72775955b151fe9a16a6c5d1cd7f63e52852bdb7b3fc1902db62 ab-openldap-update.sh

View File

@ -32,12 +32,12 @@ updateSuccess=0
# reference constants # reference constants
containerName='' containerName=''
containerUpdatePath='docker.asifbacchus.app/...' containerUpdatePath='docker.asifbacchus.app/...'
server="https://git.asifbacchus.app/ab-docker/scripts/raw/branch/master/$containerName/" server='https://git.asifbacchus.app/ab-docker/scripts/raw/branch/master/'
checksumFilename='checksums.sha256' checksumFilename='checksums.sha256'
# files to update # files to update
localScriptName='update.sh' localScriptName='update.sh'
repoScriptName='update.sh' repoScriptName="${containerName}-update.sh"
updateFiles="" updateFiles=""