Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
[Script] Verify checksums for install and uninstall scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
dm4 authored and hydai committed Dec 13, 2021
1 parent 84668a6 commit 07a24c4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scripts/preinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
set -e

INSTALL_SCRIPT_URL="https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.9.0/utils/install.sh"
INSTALL_SCRIPT_SHA1SUM="604bed0f37f53e22c3706cba8327526fa0fc91cd"
UNINSTALL_SCRIPT_URL="https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.9.0/utils/uninstall.sh"
UNINSTALL_SCRIPT_SHA1SUM="5d634bf063f7130e0c92baf3912a5fa4bed19aef"
INSTALL_SCRIPT_PATH=/tmp/install_wasmedge.sh
UNINSTALL_SCRIPT_PATH=/tmp/uninstall_wasmedge.sh
INSTALL_PATH="$HOME/.wasmedge"
Expand All @@ -12,9 +14,15 @@ INSTALL_VERSION=0.9.0
mkdir -p "$INSTALL_PATH"

wget -O "$UNINSTALL_SCRIPT_PATH" "$UNINSTALL_SCRIPT_URL"
[ "$(sha1sum $UNINSTALL_SCRIPT_PATH | awk '{print $1}')" != "$UNINSTALL_SCRIPT_SHA1SUM" ] && \
echo "Uninstall script checksum mismatch" && \
exit 1
bash "$UNINSTALL_SCRIPT_PATH" -p "$INSTALL_PATH" -q

wget -O "$INSTALL_SCRIPT_PATH" "$INSTALL_SCRIPT_URL"
[ "$(sha1sum $INSTALL_SCRIPT_PATH | awk '{print $1}')" != "$INSTALL_SCRIPT_SHA1SUM" ] && \
echo "Install script checksum mismatch" && \
exit 1
bash "$INSTALL_SCRIPT_PATH" -p "$INSTALL_PATH" -v "$INSTALL_VERSION"

rm -f $INSTALL_SCRIPT_PATH $UNINSTALL_SCRIPT_PATH

0 comments on commit 07a24c4

Please sign in to comment.