mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2024-06-07 19:40:43 +00:00
Distro aware checksum (#1345)
This commit is contained in:
parent
932cd8f89e
commit
4cb227629f
@ -215,7 +215,7 @@ if [[ "${GENERIC_PACKS}" ]]; then
|
||||
log "Checking if generic packs are up to date"
|
||||
if isTrue "${SKIP_GENERIC_PACK_UPDATE_CHECK:-false}" && [ -f "$sum_file" ]; then
|
||||
log "Skipping generic pack update check"
|
||||
elif isTrue "${FORCE_GENERIC_PACK_UPDATE}" || ! sha1sum -c "${sum_file}" --status 2> /dev/null; then
|
||||
elif isTrue "${FORCE_GENERIC_PACK_UPDATE}" || ! checkSum "${sum_file}"; then
|
||||
log "Generic pack(s) are out of date. Re-applying..."
|
||||
|
||||
base_dir=/tmp/generic_pack_base
|
||||
|
@ -236,3 +236,20 @@ function extract() {
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function checkSum() {
|
||||
local sum_file=${1?}
|
||||
|
||||
# Get distro
|
||||
distro=$(cat /etc/os-release | grep -E "^ID=" | cut -d= -f2 | sed -e 's/"//g')
|
||||
|
||||
if [ "${distro}" == "debian" ] && sha1sum -c "${sum_file}" --status 2> /dev/null; then
|
||||
return 0
|
||||
elif [ "${distro}" == "ubuntu" ] && sha1sum -c "${sum_file}" --status 2> /dev/null; then
|
||||
return 0
|
||||
elif [ "${distro}" == "alpine" ] && sha1sum -c "${sum_file}" -s 2> /dev/null; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user