Created
September 3, 2020 23:06
-
-
Save LinusCDE/82de7b06bdba360e69a6d94bb9ced1aa to your computer and use it in GitHub Desktop.
remarkable-bootstrap-wget.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
WGET_BINARIES_PATH='http://static.cosmos-ink.net/remarkable/artifacts' | |
WGET_BINARIES_FILENAME='wget-remarkable-pipeline_job245_wget1.20.3.zip' | |
WGET_BINARIES_SHA256='84185a5934e34e25794d439c78dc9f1590e4df12fbf369236f6a8749bf14d67f' | |
# Download and compare to hash | |
wget "$WGET_BINARIES_PATH/$WGET_BINARIES_FILENAME" -O "/home/root/$WGET_BINARIES_FILENAME" | |
if ! echo "$WGET_BINARIES_SHA256 /home/root/$WGET_BINARIES_FILENAME" | sha256sum -c -; then | |
echo 'FATAL: Invalid hash!' >&2 | |
exit 1 | |
fi | |
# Ensure to /home/root/.wget_bin exists and is empty | |
if [ -e /home/root/.wget_bin ]; then | |
rm -rf /home/root/.wget_bin/* | |
else | |
mkdir /home/root/.wget_bin | |
fi | |
# Unzip to /home/root/.wget_bin and remove downloaded file | |
unzip "/home/root/$WGET_BINARIES_FILENAME" -d "$WGET_DEST_DIR" -q | |
rm "/home/root/$WGET_BINARIES_FILENAME" | |
cat > /home/root/.wget_bin/wget <<EOF | |
#!/bin/sh | |
LD_LIBRARY_PATH="/home/root/.wget_bin/dist" /home/root/.wget_bin/dist/wget \$@ | |
EOF | |
chmod +x /home/root/.wget_bin/wget | |
# Optional env file | |
#echo 'PATH="/home/root/.wget_bin/dist:$PATH' > "$WGET_DEST_DIR/env" | |
#chmod +x "$WGET_DEST_DIR/env" | |
export PATH="/home/root/.wget_bin:$PATH" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment