hl-pak0-gen/dl_sources.sh

45 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
# fetches all of our download sources (and verifies them)
set -e
fetch_resource()
{
BASENAME=$(basename "$1")
SHA512FILE=$(cat "./sums/$BASENAME.sha512" | awk '{ print $1 }')
if [ ! -f "$BASENAME" ]
then
printf "Grabbing $2..."
wget -nc "$1"
printf "\n"
fi
# GNU vs non GNU
if [ -x "$(command -v sha512sum)" ]
then
SHA512SUM=$(sha512sum "$BASENAME" | awk '{ print $1 }')
elif [ -x "$(command -v sha512)" ]
then
SHA512SUM=$(sha512 -q "$BASENAME")
else
echo "No tool to validate sha512 sums with!"
exit 2
fi
if [ "$SHA512SUM" = "$SHA512FILE" ]
then
printf "$BASENAME has been verified.\n"
else
printf "$BASENAME has the invalid sha512sum. Error!\n"
exit
fi
}
fetch_resource "http://archive.org/download/Half-lifeUplink/hluplink.exe" "Half-Life: Uplink"
fetch_resource "http://archive.org/download/half-life-patches/English/Update 1.1.1.0 English/hl1110.exe" "Half-Life: Patch 1.1.1.0"
fetch_resource "https://archive.org/download/opfor-demo/opfordemofull.exe" "Half-Life: Opposing Force - Demo"
fetch_resource "https://downloads.ammahls.com/HLSDK/hl_sdk_v23.exe" "Half-Life SDK v2.3"
fetch_resource "http://archive.org/download/steaminstall_halflife/steaminstall_halflife.exe" "Steam Installer with Half-Life Cache"
#fetch_resource "http://archive.org/download/steaminstall_opfor/steaminstall_opfor.exe" "Steam Installer with Opposing Force Cache"