#!/bin/bash SETUP_BIN="/opt/setup-x86_64.exe" SIG_URL="https://cygwin.com/setup-x86_64.exe.sig" SETUP_URL="https://cygwin.com/setup-x86_64.exe" TMP_BIN=$( mktemp ) TMP_SIG=$( mktemp ) function __o { rm $TMP_BIN; rm $TMP_SIG; } trap __o EXIT echo "Downloading Signature ..." curl -s "$SIG_URL" > $TMP_SIG echo "Downloading setup binary ..." curl -s "$SETUP_URL" > $TMP_BIN echo "Verifying Signature ..." gpg2 -q --verify $TMP_SIG $TMP_BIN if [ $? -ne 0 ]; then echo "ERROR: Bad Signature!" else echo "Installing setup" cp $TMP_BIN $SETUP_BIN chmod +x $SETUP_BIN fi