mirror of
https://github.com/ivabus/binhost
synced 2024-11-10 02:05:15 +03:00
web.sh: add alternative shasum command (perl)
Signed-off-by: Ivan Bushchik <ivabus@ivabus.dev>
This commit is contained in:
parent
c31f86b104
commit
beb4b46caf
23
web.sh
Normal file → Executable file
23
web.sh
Normal file → Executable file
|
@ -19,9 +19,24 @@ requireCommands() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
requireCommands uname sha256sum cut dd chmod rm realpath expr
|
requireCommands uname cut dd chmod rm realpath expr
|
||||||
|
|
||||||
if [ "$(realpath $(command -v sha256sum))" = "/bin/busybox" ]; then
|
# Finding alternative, but supported sha256sums
|
||||||
|
SHA256SUM=""
|
||||||
|
if command -v sha256sum &> /dev/null; then
|
||||||
|
export SHA256SUM="sha256sum"
|
||||||
|
else
|
||||||
|
if command -v shasum &> /dev/null; then
|
||||||
|
SHASUMVER=$(shasum -v | cut -c 1)
|
||||||
|
if [ $SHASUMVER -ge 6 ]; then
|
||||||
|
export SHA256SUM="shasum -a 256"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
fail "Could not find sha256sum executable"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$(realpath $SHA256SUM)" = "/bin/busybox" ]; then
|
||||||
fail "Busybox sha256sum detected, will not work. Refusing to continue"
|
fail "Busybox sha256sum detected, will not work. Refusing to continue"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -60,7 +75,7 @@ cd $DIR
|
||||||
print ":: Downloading manifest"
|
print ":: Downloading manifest"
|
||||||
$DOWNLOAD_COMMAND $EXTERNAL_ADDRESS/runner/manifest $OUTPUT_ARG manifest
|
$DOWNLOAD_COMMAND $EXTERNAL_ADDRESS/runner/manifest $OUTPUT_ARG manifest
|
||||||
|
|
||||||
MANIFEST_HASHSUM=$(sha256sum manifest)
|
MANIFEST_HASHSUM=$($SHA256SUM manifest)
|
||||||
|
|
||||||
if [ ! -z $KEY ]; then
|
if [ ! -z $KEY ]; then
|
||||||
if [ ! $KEY = "$(echo $MANIFEST_HASHSUM | cut -c 1-${#KEY})" ]; then
|
if [ ! $KEY = "$(echo $MANIFEST_HASHSUM | cut -c 1-${#KEY})" ]; then
|
||||||
|
@ -80,7 +95,7 @@ print ":: Downloading runner"
|
||||||
|
|
||||||
$DOWNLOAD_COMMAND $EXTERNAL_ADDRESS/runner/runner-$PLATFORM-$ARCH $OUTPUT_ARG "runner-$PLATFORM-$ARCH"
|
$DOWNLOAD_COMMAND $EXTERNAL_ADDRESS/runner/runner-$PLATFORM-$ARCH $OUTPUT_ARG "runner-$PLATFORM-$ARCH"
|
||||||
|
|
||||||
if ! sha256sum -c hashes --ignore-missing; then
|
if ! $SHA256SUM -c hashes --ignore-missing >&2 ; then
|
||||||
fail "Incorrect hashsum of runner"
|
fail "Incorrect hashsum of runner"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue